diff --git a/generated/Portal/Portal.Autorest/Az.Portal.csproj b/generated/Portal/Portal.Autorest/Az.Portal.csproj index 75c4f8297095..6fe9d12c6bbd 100644 --- a/generated/Portal/Portal.Autorest/Az.Portal.csproj +++ b/generated/Portal/Portal.Autorest/Az.Portal.csproj @@ -2,9 +2,9 @@ Portal Portal + Portal.Autorest - diff --git a/generated/Portal/Portal.Autorest/Az.Portal.format.ps1xml b/generated/Portal/Portal.Autorest/Az.Portal.format.ps1xml index 2c290b78209d..f44c299d24f0 100644 --- a/generated/Portal/Portal.Autorest/Az.Portal.format.ps1xml +++ b/generated/Portal/Portal.Autorest/Az.Portal.format.ps1xml @@ -2,33 +2,69 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.PortalIdentity + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Dashboard - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.PortalIdentity + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Dashboard#Multiple - + - + - + + + + + + + + + + + + + + + + + + + - DashboardName + Location - ResourceGroupName + Name - SubscriptionId + SystemDataCreatedAt + + + SystemDataCreatedBy + + + SystemDataCreatedByType + + + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + ResourceGroupName @@ -36,33 +72,21 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorDetail + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardLens - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorDetail + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardLens#Multiple - - - - - - - + - Code - - - Message - - - Target + Order @@ -70,39 +94,21 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.Operation + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardListResult - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.Operation + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardListResult#Multiple - - - - - - - - - - + - ActionType - - - IsDataAction - - - Name - - - Origin + NextLink @@ -110,39 +116,39 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.OperationDisplay + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartsPosition - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.OperationDisplay + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartsPosition#Multiple - + - + - + - + - Description + ColSpan - Operation + RowSpan - Provider + X - Resource + Y @@ -150,21 +156,21 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.OperationListResult + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesWithProvisioningState - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.OperationListResult + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesWithProvisioningState#Multiple - + - NextLink + ProvisioningState @@ -172,21 +178,33 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.Resource + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorDetail - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.Resource + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorDetail#Multiple - + + + + + + + - Name + Code + + + Message + + + Target @@ -194,51 +212,45 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.SystemData + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentSettings - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.SystemData + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentSettings#Multiple - - - - + - + - + - + - + - CreatedAt - - - CreatedBy + Content - CreatedByType + MarkdownSource - LastModifiedAt + MarkdownUri - LastModifiedBy + Subtitle - LastModifiedByType + Title @@ -246,85 +258,39 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.TrackedResource + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Operation - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.TrackedResource + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Operation#Multiple - - - - - - - - - - - - - + - + - + - + - Name - - - SystemDataCreatedAt - - - SystemDataCreatedBy - - - SystemDataCreatedByType - - - SystemDataLastModifiedAt - - - SystemDataLastModifiedBy + ActionType - SystemDataLastModifiedByType + IsDataAction - Location + Name - - - - - - - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.TrackedResourceTags - - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.TrackedResourceTags - - - - - - - - - - - Item + Origin @@ -332,63 +298,39 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.Dashboard + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.OperationDisplay - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.Dashboard + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.OperationDisplay#Multiple - - - - - - - - - - - - - + - + - + - + - Location - - - Name - - - SystemDataCreatedAt - - - SystemDataCreatedBy - - - SystemDataCreatedByType + Description - SystemDataLastModifiedAt + Operation - SystemDataLastModifiedBy + Provider - SystemDataLastModifiedByType + Resource @@ -396,21 +338,21 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardLens + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.OperationListResult - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardLens + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.OperationListResult#Multiple - + - Order + NextLink @@ -418,21 +360,21 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardListResult + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.PatchableDashboardTags - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardListResult + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.PatchableDashboardTags#Multiple - + - NextLink + Item @@ -440,39 +382,55 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartsPosition + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.PortalIdentity - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartsPosition + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.PortalIdentity#Multiple - - - - + - + - + - ColSpan + DashboardName - RowSpan + ResourceGroupName - X + SubscriptionId + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Resource + + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Resource#Multiple + + + + + + + + + + - Y + Name @@ -480,21 +438,51 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesWithProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.SystemData - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesWithProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.SystemData#Multiple - + + + + + + + + + + + + + + + + - ProvisioningState + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType @@ -502,45 +490,63 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentSettings + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.TrackedResource - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentSettings + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.TrackedResource#Multiple - + - + - + - + - + + + + + + + + + + - Content + Name - MarkdownSource + SystemDataCreatedAt - MarkdownUri + SystemDataCreatedBy - Subtitle + SystemDataCreatedByType - Title + SystemDataLastModifiedAt + + + SystemDataLastModifiedBy + + + SystemDataLastModifiedByType + + + Location @@ -548,9 +554,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.PatchableDashboardTags + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.TrackedResourceTags - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.PatchableDashboardTags + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.TrackedResourceTags#Multiple diff --git a/generated/Portal/Portal.Autorest/Az.Portal.psd1 b/generated/Portal/Portal.Autorest/Az.Portal.psd1 index a2467d685f00..46f8d3e1399a 100644 --- a/generated/Portal/Portal.Autorest/Az.Portal.psd1 +++ b/generated/Portal/Portal.Autorest/Az.Portal.psd1 @@ -11,8 +11,7 @@ DotNetFrameworkVersion = '4.7.2' RequiredAssemblies = './bin/Az.Portal.private.dll' FormatsToProcess = './Az.Portal.format.ps1xml' - FunctionsToExport = 'Get-AzPortalDashboard', 'New-AzPortalDashboard', 'Remove-AzPortalDashboard', 'Set-AzPortalDashboard', 'Update-AzPortalDashboard', '*' - AliasesToExport = '*' + FunctionsToExport = 'Get-AzPortalDashboard', 'New-AzPortalDashboard', 'Remove-AzPortalDashboard', 'Set-AzPortalDashboard', 'Update-AzPortalDashboard' PrivateData = @{ PSData = @{ Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Portal', 'Dashboard' diff --git a/generated/Portal/Portal.Autorest/Properties/AssemblyInfo.cs b/generated/Portal/Portal.Autorest/Properties/AssemblyInfo.cs index 53b7114c546d..41117eda57d0 100644 --- a/generated/Portal/Portal.Autorest/Properties/AssemblyInfo.cs +++ b/generated/Portal/Portal.Autorest/Properties/AssemblyInfo.cs @@ -1,28 +1,26 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); +// 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, +// distributed under the License is distributed on an ""AS IS"" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// ---------------------------------------------------------------------------------- +// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +// is regenerated. using System; using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -[assembly: AssemblyTitle("Microsoft Azure Powershell - Portal")] -[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("2fd7f4f5-bec3-4918-9e3a-3fc4224ca828")] -[assembly: AssemblyVersion("0.3.0")] -[assembly: AssemblyFileVersion("0.3.0")] +[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")] +[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")] +[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")] +[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - Portal")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("0.3.0")] +[assembly: System.Reflection.AssemblyVersionAttribute("0.3.0")] +[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly: System.CLSCompliantAttribute(false)] diff --git a/generated/Portal/Portal.Autorest/check-dependencies.ps1 b/generated/Portal/Portal.Autorest/check-dependencies.ps1 index c29591c7bfe1..90ca9867ae40 100644 --- a/generated/Portal/Portal.Autorest/check-dependencies.ps1 +++ b/generated/Portal/Portal.Autorest/check-dependencies.ps1 @@ -12,13 +12,13 @@ # 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) +param([switch]$NotIsolated, [switch]$Accounts, [switch]$Pester, [switch]$Resources) $ErrorActionPreference = 'Stop' -if(-not $Isolated) { +if(-not $NotIsolated) { Write-Host -ForegroundColor Green 'Creating isolated process...' $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path - & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated return } diff --git a/generated/Portal/Portal.Autorest/exports/Get-AzPortalDashboard.ps1 b/generated/Portal/Portal.Autorest/exports/Get-AzPortalDashboard.ps1 index 559f023ccf94..adfb2d7558b8 100644 --- a/generated/Portal/Portal.Autorest/exports/Get-AzPortalDashboard.ps1 +++ b/generated/Portal/Portal.Autorest/exports/Get-AzPortalDashboard.ps1 @@ -27,7 +27,7 @@ Get-AzPortalDashboard -ResourceGroupName my-rg -Name mydashboard .Inputs Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPortalIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard .Notes COMPLEX PARAMETER PROPERTIES @@ -42,7 +42,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.portal/get-azportaldashboard #> function Get-AzPortalDashboard { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] @@ -74,7 +74,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPortalIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -133,6 +132,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -157,9 +165,7 @@ begin { List = 'Az.Portal.private\Get-AzPortalDashboard_List'; List1 = 'Az.Portal.private\Get-AzPortalDashboard_List1'; } - if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -173,6 +179,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/Portal/Portal.Autorest/exports/New-AzPortalDashboard.ps1 b/generated/Portal/Portal.Autorest/exports/New-AzPortalDashboard.ps1 index 157bd60bf7c0..ef7c644b52a5 100644 --- a/generated/Portal/Portal.Autorest/exports/New-AzPortalDashboard.ps1 +++ b/generated/Portal/Portal.Autorest/exports/New-AzPortalDashboard.ps1 @@ -16,16 +16,16 @@ <# .Synopsis -Creates or updates a Dashboard. +create a Dashboard. .Description -Creates or updates a Dashboard. +create a Dashboard. .Example New-AzPortalDashboard -DashboardPath .\resources\dash1.json -ResourceGroupName mydash-rg -DashboardName my-dashboard03 .Inputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard .Notes COMPLEX PARAMETER PROPERTIES @@ -33,7 +33,7 @@ To create the parameters described below, construct a hash table containing the LENS : The dashboard lenses. Order : The lens order. - Part : The dashboard parts. + Part >: The dashboard parts. PositionColSpan : The dashboard's part column span. PositionRowSpan : The dashboard's part row span. PositionX : The dashboard's part x coordinate. @@ -42,18 +42,12 @@ LENS : The dashboard lenses. [Metadata ]: The dashboard len's metadata. RESOURCE : The shared dashboard resource definition. - Location : The geo-location where the resource lives + [Location ]: The geo-location where the resource lives [Tag ]: Resource tags. [(Any) ]: This indicates any property can be added to this object. - [SystemDataCreatedAt ]: The timestamp of resource creation (UTC). - [SystemDataCreatedBy ]: The identity that created the resource. - [SystemDataCreatedByType ]: The type of identity that created the resource. - [SystemDataLastModifiedAt ]: The timestamp of resource last modification (UTC) - [SystemDataLastModifiedBy ]: The identity that last modified the resource. - [SystemDataLastModifiedByType ]: The type of identity that last modified the resource. - [Lens ]: The dashboard lenses. + [Lens >]: The dashboard lenses. Order : The lens order. - Part : The dashboard parts. + Part >: The dashboard parts. PositionColSpan : The dashboard's part column span. PositionRowSpan : The dashboard's part row span. PositionX : The dashboard's part x coordinate. @@ -66,7 +60,7 @@ RESOURCE : The shared dashboard resource definition. https://learn.microsoft.com/powershell/module/az.portal/new-azportaldashboard #> function New-AzPortalDashboard { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -93,9 +87,8 @@ param( [Parameter(ParameterSetName='Create', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard] # The shared dashboard resource definition. - # To construct, see NOTES section for RESOURCE properties and create a hash table. ${Resource}, [Parameter(ParameterSetName='CreateExpanded', Mandatory)] @@ -107,25 +100,36 @@ param( [Parameter(ParameterSetName='CreateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[]] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens[]] # The dashboard lenses. - # To construct, see NOTES section for LENS properties and create a hash table. ${Lens}, [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata]))] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata]))] [System.Collections.Hashtable] # The dashboard metadata. ${Metadata}, [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags]))] [System.Collections.Hashtable] # Resource tags. ${Tag}, + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + [Parameter(ParameterSetName='CreateByFile', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] [System.String] @@ -189,6 +193,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -210,11 +223,11 @@ begin { $mapping = @{ Create = 'Az.Portal.private\New-AzPortalDashboard_Create'; CreateExpanded = 'Az.Portal.private\New-AzPortalDashboard_CreateExpanded'; + CreateViaJsonFilePath = 'Az.Portal.private\New-AzPortalDashboard_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.Portal.private\New-AzPortalDashboard_CreateViaJsonString'; CreateByFile = 'Az.Portal.custom\New-AzPortalDashboard'; } - if (('Create', 'CreateExpanded', 'CreateByFile') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Create', 'CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString', 'CreateByFile') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -228,6 +241,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/Portal/Portal.Autorest/exports/ProxyCmdletDefinitions.ps1 b/generated/Portal/Portal.Autorest/exports/ProxyCmdletDefinitions.ps1 index fdbd5f5a8b0f..0273527c5b96 100644 --- a/generated/Portal/Portal.Autorest/exports/ProxyCmdletDefinitions.ps1 +++ b/generated/Portal/Portal.Autorest/exports/ProxyCmdletDefinitions.ps1 @@ -27,7 +27,7 @@ Get-AzPortalDashboard -ResourceGroupName my-rg -Name mydashboard .Inputs Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPortalIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard .Notes COMPLEX PARAMETER PROPERTIES @@ -42,7 +42,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.portal/get-azportaldashboard #> function Get-AzPortalDashboard { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] @@ -74,7 +74,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPortalIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -133,6 +132,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -157,9 +165,7 @@ begin { List = 'Az.Portal.private\Get-AzPortalDashboard_List'; List1 = 'Az.Portal.private\Get-AzPortalDashboard_List1'; } - if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -173,6 +179,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) @@ -218,16 +227,16 @@ end { <# .Synopsis -Creates or updates a Dashboard. +create a Dashboard. .Description -Creates or updates a Dashboard. +create a Dashboard. .Example New-AzPortalDashboard -DashboardPath .\resources\dash1.json -ResourceGroupName mydash-rg -DashboardName my-dashboard03 .Inputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard .Notes COMPLEX PARAMETER PROPERTIES @@ -235,7 +244,7 @@ To create the parameters described below, construct a hash table containing the LENS : The dashboard lenses. Order : The lens order. - Part : The dashboard parts. + Part >: The dashboard parts. PositionColSpan : The dashboard's part column span. PositionRowSpan : The dashboard's part row span. PositionX : The dashboard's part x coordinate. @@ -244,18 +253,12 @@ LENS : The dashboard lenses. [Metadata ]: The dashboard len's metadata. RESOURCE : The shared dashboard resource definition. - Location : The geo-location where the resource lives + [Location ]: The geo-location where the resource lives [Tag ]: Resource tags. [(Any) ]: This indicates any property can be added to this object. - [SystemDataCreatedAt ]: The timestamp of resource creation (UTC). - [SystemDataCreatedBy ]: The identity that created the resource. - [SystemDataCreatedByType ]: The type of identity that created the resource. - [SystemDataLastModifiedAt ]: The timestamp of resource last modification (UTC) - [SystemDataLastModifiedBy ]: The identity that last modified the resource. - [SystemDataLastModifiedByType ]: The type of identity that last modified the resource. - [Lens ]: The dashboard lenses. + [Lens >]: The dashboard lenses. Order : The lens order. - Part : The dashboard parts. + Part >: The dashboard parts. PositionColSpan : The dashboard's part column span. PositionRowSpan : The dashboard's part row span. PositionX : The dashboard's part x coordinate. @@ -268,7 +271,7 @@ RESOURCE : The shared dashboard resource definition. https://learn.microsoft.com/powershell/module/az.portal/new-azportaldashboard #> function New-AzPortalDashboard { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -295,9 +298,8 @@ param( [Parameter(ParameterSetName='Create', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard] # The shared dashboard resource definition. - # To construct, see NOTES section for RESOURCE properties and create a hash table. ${Resource}, [Parameter(ParameterSetName='CreateExpanded', Mandatory)] @@ -309,25 +311,36 @@ param( [Parameter(ParameterSetName='CreateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[]] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens[]] # The dashboard lenses. - # To construct, see NOTES section for LENS properties and create a hash table. ${Lens}, [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata]))] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata]))] [System.Collections.Hashtable] # The dashboard metadata. ${Metadata}, [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags]))] [System.Collections.Hashtable] # Resource tags. ${Tag}, + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + [Parameter(ParameterSetName='CreateByFile', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] [System.String] @@ -391,6 +404,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -412,11 +434,11 @@ begin { $mapping = @{ Create = 'Az.Portal.private\New-AzPortalDashboard_Create'; CreateExpanded = 'Az.Portal.private\New-AzPortalDashboard_CreateExpanded'; + CreateViaJsonFilePath = 'Az.Portal.private\New-AzPortalDashboard_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.Portal.private\New-AzPortalDashboard_CreateViaJsonString'; CreateByFile = 'Az.Portal.custom\New-AzPortalDashboard'; } - if (('Create', 'CreateExpanded', 'CreateByFile') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Create', 'CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString', 'CreateByFile') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -430,6 +452,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) @@ -530,7 +555,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPortalIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -595,6 +619,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -617,9 +650,7 @@ begin { Delete = 'Az.Portal.private\Remove-AzPortalDashboard_Delete'; DeleteViaIdentity = 'Az.Portal.private\Remove-AzPortalDashboard_DeleteViaIdentity'; } - if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -633,6 +664,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) @@ -678,9 +712,9 @@ end { <# .Synopsis -Updates an existing Dashboard. +update an existing Dashboard. .Description -Updates an existing Dashboard. +update an existing Dashboard. .Example Update-AzPortalDashboard -ResourceGroupName my-rg -Name dashbase03 -Tag @{'hidden-title'="My Dashboard Title"; NewTag="NewValue"} .Example @@ -689,7 +723,7 @@ Get-AzPortalDashboard -ResourceGroupName my-rg -Name dashbase03 | Update-AzPorta .Inputs Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPortalIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard .Notes COMPLEX PARAMETER PROPERTIES @@ -703,7 +737,7 @@ INPUTOBJECT : Identity Parameter LENS : The dashboard lenses. Order : The lens order. - Part : The dashboard parts. + Part >: The dashboard parts. PositionColSpan : The dashboard's part column span. PositionRowSpan : The dashboard's part row span. PositionX : The dashboard's part x coordinate. @@ -714,10 +748,12 @@ LENS : The dashboard lenses. https://learn.microsoft.com/powershell/module/az.portal/update-azportaldashboard #> function Update-AzPortalDashboard { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard])] [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Alias('DashboardName')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')] [System.String] @@ -725,6 +761,8 @@ param( ${Name}, [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')] [System.String] # The name of the resource group. @@ -732,6 +770,8 @@ param( ${ResourceGroupName}, [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaJsonFilePath')] + [Parameter(ParameterSetName='UpdateViaJsonString')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] @@ -743,31 +783,44 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPortalIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[]] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens[]] # The dashboard lenses. - # To construct, see NOTES section for LENS properties and create a hash table. ${Lens}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata]))] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata]))] [System.Collections.Hashtable] # The dashboard metadata. ${Metadata}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags]))] [System.Collections.Hashtable] # Resource tags ${Tag}, + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -824,6 +877,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -845,10 +907,10 @@ begin { $mapping = @{ UpdateExpanded = 'Az.Portal.private\Update-AzPortalDashboard_UpdateExpanded'; UpdateViaIdentityExpanded = 'Az.Portal.private\Update-AzPortalDashboard_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.Portal.private\Update-AzPortalDashboard_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.Portal.private\Update-AzPortalDashboard_UpdateViaJsonString'; } - if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -862,6 +924,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) @@ -914,12 +979,12 @@ Creates or updates a Dashboard. Set-AzPortalDashboard -DashboardPath .\resources\dash1-update.json -ResourceGroupName my-rg -DashboardName dashbase03 .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard .Link https://learn.microsoft.com/powershell/module/az.portal/set-azportaldashboard #> function Set-AzPortalDashboard { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard])] [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -994,6 +1059,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -1015,9 +1089,7 @@ begin { $mapping = @{ __AllParameterSets = 'Az.Portal.custom\Set-AzPortalDashboard'; } - if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -1031,6 +1103,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/Portal/Portal.Autorest/exports/Remove-AzPortalDashboard.ps1 b/generated/Portal/Portal.Autorest/exports/Remove-AzPortalDashboard.ps1 index 298789708848..2a09050563f4 100644 --- a/generated/Portal/Portal.Autorest/exports/Remove-AzPortalDashboard.ps1 +++ b/generated/Portal/Portal.Autorest/exports/Remove-AzPortalDashboard.ps1 @@ -71,7 +71,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPortalIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -136,6 +135,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -158,9 +166,7 @@ begin { Delete = 'Az.Portal.private\Remove-AzPortalDashboard_Delete'; DeleteViaIdentity = 'Az.Portal.private\Remove-AzPortalDashboard_DeleteViaIdentity'; } - if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -174,6 +180,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/Portal/Portal.Autorest/exports/Set-AzPortalDashboard.ps1 b/generated/Portal/Portal.Autorest/exports/Set-AzPortalDashboard.ps1 index 31b1dab984ee..1f83d67a1f5b 100644 --- a/generated/Portal/Portal.Autorest/exports/Set-AzPortalDashboard.ps1 +++ b/generated/Portal/Portal.Autorest/exports/Set-AzPortalDashboard.ps1 @@ -23,12 +23,12 @@ Creates or updates a Dashboard. Set-AzPortalDashboard -DashboardPath .\resources\dash1-update.json -ResourceGroupName my-rg -DashboardName dashbase03 .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard .Link https://learn.microsoft.com/powershell/module/az.portal/set-azportaldashboard #> function Set-AzPortalDashboard { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard])] [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -103,6 +103,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -124,9 +133,7 @@ begin { $mapping = @{ __AllParameterSets = 'Az.Portal.custom\Set-AzPortalDashboard'; } - if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('__AllParameterSets') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -140,6 +147,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/Portal/Portal.Autorest/exports/Update-AzPortalDashboard.ps1 b/generated/Portal/Portal.Autorest/exports/Update-AzPortalDashboard.ps1 index 91ee06047b96..555d2ca07920 100644 --- a/generated/Portal/Portal.Autorest/exports/Update-AzPortalDashboard.ps1 +++ b/generated/Portal/Portal.Autorest/exports/Update-AzPortalDashboard.ps1 @@ -16,9 +16,9 @@ <# .Synopsis -Updates an existing Dashboard. +update an existing Dashboard. .Description -Updates an existing Dashboard. +update an existing Dashboard. .Example Update-AzPortalDashboard -ResourceGroupName my-rg -Name dashbase03 -Tag @{'hidden-title'="My Dashboard Title"; NewTag="NewValue"} .Example @@ -27,7 +27,7 @@ Get-AzPortalDashboard -ResourceGroupName my-rg -Name dashbase03 | Update-AzPorta .Inputs Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPortalIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard .Notes COMPLEX PARAMETER PROPERTIES @@ -41,7 +41,7 @@ INPUTOBJECT : Identity Parameter LENS : The dashboard lenses. Order : The lens order. - Part : The dashboard parts. + Part >: The dashboard parts. PositionColSpan : The dashboard's part column span. PositionRowSpan : The dashboard's part row span. PositionX : The dashboard's part x coordinate. @@ -52,10 +52,12 @@ LENS : The dashboard lenses. https://learn.microsoft.com/powershell/module/az.portal/update-azportaldashboard #> function Update-AzPortalDashboard { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard])] [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Alias('DashboardName')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')] [System.String] @@ -63,6 +65,8 @@ param( ${Name}, [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')] [System.String] # The name of the resource group. @@ -70,6 +74,8 @@ param( ${ResourceGroupName}, [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaJsonFilePath')] + [Parameter(ParameterSetName='UpdateViaJsonString')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] @@ -81,31 +87,44 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPortalIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[]] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens[]] # The dashboard lenses. - # To construct, see NOTES section for LENS properties and create a hash table. ${Lens}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata]))] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata]))] [System.Collections.Hashtable] # The dashboard metadata. ${Metadata}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags]))] [System.Collections.Hashtable] # Resource tags ${Tag}, + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -162,6 +181,15 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + + $context = Get-AzContext + if (-not $context -and -not $testPlayback) { + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." + exit + } if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() @@ -183,10 +211,10 @@ begin { $mapping = @{ UpdateExpanded = 'Az.Portal.private\Update-AzPortalDashboard_UpdateExpanded'; UpdateViaIdentityExpanded = 'Az.Portal.private\Update-AzPortalDashboard_UpdateViaIdentityExpanded'; + UpdateViaJsonFilePath = 'Az.Portal.private\Update-AzPortalDashboard_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.Portal.private\Update-AzPortalDashboard_UpdateViaJsonString'; } - if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -200,6 +228,9 @@ begin { [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/Portal/Portal.Autorest/generate-info.json b/generated/Portal/Portal.Autorest/generate-info.json index 176b7564d999..befaf865a01c 100644 --- a/generated/Portal/Portal.Autorest/generate-info.json +++ b/generated/Portal/Portal.Autorest/generate-info.json @@ -1,3 +1,3 @@ { - "generate_Id": "351efe1a-d585-4289-9408-d9c07e8ef900" + "generate_Id": "aaee2442-a92f-4fe2-abbc-96ce6b74ab42" } diff --git a/generated/Portal/Portal.Autorest/generated/Module.cs b/generated/Portal/Portal.Autorest/generated/Module.cs index 1681d2e8f034..4d56fffef83c 100644 --- a/generated/Portal/Portal.Autorest/generated/Module.cs +++ b/generated/Portal/Portal.Autorest/generated/Module.cs @@ -28,12 +28,20 @@ public partial class Module public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler(); + private static bool _init = false; + + private static readonly global::System.Object _initLock = new global::System.Object(); + + private static Microsoft.Azure.PowerShell.Cmdlets.Portal.Module _instance; + /// the ISendAsync pipeline instance private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline _pipeline; /// the ISendAsync pipeline instance (when proxy is enabled) private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline _pipelineWithProxy; + private static readonly global::System.Object _singletonLock = new global::System.Object(); + public bool _useProxy = false; public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy(); @@ -56,11 +64,8 @@ public partial class Module /// The delegate to get the telemetry info. public GetTelemetryInfoDelegate GetTelemetryInfo { get; set; } - /// Backing field for property. - private static Microsoft.Azure.PowerShell.Cmdlets.Portal.Module _instance; - /// the singleton of this module class - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.Portal.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Module()); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Module Instance { get { if (_instance == null) { lock (_singletonLock) { if (_instance == null) { _instance = new Module(); }}} return _instance; } } /// The Name of this module public string Name => @"Az.Portal"; @@ -125,9 +130,17 @@ public Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline CreatePipe /// 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(); + if (_init == false) + { + lock (_initLock) { + if (_init == false) { + 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(); + _init = true; + } + } + } } /// Creates the module instance. diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Any.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Any.PowerShell.cs index 1d0bc90164e7..cfcf623112c5 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Any.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Any.PowerShell.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; - /// Any object + /// Anything [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] public partial class Any { @@ -54,6 +54,14 @@ public partial class Any partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + /// /// Deserializes a into a new instance of . @@ -125,8 +133,20 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny DeserializeF /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } - /// Any object + /// Anything [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] public partial interface IAny diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Any.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Any.cs index 6c22514568de..676cd44c6edb 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Any.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Any.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; - /// Any object + /// Anything public partial class Any : Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAnyInternal @@ -19,13 +19,13 @@ public Any() } } - /// Any object + /// Anything public partial interface IAny : Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IJsonSerializable { } - /// Any object + /// Anything internal partial interface IAnyInternal { diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Any.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Any.json.cs index e51922ef5cee..910153633b0e 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Any.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Any.json.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; - /// Any object + /// Anything public partial class Any { diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/Dashboard.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/Dashboard.PowerShell.cs deleted file mode 100644 index e8c2f456f467..000000000000 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/Dashboard.PowerShell.cs +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview -{ - using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; - - /// The shared dashboard resource definition. - [System.ComponentModel.TypeConverter(typeof(DashboardTypeConverter))] - public partial class Dashboard - { - - /// - /// 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 Dashboard(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.Portal.Models.Api20221201Preview.IDashboardInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesWithProvisioningStateTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.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.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.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.Portal.Models.Api50.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("Tag")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.TrackedResourceTagsTypeConverter.ConvertFrom); - } - if (content.Contains("Location")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); - } - if (content.Contains("Lens")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal)this).Lens = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[]) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal)this).Lens, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardLensTypeConverter.ConvertFrom)); - } - if (content.Contains("Metadata")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesWithProvisioningStateMetadataTypeConverter.ConvertFrom); - } - if (content.Contains("ProvisioningState")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState.CreateFrom); - } - AfterDeserializeDictionary(content); - } - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - internal Dashboard(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.Portal.Models.Api20221201Preview.IDashboardInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesWithProvisioningStateTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.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.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.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.Portal.Models.Api50.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("Tag")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.TrackedResourceTagsTypeConverter.ConvertFrom); - } - if (content.Contains("Location")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); - } - if (content.Contains("Lens")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal)this).Lens = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[]) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal)this).Lens, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardLensTypeConverter.ConvertFrom)); - } - if (content.Contains("Metadata")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesWithProvisioningStateMetadataTypeConverter.ConvertFrom); - } - if (content.Contains("ProvisioningState")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState.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.Portal.Models.Api20221201Preview.IDashboard DeserializeFromDictionary(global::System.Collections.IDictionary content) - { - return new Dashboard(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.Portal.Models.Api20221201Preview.IDashboard DeserializeFromPSObject(global::System.Management.Automation.PSObject content) - { - return new Dashboard(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.Portal.Models.Api20221201Preview.IDashboard FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); - } - /// The shared dashboard resource definition. - [System.ComponentModel.TypeConverter(typeof(DashboardTypeConverter))] - public partial interface IDashboard - - { - - } -} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/Dashboard.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/Dashboard.cs deleted file mode 100644 index 4580ef72e667..000000000000 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/Dashboard.cs +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview -{ - using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; - - /// The shared dashboard resource definition. - public partial class Dashboard : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IValidates - { - /// - /// Backing field for Inherited model - /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.TrackedResource(); - - /// - /// Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - /// - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).Id; } - - /// The dashboard lenses. - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)Property).Lens; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)Property).Lens = value ?? null /* arrayOf */; } - - /// The geo-location where the resource lives - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)__trackedResource).Location = value ; } - - /// The dashboard metadata. - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)Property).Metadata; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)Property).Metadata = value ?? null /* model class */; } - - /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesWithProvisioningState()); set { {_property = value;} } } - - /// Internal Acessors for ProvisioningState - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)Property).ProvisioningState = value; } - - /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).Id = value; } - - /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).Name = value; } - - /// Internal Acessors for SystemData - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemData = value; } - - /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).Type = value; } - - /// The name of the resource - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).Name; } - - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState _property; - - /// The resource-specific properties for this resource. - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesWithProvisioningState()); set => this._property = value; } - - /// The status of the last operation. - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)Property).ProvisioningState; } - - /// - /// Azure Resource Manager metadata containing createdBy and modifiedBy information. - /// - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemData; } - - /// The timestamp of resource creation (UTC). - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } - - /// The identity that created the resource. - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemDataCreatedBy = value ?? null; } - - /// The type of identity that created the resource. - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType)""); } - - /// The timestamp of resource last modification (UTC) - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } - - /// The identity that last modified the resource. - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value ?? null; } - - /// The type of identity that last modified the resource. - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType)""); } - - /// Resource tags. - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.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.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__trackedResource).Type; } - - /// Creates an new instance. - public Dashboard() - { - - } - - /// 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.Portal.Runtime.IEventListener eventListener) - { - await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); - await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); - } - } - /// The shared dashboard resource definition. - public partial interface IDashboard : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResource - { - /// The dashboard lenses. - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"The dashboard lenses.", - SerializedName = @"lenses", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get; set; } - /// The dashboard metadata. - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"The dashboard metadata.", - SerializedName = @"metadata", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get; set; } - /// The status of the last operation. - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( - Required = false, - ReadOnly = true, - Description = @"The status of the last operation.", - SerializedName = @"provisioningState", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState? ProvisioningState { get; } - - } - /// The shared dashboard resource definition. - internal partial interface IDashboardInternal : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal - { - /// The dashboard lenses. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get; set; } - /// The dashboard metadata. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get; set; } - /// The resource-specific properties for this resource. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState Property { get; set; } - /// The status of the last operation. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState? ProvisioningState { get; set; } - - } -} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Dashboard.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Dashboard.PowerShell.cs new file mode 100644 index 000000000000..78e540cff884 --- /dev/null +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Dashboard.PowerShell.cs @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + + /// The shared dashboard resource definition. + [System.ComponentModel.TypeConverter(typeof(DashboardTypeConverter))] + public partial class Dashboard + { + + /// + /// 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); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Dashboard(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.Portal.Models.IDashboardInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesWithProvisioningStateTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Lens")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal)this).Lens = (System.Collections.Generic.List) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal)this).Lens, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardLensTypeConverter.ConvertFrom)); + } + if (content.Contains("Metadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesWithProvisioningStateMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal)this).ProvisioningState, 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 Dashboard(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.Portal.Models.IDashboardInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesWithProvisioningStateTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.TrackedResourceTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Lens")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal)this).Lens = (System.Collections.Generic.List) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal)this).Lens, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardLensTypeConverter.ConvertFrom)); + } + if (content.Contains("Metadata")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesWithProvisioningStateMetadataTypeConverter.ConvertFrom); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal)this).ProvisioningState, 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.Portal.Models.IDashboard DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Dashboard(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.Portal.Models.IDashboard DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Dashboard(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.Portal.Models.IDashboard FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The shared dashboard resource definition. + [System.ComponentModel.TypeConverter(typeof(DashboardTypeConverter))] + public partial interface IDashboard + + { + + } +} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/Dashboard.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Dashboard.TypeConverter.cs similarity index 97% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/Dashboard.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/Dashboard.TypeConverter.cs index 84a391928a3e..ee50583716a4 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/Dashboard.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Dashboard.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -105,14 +105,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Dashboard.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Dashboard.cs new file mode 100644 index 000000000000..fb9c36d0d475 --- /dev/null +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Dashboard.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.Portal.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + + /// The shared dashboard resource definition. + public partial class Dashboard : + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.TrackedResource(); + + /// + /// Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).Id; } + + /// The dashboard lenses. + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] + public System.Collections.Generic.List Lens { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)Property).Lens; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)Property).Lens = value ?? null /* arrayOf */; } + + /// The geo-location where the resource lives + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)__trackedResource).Location = value ?? null; } + + /// The dashboard metadata. + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)Property).Metadata; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)Property).Metadata = value ?? null /* model class */; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesWithProvisioningState()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemData = value; } + + /// Internal Acessors for SystemDataCreatedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt = value; } + + /// Internal Acessors for SystemDataCreatedBy + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy = value; } + + /// Internal Acessors for SystemDataCreatedByType + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType = value; } + + /// Internal Acessors for SystemDataLastModifiedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt = value; } + + /// Internal Acessors for SystemDataLastModifiedBy + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy = value; } + + /// Internal Acessors for SystemDataLastModifiedByType + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).Type = value; } + + /// The name of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState _property; + + /// The resource-specific properties for this resource. + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesWithProvisioningState()); set => this._property = value; } + + /// The status of the last operation. + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)Property).ProvisioningState; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemData = value ?? null /* model class */; } + + /// The timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataCreatedAt; } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataCreatedBy; } + + /// The type of identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataCreatedByType; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedAt; } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedBy; } + + /// The type of identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).SystemDataLastModifiedByType; } + + /// Resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__trackedResource).Type; } + + /// Creates an new instance. + public Dashboard() + { + + } + + /// 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.Portal.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// The shared dashboard resource definition. + public partial interface IDashboard : + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResource + { + /// The dashboard lenses. + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The dashboard lenses.", + SerializedName = @"lenses", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens) })] + System.Collections.Generic.List Lens { get; set; } + /// The dashboard metadata. + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The dashboard metadata.", + SerializedName = @"metadata", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata) })] + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get; set; } + /// The status of the last operation. + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The status of the last operation.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled")] + string ProvisioningState { get; } + + } + /// The shared dashboard resource definition. + internal partial interface IDashboardInternal : + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal + { + /// The dashboard lenses. + System.Collections.Generic.List Lens { get; set; } + /// The dashboard metadata. + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get; set; } + /// The resource-specific properties for this resource. + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState Property { get; set; } + /// The status of the last operation. + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled")] + string ProvisioningState { get; set; } + + } +} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/Dashboard.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Dashboard.json.cs similarity index 91% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/Dashboard.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/Dashboard.json.cs index 1c81a4598de8..838e28fe1329 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/Dashboard.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Dashboard.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -65,19 +65,17 @@ internal Dashboard(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonOb { return; } - __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.TrackedResource(json); - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesWithProvisioningState.FromJson(__jsonProperties) : Property;} + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesWithProvisioningState.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard. + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new Dashboard(json) : null; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardLens.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardLens.PowerShell.cs similarity index 67% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardLens.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardLens.PowerShell.cs index 2b7fd50fd436..b87e200b6158 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardLens.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardLens.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DashboardLens partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -70,21 +78,21 @@ internal DashboardLens(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Order")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLensInternal)this).Order = (int) content.GetValueForProperty("Order",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLensInternal)this).Order, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLensInternal)this).Order = (int) content.GetValueForProperty("Order",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLensInternal)this).Order, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("Part")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLensInternal)this).Part = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts[]) content.GetValueForProperty("Part",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLensInternal)this).Part, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLensInternal)this).Part = (System.Collections.Generic.List) content.GetValueForProperty("Part",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLensInternal)this).Part, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartsTypeConverter.ConvertFrom)); } if (content.Contains("Metadata")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLensInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLensInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLensInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLensInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -99,41 +107,41 @@ internal DashboardLens(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Order")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLensInternal)this).Order = (int) content.GetValueForProperty("Order",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLensInternal)this).Order, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLensInternal)this).Order = (int) content.GetValueForProperty("Order",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLensInternal)this).Order, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("Part")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLensInternal)this).Part = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts[]) content.GetValueForProperty("Part",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLensInternal)this).Part, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLensInternal)this).Part = (System.Collections.Generic.List) content.GetValueForProperty("Part",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLensInternal)this).Part, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartsTypeConverter.ConvertFrom)); } if (content.Contains("Metadata")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLensInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLensInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLensInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLensInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DashboardLens(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DashboardLens(content); } @@ -143,12 +151,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// A dashboard lens. [System.ComponentModel.TypeConverter(typeof(DashboardLensTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardLens.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardLens.TypeConverter.cs similarity index 97% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardLens.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardLens.TypeConverter.cs index 6d5c546d78c5..d7552e5e8b82 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardLens.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardLens.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardLens.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardLens.cs similarity index 77% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardLens.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardLens.cs index 32880ab9b564..bd4b969598ca 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardLens.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardLens.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// A dashboard lens. public partial class DashboardLens : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLensInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLensInternal { /// Backing field for property. @@ -28,11 +28,11 @@ public partial class DashboardLens : public int Order { get => this._order; set => this._order = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts[] _part; + private System.Collections.Generic.List _part; /// The dashboard parts. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts[] Part { get => this._part; set => this._part = value; } + public System.Collections.Generic.List Part { get => this._part; set => this._part = value; } /// Creates an new instance. public DashboardLens() @@ -48,6 +48,9 @@ public partial interface IDashboardLens : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard len's metadata.", SerializedName = @"metadata", PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) })] @@ -56,6 +59,9 @@ public partial interface IDashboardLens : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = true, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The lens order.", SerializedName = @"order", PossibleTypes = new [] { typeof(int) })] @@ -64,10 +70,13 @@ public partial interface IDashboardLens : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = true, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard parts.", SerializedName = @"parts", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts[] Part { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardParts) })] + System.Collections.Generic.List Part { get; set; } } /// A dashboard lens. @@ -79,7 +88,7 @@ internal partial interface IDashboardLensInternal /// The lens order. int Order { get; set; } /// The dashboard parts. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts[] Part { get; set; } + System.Collections.Generic.List Part { get; set; } } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardLens.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardLens.json.cs similarity index 88% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardLens.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardLens.json.cs index 7606d90b7977..bac13ce4f7c6 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardLens.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardLens.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -65,20 +65,18 @@ internal DashboardLens(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.Js { return; } - {_order = If( json?.PropertyT("order"), out var __jsonOrder) ? (int)__jsonOrder : Order;} - {_part = If( json?.PropertyT("parts"), out var __jsonParts) ? If( __jsonParts as Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Models.Api20221201Preview.IDashboardParts) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardParts.FromJson(__u) )) ))() : null : Part;} - {_metadata = If( json?.PropertyT("metadata"), out var __jsonMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Any.FromJson(__jsonMetadata) : Metadata;} + {_order = If( json?.PropertyT("order"), out var __jsonOrder) ? (int)__jsonOrder : _order;} + {_part = If( json?.PropertyT("parts"), out var __jsonParts) ? If( __jsonParts as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardParts) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardParts.FromJson(__u) )) ))() : null : _part;} + {_metadata = If( json?.PropertyT("metadata"), out var __jsonMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Any.FromJson(__jsonMetadata) : _metadata;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens. + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new DashboardLens(json) : null; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardListResult.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardListResult.PowerShell.cs similarity index 71% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardListResult.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardListResult.PowerShell.cs index e780bf314942..a875d54c7844 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardListResult.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardListResult.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DashboardListResult partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -70,17 +78,17 @@ internal DashboardListResult(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResultInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -95,37 +103,37 @@ internal DashboardListResult(global::System.Management.Automation.PSObject conte // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResultInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DashboardListResult(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DashboardListResult(content); } @@ -135,12 +143,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The response of a Dashboard list operation. [System.ComponentModel.TypeConverter(typeof(DashboardListResultTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardListResult.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardListResult.TypeConverter.cs similarity index 96% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardListResult.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardListResult.TypeConverter.cs index 88dfde11c189..40db1275ed32 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardListResult.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardListResult.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResult ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResult).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardListResult.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardListResult.cs similarity index 73% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardListResult.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardListResult.cs index b403ce116ec3..5ebe4bf9d5d9 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardListResult.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardListResult.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// The response of a Dashboard list operation. public partial class DashboardListResult : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResult, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResultInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResultInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class DashboardListResult : public string NextLink { get => this._nextLink; set => this._nextLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard[] _value; + private System.Collections.Generic.List _value; /// The Dashboard items on this page [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard[] Value { get => this._value; set => this._value = value; } + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } /// Creates an new instance. public DashboardListResult() @@ -41,6 +41,9 @@ public partial interface IDashboardListResult : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The link to the next page of items", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -49,10 +52,13 @@ public partial interface IDashboardListResult : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = true, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The Dashboard items on this page", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard) })] + System.Collections.Generic.List Value { get; set; } } /// The response of a Dashboard list operation. @@ -62,7 +68,7 @@ internal partial interface IDashboardListResultInternal /// The link to the next page of items string NextLink { get; set; } /// The Dashboard items on this page - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardListResult.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardListResult.json.cs similarity index 89% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardListResult.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardListResult.json.cs index da5cb27b070c..affd308deb48 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardListResult.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardListResult.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -65,19 +65,19 @@ internal DashboardListResult(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.J { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Models.Api20221201Preview.IDashboard) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.Dashboard.FromJson(__u) )) ))() : null : Value;} - {_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.Portal.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Dashboard.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.Portal.Models.Api20221201Preview.IDashboardListResult. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResult. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new DashboardListResult(json) : null; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartMetadata.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartMetadata.PowerShell.cs similarity index 77% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartMetadata.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartMetadata.PowerShell.cs index adfd768ca033..afc1e9b265ae 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartMetadata.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartMetadata.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DashboardPartMetadata partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -70,13 +78,13 @@ internal DashboardPartMetadata(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal)this).Type, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -91,35 +99,33 @@ internal DashboardPartMetadata(global::System.Management.Automation.PSObject con // actually deserialize if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal)this).Type, global::System.Convert.ToString); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DashboardPartMetadata(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DashboardPartMetadata(content); } @@ -129,12 +135,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// A dashboard part metadata. [System.ComponentModel.TypeConverter(typeof(DashboardPartMetadataTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartMetadata.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartMetadata.TypeConverter.cs similarity index 96% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartMetadata.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartMetadata.TypeConverter.cs index a1de1bed74bb..6f0465265367 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartMetadata.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartMetadata.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartMetadata.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartMetadata.cs similarity index 83% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartMetadata.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartMetadata.cs index 22bd4a776da6..cf06ad6cdfd9 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartMetadata.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartMetadata.cs @@ -3,18 +3,18 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// A dashboard part metadata. public partial class DashboardPartMetadata : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal { /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal.Type { get => this._type; set { {_type = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal.Type { get => this._type; set { {_type = value;} } } /// Backing field for property. private string _type= @"Extension/HubsExtension/PartType/MarkdownPart"; @@ -37,6 +37,9 @@ public partial interface IDashboardPartMetadata : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = true, ReadOnly = true, + Read = true, + Create = true, + Update = true, Description = @"The dashboard part metadata type.", SerializedName = @"type", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartMetadata.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartMetadata.json.cs similarity index 92% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartMetadata.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartMetadata.json.cs index 2e90651a4e9b..e9cc5190f4f2 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartMetadata.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartMetadata.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -65,20 +65,20 @@ internal DashboardPartMetadata(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime { return; } - {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata. - /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata interface is polymorphic, - /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata interface is polymorphic, and the precise + /// model class that will get deserialized is determined at runtime based on the payload. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { if (!(node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json)) { diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardParts.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardParts.PowerShell.cs similarity index 58% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardParts.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardParts.PowerShell.cs index 79f79b2bf2c0..ef5a5122575b 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardParts.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardParts.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DashboardParts partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -70,41 +78,41 @@ internal DashboardParts(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Position")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).Position = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition) content.GetValueForProperty("Position",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).Position, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartsPositionTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).Position = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition) content.GetValueForProperty("Position",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).Position, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartsPositionTypeConverter.ConvertFrom); } if (content.Contains("Metadata")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartMetadataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartMetadataTypeConverter.ConvertFrom); } if (content.Contains("PositionX")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionX = (int) content.GetValueForProperty("PositionX",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionX, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionX = (int) content.GetValueForProperty("PositionX",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionX, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("PositionY")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionY = (int) content.GetValueForProperty("PositionY",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionY, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionY = (int) content.GetValueForProperty("PositionY",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionY, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("PositionRowSpan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionRowSpan = (int) content.GetValueForProperty("PositionRowSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionRowSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionRowSpan = (int) content.GetValueForProperty("PositionRowSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionRowSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("PositionColSpan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionColSpan = (int) content.GetValueForProperty("PositionColSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionColSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionColSpan = (int) content.GetValueForProperty("PositionColSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionColSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("PositionMetadata")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionMetadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("PositionMetadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionMetadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionMetadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("PositionMetadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionMetadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); } if (content.Contains("MetadataType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).MetadataType = (string) content.GetValueForProperty("MetadataType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).MetadataType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).MetadataType = (string) content.GetValueForProperty("MetadataType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).MetadataType, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -119,61 +127,61 @@ internal DashboardParts(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Position")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).Position = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition) content.GetValueForProperty("Position",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).Position, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartsPositionTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).Position = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition) content.GetValueForProperty("Position",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).Position, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartsPositionTypeConverter.ConvertFrom); } if (content.Contains("Metadata")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartMetadataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartMetadataTypeConverter.ConvertFrom); } if (content.Contains("PositionX")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionX = (int) content.GetValueForProperty("PositionX",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionX, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionX = (int) content.GetValueForProperty("PositionX",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionX, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("PositionY")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionY = (int) content.GetValueForProperty("PositionY",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionY, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionY = (int) content.GetValueForProperty("PositionY",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionY, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("PositionRowSpan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionRowSpan = (int) content.GetValueForProperty("PositionRowSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionRowSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionRowSpan = (int) content.GetValueForProperty("PositionRowSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionRowSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("PositionColSpan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionColSpan = (int) content.GetValueForProperty("PositionColSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionColSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionColSpan = (int) content.GetValueForProperty("PositionColSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionColSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("PositionMetadata")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionMetadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("PositionMetadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).PositionMetadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionMetadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("PositionMetadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).PositionMetadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); } if (content.Contains("MetadataType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).MetadataType = (string) content.GetValueForProperty("MetadataType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal)this).MetadataType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).MetadataType = (string) content.GetValueForProperty("MetadataType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal)this).MetadataType, global::System.Convert.ToString); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardParts DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DashboardParts(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardParts DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DashboardParts(content); } @@ -183,12 +191,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardParts FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// A dashboard part. [System.ComponentModel.TypeConverter(typeof(DashboardPartsTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardParts.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardParts.TypeConverter.cs similarity index 97% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardParts.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardParts.TypeConverter.cs index 75b82c7a6c0a..b62719f0622d 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardParts.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardParts.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardParts ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardParts).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardParts.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardParts.cs similarity index 65% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardParts.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardParts.cs index c0ed934132ae..5713be78b204 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardParts.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardParts.cs @@ -3,62 +3,62 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// A dashboard part. public partial class DashboardParts : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardParts, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata _metadata; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata _metadata; /// The dashboard part's metadata. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata Metadata { get => (this._metadata = this._metadata ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartMetadata()); set => this._metadata = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata Metadata { get => (this._metadata = this._metadata ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartMetadata()); set => this._metadata = value; } /// The dashboard part metadata type. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string MetadataType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal)Metadata).Type; } + public string MetadataType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal)Metadata).Type; } /// Internal Acessors for Metadata - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal.Metadata { get => (this._metadata = this._metadata ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartMetadata()); set { {_metadata = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal.Metadata { get => (this._metadata = this._metadata ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartMetadata()); set { {_metadata = value;} } } /// Internal Acessors for MetadataType - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal.MetadataType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal)Metadata).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal)Metadata).Type = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal.MetadataType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal)Metadata).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal)Metadata).Type = value; } /// Internal Acessors for Position - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsInternal.Position { get => (this._position = this._position ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartsPosition()); set { {_position = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsInternal.Position { get => (this._position = this._position ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartsPosition()); set { {_position = value;} } } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition _position; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition _position; /// The dashboard's part position. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition Position { get => (this._position = this._position ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartsPosition()); set => this._position = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition Position { get => (this._position = this._position ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartsPosition()); set => this._position = value; } /// The dashboard's part column span. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public int PositionColSpan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)Position).ColSpan; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)Position).ColSpan = value ; } + public int PositionColSpan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)Position).ColSpan; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)Position).ColSpan = value ; } /// The dashboard part's metadata. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny PositionMetadata { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)Position).Metadata; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)Position).Metadata = value ?? null /* model class */; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny PositionMetadata { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)Position).Metadata; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)Position).Metadata = value ?? null /* model class */; } /// The dashboard's part row span. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public int PositionRowSpan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)Position).RowSpan; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)Position).RowSpan = value ; } + public int PositionRowSpan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)Position).RowSpan; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)Position).RowSpan = value ; } /// The dashboard's part x coordinate. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public int PositionX { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)Position).X; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)Position).X = value ; } + public int PositionX { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)Position).X; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)Position).X = value ; } /// The dashboard's part y coordinate. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public int PositionY { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)Position).Y; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)Position).Y = value ; } + public int PositionY { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)Position).Y; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)Position).Y = value ; } /// Creates an new instance. public DashboardParts() @@ -74,6 +74,9 @@ public partial interface IDashboardParts : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = true, + Update = true, Description = @"The dashboard part metadata type.", SerializedName = @"type", PossibleTypes = new [] { typeof(string) })] @@ -82,6 +85,9 @@ public partial interface IDashboardParts : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = true, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard's part column span.", SerializedName = @"colSpan", PossibleTypes = new [] { typeof(int) })] @@ -90,6 +96,9 @@ public partial interface IDashboardParts : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard part's metadata.", SerializedName = @"metadata", PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) })] @@ -98,6 +107,9 @@ public partial interface IDashboardParts : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = true, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard's part row span.", SerializedName = @"rowSpan", PossibleTypes = new [] { typeof(int) })] @@ -106,6 +118,9 @@ public partial interface IDashboardParts : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = true, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard's part x coordinate.", SerializedName = @"x", PossibleTypes = new [] { typeof(int) })] @@ -114,6 +129,9 @@ public partial interface IDashboardParts : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = true, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard's part y coordinate.", SerializedName = @"y", PossibleTypes = new [] { typeof(int) })] @@ -125,11 +143,11 @@ internal partial interface IDashboardPartsInternal { /// The dashboard part's metadata. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata Metadata { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata Metadata { get; set; } /// The dashboard part metadata type. string MetadataType { get; set; } /// The dashboard's part position. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition Position { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition Position { get; set; } /// The dashboard's part column span. int PositionColSpan { get; set; } /// The dashboard part's metadata. diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardParts.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardParts.json.cs similarity index 93% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardParts.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardParts.json.cs index 3927eecc4262..2d9389cb3264 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardParts.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardParts.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -65,19 +65,19 @@ internal DashboardParts(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.J { return; } - {_position = If( json?.PropertyT("position"), out var __jsonPosition) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartsPosition.FromJson(__jsonPosition) : Position;} - {_metadata = If( json?.PropertyT("metadata"), out var __jsonMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartMetadata.FromJson(__jsonMetadata) : Metadata;} + {_position = If( json?.PropertyT("position"), out var __jsonPosition) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartsPosition.FromJson(__jsonPosition) : _position;} + {_metadata = If( json?.PropertyT("metadata"), out var __jsonMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartMetadata.FromJson(__jsonMetadata) : _metadata;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardParts. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardParts. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardParts FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardParts FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new DashboardParts(json) : null; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartsPosition.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartsPosition.PowerShell.cs similarity index 65% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartsPosition.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartsPosition.PowerShell.cs index 3b2be0738f3b..74fd4011d3f8 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartsPosition.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartsPosition.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DashboardPartsPosition partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -70,29 +78,29 @@ internal DashboardPartsPosition(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("X")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).X = (int) content.GetValueForProperty("X",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).X, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).X = (int) content.GetValueForProperty("X",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).X, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("Y")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).Y = (int) content.GetValueForProperty("Y",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).Y, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).Y = (int) content.GetValueForProperty("Y",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).Y, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("RowSpan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).RowSpan = (int) content.GetValueForProperty("RowSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).RowSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).RowSpan = (int) content.GetValueForProperty("RowSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).RowSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("ColSpan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).ColSpan = (int) content.GetValueForProperty("ColSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).ColSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).ColSpan = (int) content.GetValueForProperty("ColSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).ColSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("Metadata")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -107,51 +115,49 @@ internal DashboardPartsPosition(global::System.Management.Automation.PSObject co // actually deserialize if (content.Contains("X")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).X = (int) content.GetValueForProperty("X",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).X, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).X = (int) content.GetValueForProperty("X",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).X, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("Y")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).Y = (int) content.GetValueForProperty("Y",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).Y, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).Y = (int) content.GetValueForProperty("Y",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).Y, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("RowSpan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).RowSpan = (int) content.GetValueForProperty("RowSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).RowSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).RowSpan = (int) content.GetValueForProperty("RowSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).RowSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("ColSpan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).ColSpan = (int) content.GetValueForProperty("ColSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).ColSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).ColSpan = (int) content.GetValueForProperty("ColSpan",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).ColSpan, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("Metadata")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DashboardPartsPosition(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DashboardPartsPosition(content); } @@ -161,12 +167,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The dashboard's part position. [System.ComponentModel.TypeConverter(typeof(DashboardPartsPositionTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartsPosition.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartsPosition.TypeConverter.cs similarity index 96% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartsPosition.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartsPosition.TypeConverter.cs index ac20e80af3d9..a5774ddedbc0 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartsPosition.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartsPosition.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartsPosition.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartsPosition.cs similarity index 90% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartsPosition.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartsPosition.cs index 2318aacab460..8e8cb1ad6b62 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartsPosition.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartsPosition.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// The dashboard's part position. public partial class DashboardPartsPosition : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPositionInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPositionInternal { /// Backing field for property. @@ -62,6 +62,9 @@ public partial interface IDashboardPartsPosition : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = true, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard's part column span.", SerializedName = @"colSpan", PossibleTypes = new [] { typeof(int) })] @@ -70,6 +73,9 @@ public partial interface IDashboardPartsPosition : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard part's metadata.", SerializedName = @"metadata", PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) })] @@ -78,6 +84,9 @@ public partial interface IDashboardPartsPosition : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = true, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard's part row span.", SerializedName = @"rowSpan", PossibleTypes = new [] { typeof(int) })] @@ -86,6 +95,9 @@ public partial interface IDashboardPartsPosition : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = true, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard's part x coordinate.", SerializedName = @"x", PossibleTypes = new [] { typeof(int) })] @@ -94,6 +106,9 @@ public partial interface IDashboardPartsPosition : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = true, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard's part y coordinate.", SerializedName = @"y", PossibleTypes = new [] { typeof(int) })] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartsPosition.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartsPosition.json.cs similarity index 93% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartsPosition.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartsPosition.json.cs index 1b30333448a7..27aa1d5eed2c 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPartsPosition.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPartsPosition.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -65,22 +65,22 @@ internal DashboardPartsPosition(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtim { return; } - {_x = If( json?.PropertyT("x"), out var __jsonX) ? (int)__jsonX : X;} - {_y = If( json?.PropertyT("y"), out var __jsonY) ? (int)__jsonY : Y;} - {_rowSpan = If( json?.PropertyT("rowSpan"), out var __jsonRowSpan) ? (int)__jsonRowSpan : RowSpan;} - {_colSpan = If( json?.PropertyT("colSpan"), out var __jsonColSpan) ? (int)__jsonColSpan : ColSpan;} - {_metadata = If( json?.PropertyT("metadata"), out var __jsonMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Any.FromJson(__jsonMetadata) : Metadata;} + {_x = If( json?.PropertyT("x"), out var __jsonX) ? (int)__jsonX : _x;} + {_y = If( json?.PropertyT("y"), out var __jsonY) ? (int)__jsonY : _y;} + {_rowSpan = If( json?.PropertyT("rowSpan"), out var __jsonRowSpan) ? (int)__jsonRowSpan : _rowSpan;} + {_colSpan = If( json?.PropertyT("colSpan"), out var __jsonColSpan) ? (int)__jsonColSpan : _colSpan;} + {_metadata = If( json?.PropertyT("metadata"), out var __jsonMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Any.FromJson(__jsonMetadata) : _metadata;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartsPosition FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartsPosition FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new DashboardPartsPosition(json) : null; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardProperties.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardProperties.PowerShell.cs similarity index 69% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardProperties.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardProperties.PowerShell.cs index 9941e6e1098e..d0d3113d1e17 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardProperties.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardProperties.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DashboardProperties partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -70,17 +78,17 @@ internal DashboardProperties(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Lens")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesInternal)this).Lens = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[]) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesInternal)this).Lens, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardLensTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesInternal)this).Lens = (System.Collections.Generic.List) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesInternal)this).Lens, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardLensTypeConverter.ConvertFrom)); } if (content.Contains("Metadata")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesMetadataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesMetadataTypeConverter.ConvertFrom); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -95,37 +103,37 @@ internal DashboardProperties(global::System.Management.Automation.PSObject conte // actually deserialize if (content.Contains("Lens")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesInternal)this).Lens = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[]) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesInternal)this).Lens, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardLensTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesInternal)this).Lens = (System.Collections.Generic.List) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesInternal)this).Lens, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardLensTypeConverter.ConvertFrom)); } if (content.Contains("Metadata")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesMetadataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesMetadataTypeConverter.ConvertFrom); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DashboardProperties(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DashboardProperties(content); } @@ -135,12 +143,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The shared dashboard properties. [System.ComponentModel.TypeConverter(typeof(DashboardPropertiesTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardProperties.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardProperties.TypeConverter.cs similarity index 96% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardProperties.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardProperties.TypeConverter.cs index 7214b1617d4e..3965ecfb8137 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardProperties.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardProperties.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardProperties.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardProperties.cs similarity index 61% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardProperties.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardProperties.cs index 391721c8c7be..1ba6048a6045 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardProperties.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardProperties.cs @@ -3,29 +3,29 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// The shared dashboard properties. public partial class DashboardProperties : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] _lens; + private System.Collections.Generic.List _lens; /// The dashboard lenses. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get => this._lens; set => this._lens = value; } + public System.Collections.Generic.List Lens { get => this._lens; set => this._lens = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata _metadata; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata _metadata; /// The dashboard metadata. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata Metadata { get => (this._metadata = this._metadata ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesMetadata()); set => this._metadata = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata Metadata { get => (this._metadata = this._metadata ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesMetadata()); set => this._metadata = value; } /// Creates an new instance. public DashboardProperties() @@ -41,18 +41,24 @@ public partial interface IDashboardProperties : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard lenses.", SerializedName = @"lenses", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens) })] + System.Collections.Generic.List Lens { get; set; } /// The dashboard metadata. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard metadata.", SerializedName = @"metadata", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata Metadata { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata) })] + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata Metadata { get; set; } } /// The shared dashboard properties. @@ -60,9 +66,9 @@ internal partial interface IDashboardPropertiesInternal { /// The dashboard lenses. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get; set; } + System.Collections.Generic.List Lens { get; set; } /// The dashboard metadata. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata Metadata { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata Metadata { get; set; } } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardProperties.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardProperties.json.cs similarity index 89% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardProperties.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardProperties.json.cs index fc2192d24381..58f3982edf9a 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardProperties.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardProperties.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -65,19 +65,19 @@ internal DashboardProperties(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.J { return; } - {_lens = If( json?.PropertyT("lenses"), out var __jsonLenses) ? If( __jsonLenses as Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Models.Api20221201Preview.IDashboardLens) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardLens.FromJson(__u) )) ))() : null : Lens;} - {_metadata = If( json?.PropertyT("metadata"), out var __jsonMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesMetadata.FromJson(__jsonMetadata) : Metadata;} + {_lens = If( json?.PropertyT("lenses"), out var __jsonLenses) ? If( __jsonLenses as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardLens.FromJson(__u) )) ))() : null : _lens;} + {_metadata = If( json?.PropertyT("metadata"), out var __jsonMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesMetadata.FromJson(__jsonMetadata) : _metadata;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new DashboardProperties(json) : null; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.PowerShell.cs similarity index 81% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.PowerShell.cs index ce7d09ad030f..952c6dd2f500 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DashboardPropertiesMetadata partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -74,7 +82,7 @@ internal DashboardPropertiesMetadata(global::System.Collections.IDictionary cont } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -93,29 +101,27 @@ internal DashboardPropertiesMetadata(global::System.Management.Automation.PSObje } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DashboardPropertiesMetadata(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DashboardPropertiesMetadata(content); } @@ -125,12 +131,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The dashboard metadata. [System.ComponentModel.TypeConverter(typeof(DashboardPropertiesMetadataTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.TypeConverter.cs similarity index 96% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.TypeConverter.cs index 152cd74a570b..d4cb4e9e33ef 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.cs similarity index 78% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.cs index cf35f5d24cc5..c194dbbc08f5 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// The dashboard metadata. public partial class DashboardPropertiesMetadata : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadataInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadataInternal { /// Creates an new instance. diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.dictionary.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.dictionary.cs similarity index 95% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.dictionary.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.dictionary.cs index 170a581c26ad..923bf03ffd5d 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.dictionary.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.dictionary.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -70,6 +70,6 @@ public void CopyFrom(global::System.Management.Automation.PSObject source) /// - public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesMetadata source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesMetadata source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.json.cs similarity index 94% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.json.cs index d3cd7f4844cb..b5bc474ef962 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesMetadata.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesMetadata.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -71,13 +71,13 @@ internal DashboardPropertiesMetadata(Microsoft.Azure.PowerShell.Cmdlets.Portal.R } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new DashboardPropertiesMetadata(json) : null; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningState.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningState.PowerShell.cs similarity index 64% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningState.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningState.PowerShell.cs index 3d184a060ac2..e1af40a88133 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningState.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningState.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DashboardPropertiesWithProvisioningState partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -70,21 +78,21 @@ internal DashboardPropertiesWithProvisioningState(global::System.Collections.IDi // actually deserialize if (content.Contains("Lens")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)this).Lens = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[]) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)this).Lens, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardLensTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)this).Lens = (System.Collections.Generic.List) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)this).Lens, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardLensTypeConverter.ConvertFrom)); } if (content.Contains("Metadata")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesWithProvisioningStateMetadataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesWithProvisioningStateMetadataTypeConverter.ConvertFrom); } if (content.Contains("ProvisioningState")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)this).ProvisioningState, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -99,43 +107,43 @@ internal DashboardPropertiesWithProvisioningState(global::System.Management.Auto // actually deserialize if (content.Contains("Lens")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)this).Lens = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[]) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)this).Lens, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardLensTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)this).Lens = (System.Collections.Generic.List) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)this).Lens, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardLensTypeConverter.ConvertFrom)); } if (content.Contains("Metadata")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesWithProvisioningStateMetadataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesWithProvisioningStateMetadataTypeConverter.ConvertFrom); } if (content.Contains("ProvisioningState")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal)this).ProvisioningState, global::System.Convert.ToString); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DashboardPropertiesWithProvisioningState(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DashboardPropertiesWithProvisioningState(content); } @@ -148,12 +156,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// an instance of the model class. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Dashboard Properties with Provisioning state [System.ComponentModel.TypeConverter(typeof(DashboardPropertiesWithProvisioningStateTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningState.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningState.TypeConverter.cs similarity index 96% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningState.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningState.TypeConverter.cs index 203333c15690..826370bc3cf1 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningState.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningState.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -110,14 +110,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningState.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningState.cs similarity index 55% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningState.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningState.cs index 14111073c7bc..c99f1bc48686 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningState.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningState.cs @@ -3,39 +3,39 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// Dashboard Properties with Provisioning state public partial class DashboardPropertiesWithProvisioningState : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] _lens; + private System.Collections.Generic.List _lens; /// The dashboard lenses. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get => this._lens; set => this._lens = value; } + public System.Collections.Generic.List Lens { get => this._lens; set => this._lens = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata _metadata; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata _metadata; /// The dashboard metadata. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get => (this._metadata = this._metadata ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesWithProvisioningStateMetadata()); set => this._metadata = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get => (this._metadata = this._metadata ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesWithProvisioningStateMetadata()); set => this._metadata = value; } /// Internal Acessors for ProvisioningState - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState? _provisioningState; + private string _provisioningState; /// The status of the last operation. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState? ProvisioningState { get => this._provisioningState; } + public string ProvisioningState { get => this._provisioningState; } /// /// Creates an new instance. @@ -53,26 +53,36 @@ public partial interface IDashboardPropertiesWithProvisioningState : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard lenses.", SerializedName = @"lenses", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens) })] + System.Collections.Generic.List Lens { get; set; } /// The dashboard metadata. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard metadata.", SerializedName = @"metadata", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata) })] + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get; set; } /// The status of the last operation. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The status of the last operation.", SerializedName = @"provisioningState", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState? ProvisioningState { get; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled")] + string ProvisioningState { get; } } /// Dashboard Properties with Provisioning state @@ -80,11 +90,12 @@ internal partial interface IDashboardPropertiesWithProvisioningStateInternal { /// The dashboard lenses. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get; set; } + System.Collections.Generic.List Lens { get; set; } /// The dashboard metadata. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get; set; } /// The status of the last operation. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState? ProvisioningState { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("Succeeded", "Failed", "Canceled")] + string ProvisioningState { get; set; } } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningState.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningState.json.cs similarity index 88% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningState.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningState.json.cs index ad5bcc91d580..907a09785eb6 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningState.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningState.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -65,20 +65,20 @@ internal DashboardPropertiesWithProvisioningState(Microsoft.Azure.PowerShell.Cmd { return; } - {_lens = If( json?.PropertyT("lenses"), out var __jsonLenses) ? If( __jsonLenses as Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Models.Api20221201Preview.IDashboardLens) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardLens.FromJson(__u) )) ))() : null : Lens;} - {_metadata = If( json?.PropertyT("metadata"), out var __jsonMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesWithProvisioningStateMetadata.FromJson(__jsonMetadata) : Metadata;} - {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_lens = If( json?.PropertyT("lenses"), out var __jsonLenses) ? If( __jsonLenses as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardLens.FromJson(__u) )) ))() : null : _lens;} + {_metadata = If( json?.PropertyT("metadata"), out var __jsonMetadata) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesWithProvisioningStateMetadata.FromJson(__jsonMetadata) : _metadata;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningState FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningState FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new DashboardPropertiesWithProvisioningState(json) : null; } @@ -114,7 +114,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode ToJson(Mi container.Add("lenses",__w); } AddIf( null != this._metadata ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) this._metadata.ToJson(null,serializationMode) : null, "metadata" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.PowerShell.cs similarity index 80% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.PowerShell.cs index 3aa87c24ff86..cc82dba5f7cc 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,7 +55,15 @@ public partial class DashboardPropertiesWithProvisioningStateMetadata partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -74,7 +82,7 @@ internal DashboardPropertiesWithProvisioningStateMetadata(global::System.Collect } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -93,29 +101,29 @@ internal DashboardPropertiesWithProvisioningStateMetadata(global::System.Managem } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new DashboardPropertiesWithProvisioningStateMetadata(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new DashboardPropertiesWithProvisioningStateMetadata(content); } @@ -128,12 +136,24 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// an instance of the model class. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The dashboard metadata. [System.ComponentModel.TypeConverter(typeof(DashboardPropertiesWithProvisioningStateMetadataTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.TypeConverter.cs similarity index 96% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.TypeConverter.cs index 209e93560e8e..4be7e6a3bcf6 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -112,14 +112,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// an instance of , or null if there is no suitable /// conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.cs similarity index 77% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.cs index c38fea0f9a9f..6ad2bea1d49a 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// The dashboard metadata. public partial class DashboardPropertiesWithProvisioningStateMetadata : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadataInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadataInternal { /// diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.dictionary.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.dictionary.cs similarity index 94% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.dictionary.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.dictionary.cs index 1cb25191a5c0..67d45016fb0c 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.dictionary.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.dictionary.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -70,6 +70,6 @@ public void CopyFrom(global::System.Management.Automation.PSObject source) /// - public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesWithProvisioningStateMetadata source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesWithProvisioningStateMetadata source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.json.cs similarity index 94% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.json.cs index 61faea0da633..71746a6ba09c 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/DashboardPropertiesWithProvisioningStateMetadata.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/DashboardPropertiesWithProvisioningStateMetadata.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -72,13 +72,13 @@ internal DashboardPropertiesWithProvisioningStateMetadata(Microsoft.Azure.PowerS } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new DashboardPropertiesWithProvisioningStateMetadata(json) : null; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorAdditionalInfo.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs similarity index 73% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorAdditionalInfo.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs index c57f994fe336..323186b6185b 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorAdditionalInfo.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorAdditionalInfo.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,33 +55,41 @@ public partial class ErrorAdditionalInfo partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ErrorAdditionalInfo(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ErrorAdditionalInfo(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -96,17 +104,17 @@ internal ErrorAdditionalInfo(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Info")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -121,11 +129,11 @@ internal ErrorAdditionalInfo(global::System.Management.Automation.PSObject conte // actually deserialize if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("Info")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom); } AfterDeserializePSObject(content); } @@ -135,12 +143,24 @@ internal ErrorAdditionalInfo(global::System.Management.Automation.PSObject conte /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The resource management error additional info. [System.ComponentModel.TypeConverter(typeof(ErrorAdditionalInfoTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorAdditionalInfo.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs similarity index 97% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorAdditionalInfo.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs index d6165eb922cc..290895cf9c24 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorAdditionalInfo.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorAdditionalInfo.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfo ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfo).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorAdditionalInfo.cs b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorAdditionalInfo.cs similarity index 82% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorAdditionalInfo.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/ErrorAdditionalInfo.cs index 8317df6d4136..3ddff680c5ec 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorAdditionalInfo.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorAdditionalInfo.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// The resource management error additional info. public partial class ErrorAdditionalInfo : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfoInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfo, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfoInternal { /// Backing field for property. @@ -21,10 +21,10 @@ public partial class ErrorAdditionalInfo : public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Any()); } /// Internal Acessors for Info - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfoInternal.Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Any()); set { {_info = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfoInternal.Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Any()); set { {_info = value;} } } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfoInternal.Type { get => this._type; set { {_type = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfoInternal.Type { get => this._type; set { {_type = value;} } } /// Backing field for property. private string _type; @@ -47,6 +47,9 @@ public partial interface IErrorAdditionalInfo : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The additional info.", SerializedName = @"info", PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) })] @@ -55,6 +58,9 @@ public partial interface IErrorAdditionalInfo : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The additional info type.", SerializedName = @"type", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorAdditionalInfo.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs similarity index 93% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorAdditionalInfo.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs index d15d5eb7b002..29334f127b84 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorAdditionalInfo.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorAdditionalInfo.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -65,19 +65,19 @@ internal ErrorAdditionalInfo(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.J { 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.Portal.Models.Any.FromJson(__jsonInfo) : Info;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + {_info = If( json?.PropertyT("info"), out var __jsonInfo) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Any.FromJson(__jsonInfo) : _info;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfo. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfo. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new ErrorAdditionalInfo(json) : null; } @@ -101,11 +101,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode ToJson(Mi { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._info ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) this._info.ToJson(null,serializationMode) : null, "info" ,container.Add ); } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorDetail.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorDetail.PowerShell.cs similarity index 63% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorDetail.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/ErrorDetail.PowerShell.cs index 3cc8e55ab785..9c8d53908e86 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorDetail.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorDetail.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,33 +55,41 @@ public partial class ErrorDetail partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ErrorDetail(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ErrorDetail(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -96,29 +104,29 @@ internal ErrorDetail(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("Target")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Target, global::System.Convert.ToString); } if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorDetailTypeConverter.ConvertFrom)); } if (content.Contains("AdditionalInfo")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -133,23 +141,23 @@ internal ErrorDetail(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("Target")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Target, global::System.Convert.ToString); } if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorDetailTypeConverter.ConvertFrom)); } if (content.Contains("AdditionalInfo")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -159,12 +167,24 @@ internal ErrorDetail(global::System.Management.Automation.PSObject content) /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The error detail. [System.ComponentModel.TypeConverter(typeof(ErrorDetailTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorDetail.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorDetail.TypeConverter.cs similarity index 97% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorDetail.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/ErrorDetail.TypeConverter.cs index 45d9d33e0878..193ecf2ad872 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorDetail.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorDetail.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorDetail.cs b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorDetail.cs similarity index 66% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorDetail.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/ErrorDetail.cs index 2a4f4b9e20a3..36e72625fa71 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorDetail.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorDetail.cs @@ -3,22 +3,22 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// The error detail. public partial class ErrorDetail : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo[] _additionalInfo; + private System.Collections.Generic.List _additionalInfo; /// The error additional info. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo[] AdditionalInfo { get => this._additionalInfo; } + public System.Collections.Generic.List AdditionalInfo { get => this._additionalInfo; } /// Backing field for property. private string _code; @@ -28,11 +28,11 @@ public partial class ErrorDetail : public string Code { get => this._code; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail[] _detail; + private System.Collections.Generic.List _detail; /// The error details. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail[] Detail { get => this._detail; } + public System.Collections.Generic.List Detail { get => this._detail; } /// Backing field for property. private string _message; @@ -42,19 +42,19 @@ public partial class ErrorDetail : public string Message { get => this._message; } /// Internal Acessors for AdditionalInfo - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo[] Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal.AdditionalInfo { get => this._additionalInfo; set { {_additionalInfo = value;} } } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal.AdditionalInfo { get => this._additionalInfo; set { {_additionalInfo = value;} } } /// Internal Acessors for Code - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal.Code { get => this._code; set { {_code = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal.Code { get => this._code; set { {_code = value;} } } /// Internal Acessors for Detail - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail[] Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal.Detail { get => this._detail; set { {_detail = value;} } } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal.Detail { get => this._detail; set { {_detail = value;} } } /// Internal Acessors for Message - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal.Message { get => this._message; set { {_message = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal.Message { get => this._message; set { {_message = value;} } } /// Internal Acessors for Target - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal.Target { get => this._target; set { {_target = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal.Target { get => this._target; set { {_target = value;} } } /// Backing field for property. private string _target; @@ -77,14 +77,20 @@ public partial interface IErrorDetail : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error additional info.", SerializedName = @"additionalInfo", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo[] AdditionalInfo { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } /// The error code. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error code.", SerializedName = @"code", PossibleTypes = new [] { typeof(string) })] @@ -93,14 +99,20 @@ public partial interface IErrorDetail : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error details.", SerializedName = @"details", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail[] Detail { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail) })] + System.Collections.Generic.List Detail { get; } /// The error message. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error message.", SerializedName = @"message", PossibleTypes = new [] { typeof(string) })] @@ -109,6 +121,9 @@ public partial interface IErrorDetail : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error target.", SerializedName = @"target", PossibleTypes = new [] { typeof(string) })] @@ -120,11 +135,11 @@ internal partial interface IErrorDetailInternal { /// The error additional info. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo[] AdditionalInfo { get; set; } + System.Collections.Generic.List AdditionalInfo { get; set; } /// The error code. string Code { get; set; } /// The error details. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail[] Detail { get; set; } + System.Collections.Generic.List Detail { get; set; } /// The error message. string Message { get; set; } /// The error target. diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorDetail.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorDetail.json.cs similarity index 84% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorDetail.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/ErrorDetail.json.cs index e0eeb0ff486f..0e1e6d10d4d3 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorDetail.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorDetail.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -65,22 +65,20 @@ internal ErrorDetail(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.Json { 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.Portal.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.Portal.Models.Api50.IErrorDetail) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorDetail.FromJson(__u) )) ))() : null : Detail;} - {_additionalInfo = If( json?.PropertyT("additionalInfo"), out var __jsonAdditionalInfo) ? If( __jsonAdditionalInfo as Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Models.Api50.IErrorAdditionalInfo) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorAdditionalInfo.FromJson(__p) )) ))() : null : AdditionalInfo;} + {_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.Portal.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorDetail.FromJson(__u) )) ))() : null : _detail;} + {_additionalInfo = If( json?.PropertyT("additionalInfo"), out var __jsonAdditionalInfo) ? If( __jsonAdditionalInfo as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfo) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorAdditionalInfo.FromJson(__p) )) ))() : null : _additionalInfo;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail. + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new ErrorDetail(json) : null; } @@ -104,19 +102,19 @@ public Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode ToJson(Mi { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { if (null != this._detail) { @@ -128,7 +126,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode ToJson(Mi container.Add("details",__w); } } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { if (null != this._additionalInfo) { diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorResponse.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs similarity index 61% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorResponse.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs index 0c676ac4114e..f08e6b05b3ca 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorResponse.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -58,33 +58,41 @@ public partial class ErrorResponse partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ErrorResponse(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ErrorResponse(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -99,33 +107,33 @@ internal ErrorResponse(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Error")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorDetailTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorDetailTypeConverter.ConvertFrom); } if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("Target")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Target, global::System.Convert.ToString); } if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorDetailTypeConverter.ConvertFrom)); } if (content.Contains("AdditionalInfo")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -140,27 +148,27 @@ internal ErrorResponse(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Error")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorDetailTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorDetailTypeConverter.ConvertFrom); } if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Message, global::System.Convert.ToString); } if (content.Contains("Target")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Target, global::System.Convert.ToString); } if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorDetailTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorDetailTypeConverter.ConvertFrom)); } if (content.Contains("AdditionalInfo")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).AdditionalInfo = (System.Collections.Generic.List) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorAdditionalInfoTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -170,12 +178,24 @@ internal ErrorResponse(global::System.Management.Automation.PSObject content) /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows /// the OData error response format.). diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorResponse.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs similarity index 97% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorResponse.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs index e5103f198e8a..5fee3447530b 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorResponse.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponse ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponse ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponse).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponse).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorResponse.cs b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorResponse.cs similarity index 58% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorResponse.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/ErrorResponse.cs index 61fcd5e19666..9ff0f08ce371 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorResponse.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorResponse.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -12,54 +12,54 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 /// the OData error response format.). /// public partial class ErrorResponse : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponse, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponse, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal { /// The error additional info. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo[] AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).AdditionalInfo; } + public System.Collections.Generic.List AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).AdditionalInfo; } /// The error code. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).Code; } + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).Code; } /// The error details. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail[] Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).Detail; } + public System.Collections.Generic.List Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).Detail; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail _error; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail _error; /// The error object. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorDetail()); set => this._error = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorDetail()); set => this._error = value; } /// The error message. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).Message; } + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).Message; } /// Internal Acessors for AdditionalInfo - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo[] Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).AdditionalInfo = value; } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).AdditionalInfo = value; } /// Internal Acessors for Code - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).Code = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).Code = value; } /// Internal Acessors for Detail - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail[] Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).Detail = value; } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).Detail = value; } /// Internal Acessors for Error - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorDetail()); set { {_error = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorDetail()); set { {_error = value;} } } /// Internal Acessors for Message - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).Message = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).Message = value; } /// Internal Acessors for Target - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).Target = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).Target = value; } /// The error target. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetailInternal)Error).Target; } + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetailInternal)Error).Target; } /// Creates an new instance. public ErrorResponse() @@ -76,14 +76,20 @@ public partial interface IErrorResponse : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error additional info.", SerializedName = @"additionalInfo", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo[] AdditionalInfo { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorAdditionalInfo) })] + System.Collections.Generic.List AdditionalInfo { get; } /// The error code. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error code.", SerializedName = @"code", PossibleTypes = new [] { typeof(string) })] @@ -92,14 +98,20 @@ public partial interface IErrorResponse : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error details.", SerializedName = @"details", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail[] Detail { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail) })] + System.Collections.Generic.List Detail { get; } /// The error message. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error message.", SerializedName = @"message", PossibleTypes = new [] { typeof(string) })] @@ -108,6 +120,9 @@ public partial interface IErrorResponse : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The error target.", SerializedName = @"target", PossibleTypes = new [] { typeof(string) })] @@ -120,13 +135,13 @@ internal partial interface IErrorResponseInternal { /// The error additional info. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorAdditionalInfo[] AdditionalInfo { get; set; } + System.Collections.Generic.List AdditionalInfo { get; set; } /// The error code. string Code { get; set; } /// The error details. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail[] Detail { get; set; } + System.Collections.Generic.List Detail { get; set; } /// The error object. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorDetail Error { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorDetail Error { get; set; } /// The error message. string Message { get; set; } /// The error target. diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorResponse.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorResponse.json.cs similarity index 92% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorResponse.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/ErrorResponse.json.cs index 2e79c2b78b86..eef4274b248a 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/ErrorResponse.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/ErrorResponse.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -68,18 +68,16 @@ internal ErrorResponse(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.Js { return; } - {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorDetail.FromJson(__jsonError) : Error;} + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorDetail.FromJson(__jsonError) : _error;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponse. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponse. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponse. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IErrorResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponse. + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IErrorResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new ErrorResponse(json) : null; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadata.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadata.PowerShell.cs similarity index 53% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadata.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadata.PowerShell.cs index 305291e948f4..ec1421aef5a8 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadata.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadata.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class MarkdownPartMetadata partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadata DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadata DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new MarkdownPartMetadata(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadata DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadata DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new MarkdownPartMetadata(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadata FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadata FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,49 +111,49 @@ internal MarkdownPartMetadata(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Setting")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsTypeConverter.ConvertFrom); } if (content.Contains("Input")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).Input = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny[]) content.GetValueForProperty("Input",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).Input, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).Input = (System.Collections.Generic.List) content.GetValueForProperty("Input",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).Input, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom)); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("SettingsContent")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingsContent = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent) content.GetValueForProperty("SettingsContent",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingsContent, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingsContent = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent) content.GetValueForProperty("SettingsContent",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingsContent, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentTypeConverter.ConvertFrom); } if (content.Contains("Content")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).Content = (string) content.GetValueForProperty("Content",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).Content, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).Content = (string) content.GetValueForProperty("Content",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).Content, global::System.Convert.ToString); } if (content.Contains("ContentSetting")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).ContentSetting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings) content.GetValueForProperty("ContentSetting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).ContentSetting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentSettingsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).ContentSetting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings) content.GetValueForProperty("ContentSetting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).ContentSetting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentSettingsTypeConverter.ConvertFrom); } if (content.Contains("SettingTitle")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingTitle = (string) content.GetValueForProperty("SettingTitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingTitle, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingTitle = (string) content.GetValueForProperty("SettingTitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingTitle, global::System.Convert.ToString); } if (content.Contains("SettingSubtitle")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingSubtitle = (string) content.GetValueForProperty("SettingSubtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingSubtitle, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingSubtitle = (string) content.GetValueForProperty("SettingSubtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingSubtitle, global::System.Convert.ToString); } if (content.Contains("SettingMarkdownSource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingMarkdownSource = (int?) content.GetValueForProperty("SettingMarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingMarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingMarkdownSource = (int?) content.GetValueForProperty("SettingMarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingMarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("SettingMarkdownUri")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingMarkdownUri = (string) content.GetValueForProperty("SettingMarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingMarkdownUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingMarkdownUri = (string) content.GetValueForProperty("SettingMarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingMarkdownUri, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -160,43 +168,43 @@ internal MarkdownPartMetadata(global::System.Management.Automation.PSObject cont // actually deserialize if (content.Contains("Setting")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsTypeConverter.ConvertFrom); } if (content.Contains("Input")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).Input = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny[]) content.GetValueForProperty("Input",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).Input, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).Input = (System.Collections.Generic.List) content.GetValueForProperty("Input",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).Input, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.AnyTypeConverter.ConvertFrom)); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("SettingsContent")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingsContent = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent) content.GetValueForProperty("SettingsContent",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingsContent, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingsContent = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent) content.GetValueForProperty("SettingsContent",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingsContent, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentTypeConverter.ConvertFrom); } if (content.Contains("Content")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).Content = (string) content.GetValueForProperty("Content",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).Content, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).Content = (string) content.GetValueForProperty("Content",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).Content, global::System.Convert.ToString); } if (content.Contains("ContentSetting")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).ContentSetting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings) content.GetValueForProperty("ContentSetting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).ContentSetting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentSettingsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).ContentSetting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings) content.GetValueForProperty("ContentSetting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).ContentSetting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentSettingsTypeConverter.ConvertFrom); } if (content.Contains("SettingTitle")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingTitle = (string) content.GetValueForProperty("SettingTitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingTitle, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingTitle = (string) content.GetValueForProperty("SettingTitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingTitle, global::System.Convert.ToString); } if (content.Contains("SettingSubtitle")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingSubtitle = (string) content.GetValueForProperty("SettingSubtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingSubtitle, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingSubtitle = (string) content.GetValueForProperty("SettingSubtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingSubtitle, global::System.Convert.ToString); } if (content.Contains("SettingMarkdownSource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingMarkdownSource = (int?) content.GetValueForProperty("SettingMarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingMarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingMarkdownSource = (int?) content.GetValueForProperty("SettingMarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingMarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("SettingMarkdownUri")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingMarkdownUri = (string) content.GetValueForProperty("SettingMarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal)this).SettingMarkdownUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingMarkdownUri = (string) content.GetValueForProperty("SettingMarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal)this).SettingMarkdownUri, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -205,6 +213,18 @@ internal MarkdownPartMetadata(global::System.Management.Automation.PSObject cont /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Markdown part metadata. [System.ComponentModel.TypeConverter(typeof(MarkdownPartMetadataTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadata.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadata.TypeConverter.cs similarity index 96% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadata.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadata.TypeConverter.cs index cafaaedcd136..7e704c23e0d9 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadata.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadata.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadata ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadata ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadata).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadata).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadata.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadata.cs similarity index 59% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadata.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadata.cs index 3a4bc57adbd8..04b3526db9fd 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadata.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadata.cs @@ -3,71 +3,72 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// Markdown part metadata. public partial class MarkdownPartMetadata : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadata, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadata, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IValidates { /// - /// Backing field for Inherited model /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata __dashboardPartMetadata = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartMetadata(); + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata __dashboardPartMetadata = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartMetadata(); /// The content of the markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string Content { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)Setting).SettingContent; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)Setting).SettingContent = value ?? null; } + public string Content { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)Setting).SettingContent; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)Setting).SettingContent = value ?? null; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny[] _input; + private System.Collections.Generic.List _input; /// Input to dashboard part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny[] Input { get => this._input; set => this._input = value; } + public System.Collections.Generic.List Input { get => this._input; set => this._input = value; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal)__dashboardPartMetadata).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal)__dashboardPartMetadata).Type = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal)__dashboardPartMetadata).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal)__dashboardPartMetadata).Type = value; } /// Internal Acessors for ContentSetting - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal.ContentSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)Setting).ContentSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)Setting).ContentSetting = value; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal.ContentSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)Setting).ContentSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)Setting).ContentSetting = value; } /// Internal Acessors for Setting - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal.Setting { get => (this._setting = this._setting ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettings()); set { {_setting = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal.Setting { get => (this._setting = this._setting ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettings()); set { {_setting = value;} } } /// Internal Acessors for SettingsContent - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataInternal.SettingsContent { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)Setting).Content; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)Setting).Content = value; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataInternal.SettingsContent { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)Setting).Content; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)Setting).Content = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings _setting; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings _setting; /// Markdown part settings. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings Setting { get => (this._setting = this._setting ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettings()); set => this._setting = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings Setting { get => (this._setting = this._setting ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettings()); set => this._setting = value; } /// The source of the content of the markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public int? SettingMarkdownSource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)Setting).SettingMarkdownSource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)Setting).SettingMarkdownSource = value ?? default(int); } + public int? SettingMarkdownSource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)Setting).SettingMarkdownSource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)Setting).SettingMarkdownSource = value ?? default(int); } /// The uri of markdown content. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string SettingMarkdownUri { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)Setting).SettingMarkdownUri; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)Setting).SettingMarkdownUri = value ?? null; } + public string SettingMarkdownUri { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)Setting).SettingMarkdownUri; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)Setting).SettingMarkdownUri = value ?? null; } /// The subtitle of the markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string SettingSubtitle { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)Setting).SettingSubtitle; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)Setting).SettingSubtitle = value ?? null; } + public string SettingSubtitle { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)Setting).SettingSubtitle; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)Setting).SettingSubtitle = value ?? null; } /// The title of the markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string SettingTitle { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)Setting).SettingTitle; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)Setting).SettingTitle = value ?? null; } + public string SettingTitle { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)Setting).SettingTitle; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)Setting).SettingTitle = value ?? null; } /// The dashboard part metadata type. + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Constant] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal)__dashboardPartMetadata).Type; } + public string Type { get => "Extension/HubsExtension/PartType/MarkdownPart"; } /// Creates an new instance. public MarkdownPartMetadata() @@ -90,12 +91,15 @@ public MarkdownPartMetadata() /// Markdown part metadata. public partial interface IMarkdownPartMetadata : Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadata + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadata { /// The content of the markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The content of the markdown part.", SerializedName = @"content", PossibleTypes = new [] { typeof(string) })] @@ -104,14 +108,20 @@ public partial interface IMarkdownPartMetadata : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Input to dashboard part.", SerializedName = @"inputs", PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny[] Input { get; set; } + System.Collections.Generic.List Input { get; set; } /// The source of the content of the markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The source of the content of the markdown part.", SerializedName = @"markdownSource", PossibleTypes = new [] { typeof(int) })] @@ -120,6 +130,9 @@ public partial interface IMarkdownPartMetadata : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The uri of markdown content.", SerializedName = @"markdownUri", PossibleTypes = new [] { typeof(string) })] @@ -128,6 +141,9 @@ public partial interface IMarkdownPartMetadata : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The subtitle of the markdown part.", SerializedName = @"subtitle", PossibleTypes = new [] { typeof(string) })] @@ -136,6 +152,9 @@ public partial interface IMarkdownPartMetadata : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The title of the markdown part.", SerializedName = @"title", PossibleTypes = new [] { typeof(string) })] @@ -144,16 +163,16 @@ public partial interface IMarkdownPartMetadata : } /// Markdown part metadata. internal partial interface IMarkdownPartMetadataInternal : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPartMetadataInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPartMetadataInternal { /// The content of the markdown part. string Content { get; set; } /// The setting of the content of markdown part. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings ContentSetting { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings ContentSetting { get; set; } /// Input to dashboard part. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny[] Input { get; set; } + System.Collections.Generic.List Input { get; set; } /// Markdown part settings. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings Setting { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings Setting { get; set; } /// The source of the content of the markdown part. int? SettingMarkdownSource { get; set; } /// The uri of markdown content. @@ -163,7 +182,7 @@ internal partial interface IMarkdownPartMetadataInternal : /// The title of the markdown part. string SettingTitle { get; set; } /// The content of markdown part. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent SettingsContent { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent SettingsContent { get; set; } } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadata.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadata.json.cs similarity index 89% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadata.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadata.json.cs index c32f2a1a089a..347855da852b 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadata.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadata.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class MarkdownPartMetadata partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadata. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadata. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadata. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadata. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadata FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadata FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new MarkdownPartMetadata(json) : null; } @@ -77,9 +77,9 @@ internal MarkdownPartMetadata(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime. { return; } - __dashboardPartMetadata = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPartMetadata(json); - {_setting = If( json?.PropertyT("settings"), out var __jsonSettings) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettings.FromJson(__jsonSettings) : Setting;} - {_input = If( json?.PropertyT("inputs"), out var __jsonInputs) ? If( __jsonInputs as Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Models.IAny) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Any.FromJson(__u) )) ))() : null : Input;} + __dashboardPartMetadata = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPartMetadata(json); + {_setting = If( json?.PropertyT("settings"), out var __jsonSettings) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettings.FromJson(__jsonSettings) : _setting;} + {_input = If( json?.PropertyT("inputs"), out var __jsonInputs) ? If( __jsonInputs as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IAny) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Any.FromJson(__u) )) ))() : null : _input;} AfterFromJson(json); } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettings.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettings.PowerShell.cs similarity index 58% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettings.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettings.PowerShell.cs index c9d46603f951..fb2f614baca1 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettings.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettings.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,29 +55,35 @@ public partial class MarkdownPartMetadataSettings partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new MarkdownPartMetadataSettings(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new MarkdownPartMetadataSettings(content); } @@ -87,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -105,37 +111,37 @@ internal MarkdownPartMetadataSettings(global::System.Collections.IDictionary con // actually deserialize if (content.Contains("Content")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).Content = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent) content.GetValueForProperty("Content",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).Content, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).Content = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent) content.GetValueForProperty("Content",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).Content, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentTypeConverter.ConvertFrom); } if (content.Contains("ContentSetting")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).ContentSetting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings) content.GetValueForProperty("ContentSetting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).ContentSetting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentSettingsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).ContentSetting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings) content.GetValueForProperty("ContentSetting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).ContentSetting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentSettingsTypeConverter.ConvertFrom); } if (content.Contains("SettingContent")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingContent = (string) content.GetValueForProperty("SettingContent",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingContent, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingContent = (string) content.GetValueForProperty("SettingContent",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingContent, global::System.Convert.ToString); } if (content.Contains("SettingTitle")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingTitle = (string) content.GetValueForProperty("SettingTitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingTitle, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingTitle = (string) content.GetValueForProperty("SettingTitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingTitle, global::System.Convert.ToString); } if (content.Contains("SettingSubtitle")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingSubtitle = (string) content.GetValueForProperty("SettingSubtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingSubtitle, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingSubtitle = (string) content.GetValueForProperty("SettingSubtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingSubtitle, global::System.Convert.ToString); } if (content.Contains("SettingMarkdownSource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownSource = (int?) content.GetValueForProperty("SettingMarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownSource = (int?) content.GetValueForProperty("SettingMarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("SettingMarkdownUri")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownUri = (string) content.GetValueForProperty("SettingMarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownUri = (string) content.GetValueForProperty("SettingMarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownUri, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -150,31 +156,31 @@ internal MarkdownPartMetadataSettings(global::System.Management.Automation.PSObj // actually deserialize if (content.Contains("Content")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).Content = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent) content.GetValueForProperty("Content",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).Content, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).Content = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent) content.GetValueForProperty("Content",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).Content, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentTypeConverter.ConvertFrom); } if (content.Contains("ContentSetting")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).ContentSetting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings) content.GetValueForProperty("ContentSetting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).ContentSetting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentSettingsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).ContentSetting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings) content.GetValueForProperty("ContentSetting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).ContentSetting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentSettingsTypeConverter.ConvertFrom); } if (content.Contains("SettingContent")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingContent = (string) content.GetValueForProperty("SettingContent",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingContent, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingContent = (string) content.GetValueForProperty("SettingContent",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingContent, global::System.Convert.ToString); } if (content.Contains("SettingTitle")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingTitle = (string) content.GetValueForProperty("SettingTitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingTitle, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingTitle = (string) content.GetValueForProperty("SettingTitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingTitle, global::System.Convert.ToString); } if (content.Contains("SettingSubtitle")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingSubtitle = (string) content.GetValueForProperty("SettingSubtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingSubtitle, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingSubtitle = (string) content.GetValueForProperty("SettingSubtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingSubtitle, global::System.Convert.ToString); } if (content.Contains("SettingMarkdownSource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownSource = (int?) content.GetValueForProperty("SettingMarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownSource = (int?) content.GetValueForProperty("SettingMarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("SettingMarkdownUri")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownUri = (string) content.GetValueForProperty("SettingMarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownUri = (string) content.GetValueForProperty("SettingMarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal)this).SettingMarkdownUri, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -183,6 +189,18 @@ internal MarkdownPartMetadataSettings(global::System.Management.Automation.PSObj /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Markdown part settings. [System.ComponentModel.TypeConverter(typeof(MarkdownPartMetadataSettingsTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettings.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettings.TypeConverter.cs similarity index 96% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettings.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettings.TypeConverter.cs index 143a2b77610b..d524395de312 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettings.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettings.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettings.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettings.cs similarity index 61% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettings.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettings.cs index a583166c385a..d1b9d1985640 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettings.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettings.cs @@ -3,48 +3,48 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// Markdown part settings. public partial class MarkdownPartMetadataSettings : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent _content; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent _content; /// The content of markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent Content { get => (this._content = this._content ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContent()); set => this._content = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent Content { get => (this._content = this._content ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContent()); set => this._content = value; } /// Internal Acessors for Content - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal.Content { get => (this._content = this._content ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContent()); set { {_content = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal.Content { get => (this._content = this._content ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContent()); set { {_content = value;} } } /// Internal Acessors for ContentSetting - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsInternal.ContentSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)Content).Setting; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)Content).Setting = value; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsInternal.ContentSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)Content).Setting; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)Content).Setting = value; } /// The content of the markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string SettingContent { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)Content).SettingContent; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)Content).SettingContent = value ?? null; } + public string SettingContent { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)Content).SettingContent; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)Content).SettingContent = value ?? null; } /// The source of the content of the markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public int? SettingMarkdownSource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)Content).SettingMarkdownSource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)Content).SettingMarkdownSource = value ?? default(int); } + public int? SettingMarkdownSource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)Content).SettingMarkdownSource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)Content).SettingMarkdownSource = value ?? default(int); } /// The uri of markdown content. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string SettingMarkdownUri { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)Content).SettingMarkdownUri; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)Content).SettingMarkdownUri = value ?? null; } + public string SettingMarkdownUri { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)Content).SettingMarkdownUri; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)Content).SettingMarkdownUri = value ?? null; } /// The subtitle of the markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string SettingSubtitle { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)Content).SettingSubtitle; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)Content).SettingSubtitle = value ?? null; } + public string SettingSubtitle { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)Content).SettingSubtitle; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)Content).SettingSubtitle = value ?? null; } /// The title of the markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string SettingTitle { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)Content).SettingTitle; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)Content).SettingTitle = value ?? null; } + public string SettingTitle { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)Content).SettingTitle; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)Content).SettingTitle = value ?? null; } /// Creates an new instance. public MarkdownPartMetadataSettings() @@ -60,6 +60,9 @@ public partial interface IMarkdownPartMetadataSettings : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The content of the markdown part.", SerializedName = @"content", PossibleTypes = new [] { typeof(string) })] @@ -68,6 +71,9 @@ public partial interface IMarkdownPartMetadataSettings : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The source of the content of the markdown part.", SerializedName = @"markdownSource", PossibleTypes = new [] { typeof(int) })] @@ -76,6 +82,9 @@ public partial interface IMarkdownPartMetadataSettings : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The uri of markdown content.", SerializedName = @"markdownUri", PossibleTypes = new [] { typeof(string) })] @@ -84,6 +93,9 @@ public partial interface IMarkdownPartMetadataSettings : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The subtitle of the markdown part.", SerializedName = @"subtitle", PossibleTypes = new [] { typeof(string) })] @@ -92,6 +104,9 @@ public partial interface IMarkdownPartMetadataSettings : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The title of the markdown part.", SerializedName = @"title", PossibleTypes = new [] { typeof(string) })] @@ -103,9 +118,9 @@ internal partial interface IMarkdownPartMetadataSettingsInternal { /// The content of markdown part. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent Content { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent Content { get; set; } /// The setting of the content of markdown part. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings ContentSetting { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings ContentSetting { get; set; } /// The content of the markdown part. string SettingContent { get; set; } /// The source of the content of the markdown part. diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettings.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettings.json.cs similarity index 93% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettings.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettings.json.cs index 50a0a0b58cfb..04419de46673 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettings.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettings.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class MarkdownPartMetadataSettings partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new MarkdownPartMetadataSettings(json) : null; } @@ -77,7 +77,7 @@ internal MarkdownPartMetadataSettings(Microsoft.Azure.PowerShell.Cmdlets.Portal. { return; } - {_content = If( json?.PropertyT("content"), out var __jsonContent) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContent.FromJson(__jsonContent) : Content;} + {_content = If( json?.PropertyT("content"), out var __jsonContent) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContent.FromJson(__jsonContent) : _content;} AfterFromJson(json); } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContent.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContent.PowerShell.cs similarity index 61% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContent.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContent.PowerShell.cs index 1030cfd1912a..4a8914863359 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContent.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContent.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,29 +55,35 @@ public partial class MarkdownPartMetadataSettingsContent partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new MarkdownPartMetadataSettingsContent(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new MarkdownPartMetadataSettingsContent(content); } @@ -89,10 +95,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// an instance of the model class. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -107,33 +113,33 @@ internal MarkdownPartMetadataSettingsContent(global::System.Collections.IDiction // actually deserialize if (content.Contains("Setting")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentSettingsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentSettingsTypeConverter.ConvertFrom); } if (content.Contains("SettingContent")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingContent = (string) content.GetValueForProperty("SettingContent",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingContent, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingContent = (string) content.GetValueForProperty("SettingContent",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingContent, global::System.Convert.ToString); } if (content.Contains("SettingTitle")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingTitle = (string) content.GetValueForProperty("SettingTitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingTitle, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingTitle = (string) content.GetValueForProperty("SettingTitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingTitle, global::System.Convert.ToString); } if (content.Contains("SettingSubtitle")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingSubtitle = (string) content.GetValueForProperty("SettingSubtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingSubtitle, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingSubtitle = (string) content.GetValueForProperty("SettingSubtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingSubtitle, global::System.Convert.ToString); } if (content.Contains("SettingMarkdownSource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownSource = (int?) content.GetValueForProperty("SettingMarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownSource = (int?) content.GetValueForProperty("SettingMarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("SettingMarkdownUri")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownUri = (string) content.GetValueForProperty("SettingMarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownUri = (string) content.GetValueForProperty("SettingMarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownUri, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -148,27 +154,27 @@ internal MarkdownPartMetadataSettingsContent(global::System.Management.Automatio // actually deserialize if (content.Contains("Setting")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentSettingsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).Setting = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings) content.GetValueForProperty("Setting",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).Setting, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentSettingsTypeConverter.ConvertFrom); } if (content.Contains("SettingContent")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingContent = (string) content.GetValueForProperty("SettingContent",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingContent, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingContent = (string) content.GetValueForProperty("SettingContent",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingContent, global::System.Convert.ToString); } if (content.Contains("SettingTitle")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingTitle = (string) content.GetValueForProperty("SettingTitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingTitle, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingTitle = (string) content.GetValueForProperty("SettingTitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingTitle, global::System.Convert.ToString); } if (content.Contains("SettingSubtitle")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingSubtitle = (string) content.GetValueForProperty("SettingSubtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingSubtitle, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingSubtitle = (string) content.GetValueForProperty("SettingSubtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingSubtitle, global::System.Convert.ToString); } if (content.Contains("SettingMarkdownSource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownSource = (int?) content.GetValueForProperty("SettingMarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownSource = (int?) content.GetValueForProperty("SettingMarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("SettingMarkdownUri")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownUri = (string) content.GetValueForProperty("SettingMarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownUri = (string) content.GetValueForProperty("SettingMarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal)this).SettingMarkdownUri, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -177,6 +183,18 @@ internal MarkdownPartMetadataSettingsContent(global::System.Management.Automatio /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The content of markdown part. [System.ComponentModel.TypeConverter(typeof(MarkdownPartMetadataSettingsContentTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContent.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContent.TypeConverter.cs similarity index 96% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContent.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContent.TypeConverter.cs index 9712b5774208..43e2168116f9 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContent.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContent.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -108,14 +108,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContent.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContent.cs similarity index 66% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContent.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContent.cs index b661eb40f0b0..8e5294fded6e 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContent.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContent.cs @@ -3,45 +3,45 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// The content of markdown part. public partial class MarkdownPartMetadataSettingsContent : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal { /// Internal Acessors for Setting - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentInternal.Setting { get => (this._setting = this._setting ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentSettings()); set { {_setting = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentInternal.Setting { get => (this._setting = this._setting ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentSettings()); set { {_setting = value;} } } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings _setting; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings _setting; /// The setting of the content of markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings Setting { get => (this._setting = this._setting ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentSettings()); set => this._setting = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings Setting { get => (this._setting = this._setting ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentSettings()); set => this._setting = value; } /// The content of the markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string SettingContent { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).Content; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).Content = value ?? null; } + public string SettingContent { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).Content; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).Content = value ?? null; } /// The source of the content of the markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public int? SettingMarkdownSource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).MarkdownSource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).MarkdownSource = value ?? default(int); } + public int? SettingMarkdownSource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).MarkdownSource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).MarkdownSource = value ?? default(int); } /// The uri of markdown content. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string SettingMarkdownUri { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).MarkdownUri; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).MarkdownUri = value ?? null; } + public string SettingMarkdownUri { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).MarkdownUri; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).MarkdownUri = value ?? null; } /// The subtitle of the markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string SettingSubtitle { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).Subtitle; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).Subtitle = value ?? null; } + public string SettingSubtitle { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).Subtitle; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).Subtitle = value ?? null; } /// The title of the markdown part. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string SettingTitle { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).Title; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).Title = value ?? null; } + public string SettingTitle { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).Title; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)Setting).Title = value ?? null; } /// Creates an new instance. public MarkdownPartMetadataSettingsContent() @@ -57,6 +57,9 @@ public partial interface IMarkdownPartMetadataSettingsContent : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The content of the markdown part.", SerializedName = @"content", PossibleTypes = new [] { typeof(string) })] @@ -65,6 +68,9 @@ public partial interface IMarkdownPartMetadataSettingsContent : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The source of the content of the markdown part.", SerializedName = @"markdownSource", PossibleTypes = new [] { typeof(int) })] @@ -73,6 +79,9 @@ public partial interface IMarkdownPartMetadataSettingsContent : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The uri of markdown content.", SerializedName = @"markdownUri", PossibleTypes = new [] { typeof(string) })] @@ -81,6 +90,9 @@ public partial interface IMarkdownPartMetadataSettingsContent : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The subtitle of the markdown part.", SerializedName = @"subtitle", PossibleTypes = new [] { typeof(string) })] @@ -89,6 +101,9 @@ public partial interface IMarkdownPartMetadataSettingsContent : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The title of the markdown part.", SerializedName = @"title", PossibleTypes = new [] { typeof(string) })] @@ -100,7 +115,7 @@ internal partial interface IMarkdownPartMetadataSettingsContentInternal { /// The setting of the content of markdown part. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings Setting { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings Setting { get; set; } /// The content of the markdown part. string SettingContent { get; set; } /// The source of the content of the markdown part. diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContent.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContent.json.cs similarity index 92% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContent.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContent.json.cs index 4ed9af2151da..d4a454f61628 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContent.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContent.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class MarkdownPartMetadataSettingsContent partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContent FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContent FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new MarkdownPartMetadataSettingsContent(json) : null; } @@ -77,7 +77,7 @@ internal MarkdownPartMetadataSettingsContent(Microsoft.Azure.PowerShell.Cmdlets. { return; } - {_setting = If( json?.PropertyT("settings"), out var __jsonSettings) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.MarkdownPartMetadataSettingsContentSettings.FromJson(__jsonSettings) : Setting;} + {_setting = If( json?.PropertyT("settings"), out var __jsonSettings) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.MarkdownPartMetadataSettingsContentSettings.FromJson(__jsonSettings) : _setting;} AfterFromJson(json); } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContentSettings.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContentSettings.PowerShell.cs similarity index 64% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContentSettings.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContentSettings.PowerShell.cs index e8b0993c80ef..91aa29bf6dd5 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContentSettings.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContentSettings.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,29 +55,37 @@ public partial class MarkdownPartMetadataSettingsContentSettings partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, 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.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new MarkdownPartMetadataSettingsContentSettings(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new MarkdownPartMetadataSettingsContentSettings(content); } @@ -90,10 +98,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// an instance of the model class. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -108,29 +116,29 @@ internal MarkdownPartMetadataSettingsContentSettings(global::System.Collections. // actually deserialize if (content.Contains("Content")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Content = (string) content.GetValueForProperty("Content",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Content, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Content = (string) content.GetValueForProperty("Content",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Content, global::System.Convert.ToString); } if (content.Contains("Title")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Title = (string) content.GetValueForProperty("Title",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Title, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Title = (string) content.GetValueForProperty("Title",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Title, global::System.Convert.ToString); } if (content.Contains("Subtitle")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Subtitle = (string) content.GetValueForProperty("Subtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Subtitle, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Subtitle = (string) content.GetValueForProperty("Subtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Subtitle, global::System.Convert.ToString); } if (content.Contains("MarkdownSource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownSource = (int?) content.GetValueForProperty("MarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownSource = (int?) content.GetValueForProperty("MarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("MarkdownUri")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownUri = (string) content.GetValueForProperty("MarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownUri = (string) content.GetValueForProperty("MarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownUri, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -145,23 +153,23 @@ internal MarkdownPartMetadataSettingsContentSettings(global::System.Management.A // actually deserialize if (content.Contains("Content")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Content = (string) content.GetValueForProperty("Content",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Content, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Content = (string) content.GetValueForProperty("Content",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Content, global::System.Convert.ToString); } if (content.Contains("Title")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Title = (string) content.GetValueForProperty("Title",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Title, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Title = (string) content.GetValueForProperty("Title",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Title, global::System.Convert.ToString); } if (content.Contains("Subtitle")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Subtitle = (string) content.GetValueForProperty("Subtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Subtitle, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Subtitle = (string) content.GetValueForProperty("Subtitle",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).Subtitle, global::System.Convert.ToString); } if (content.Contains("MarkdownSource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownSource = (int?) content.GetValueForProperty("MarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownSource = (int?) content.GetValueForProperty("MarkdownSource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownSource, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); } if (content.Contains("MarkdownUri")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownUri = (string) content.GetValueForProperty("MarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownUri = (string) content.GetValueForProperty("MarkdownUri",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal)this).MarkdownUri, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -170,6 +178,18 @@ internal MarkdownPartMetadataSettingsContentSettings(global::System.Management.A /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The setting of the content of markdown part. [System.ComponentModel.TypeConverter(typeof(MarkdownPartMetadataSettingsContentSettingsTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContentSettings.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContentSettings.TypeConverter.cs similarity index 96% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContentSettings.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContentSettings.TypeConverter.cs index eb3acb461056..a82dc284ad5e 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContentSettings.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContentSettings.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -110,14 +110,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContentSettings.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContentSettings.cs similarity index 90% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContentSettings.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContentSettings.cs index c47935afb0bc..50498fadd3b8 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContentSettings.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContentSettings.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// The setting of the content of markdown part. public partial class MarkdownPartMetadataSettingsContentSettings : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettingsInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettingsInternal { /// Backing field for property. @@ -64,6 +64,9 @@ public partial interface IMarkdownPartMetadataSettingsContentSettings : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The content of the markdown part.", SerializedName = @"content", PossibleTypes = new [] { typeof(string) })] @@ -72,6 +75,9 @@ public partial interface IMarkdownPartMetadataSettingsContentSettings : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The source of the content of the markdown part.", SerializedName = @"markdownSource", PossibleTypes = new [] { typeof(int) })] @@ -80,6 +86,9 @@ public partial interface IMarkdownPartMetadataSettingsContentSettings : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The uri of markdown content.", SerializedName = @"markdownUri", PossibleTypes = new [] { typeof(string) })] @@ -88,6 +97,9 @@ public partial interface IMarkdownPartMetadataSettingsContentSettings : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The subtitle of the markdown part.", SerializedName = @"subtitle", PossibleTypes = new [] { typeof(string) })] @@ -96,6 +108,9 @@ public partial interface IMarkdownPartMetadataSettingsContentSettings : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The title of the markdown part.", SerializedName = @"title", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContentSettings.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContentSettings.json.cs similarity index 92% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContentSettings.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContentSettings.json.cs index c80e5829711d..b32d575232ea 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/MarkdownPartMetadataSettingsContentSettings.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/MarkdownPartMetadataSettingsContentSettings.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class MarkdownPartMetadataSettingsContentSettings partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IMarkdownPartMetadataSettingsContentSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IMarkdownPartMetadataSettingsContentSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new MarkdownPartMetadataSettingsContentSettings(json) : null; } @@ -77,11 +77,11 @@ internal MarkdownPartMetadataSettingsContentSettings(Microsoft.Azure.PowerShell. { return; } - {_content = If( json?.PropertyT("content"), out var __jsonContent) ? (string)__jsonContent : (string)Content;} - {_title = If( json?.PropertyT("title"), out var __jsonTitle) ? (string)__jsonTitle : (string)Title;} - {_subtitle = If( json?.PropertyT("subtitle"), out var __jsonSubtitle) ? (string)__jsonSubtitle : (string)Subtitle;} - {_markdownSource = If( json?.PropertyT("markdownSource"), out var __jsonMarkdownSource) ? (int?)__jsonMarkdownSource : MarkdownSource;} - {_markdownUri = If( json?.PropertyT("markdownUri"), out var __jsonMarkdownUri) ? (string)__jsonMarkdownUri : (string)MarkdownUri;} + {_content = If( json?.PropertyT("content"), out var __jsonContent) ? (string)__jsonContent : (string)_content;} + {_title = If( json?.PropertyT("title"), out var __jsonTitle) ? (string)__jsonTitle : (string)_title;} + {_subtitle = If( json?.PropertyT("subtitle"), out var __jsonSubtitle) ? (string)__jsonSubtitle : (string)_subtitle;} + {_markdownSource = If( json?.PropertyT("markdownSource"), out var __jsonMarkdownSource) ? (int?)__jsonMarkdownSource : _markdownSource;} + {_markdownUri = If( json?.PropertyT("markdownUri"), out var __jsonMarkdownUri) ? (string)__jsonMarkdownUri : (string)_markdownUri;} AfterFromJson(json); } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Operation.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Operation.PowerShell.cs similarity index 61% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/Operation.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/Operation.PowerShell.cs index 0a6270b84f86..027176061006 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Operation.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Operation.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -57,27 +57,35 @@ public partial class Operation partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new Operation(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new Operation(content); } @@ -87,10 +95,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -105,45 +113,45 @@ internal Operation(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Display")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.OperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.OperationDisplayTypeConverter.ConvertFrom); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("IsDataAction")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("Origin")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).Origin = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.Origin?) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).Origin, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.Origin.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).Origin, global::System.Convert.ToString); } if (content.Contains("ActionType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).ActionType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ActionType?) content.GetValueForProperty("ActionType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).ActionType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ActionType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).ActionType = (string) content.GetValueForProperty("ActionType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).ActionType, global::System.Convert.ToString); } if (content.Contains("DisplayProvider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); } if (content.Contains("DisplayResource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); } if (content.Contains("DisplayOperation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); } if (content.Contains("DisplayDescription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -158,39 +166,39 @@ internal Operation(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Display")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.OperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.OperationDisplayTypeConverter.ConvertFrom); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("IsDataAction")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("Origin")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).Origin = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.Origin?) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).Origin, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.Origin.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).Origin, global::System.Convert.ToString); } if (content.Contains("ActionType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).ActionType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ActionType?) content.GetValueForProperty("ActionType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).ActionType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ActionType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).ActionType = (string) content.GetValueForProperty("ActionType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).ActionType, global::System.Convert.ToString); } if (content.Contains("DisplayProvider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); } if (content.Contains("DisplayResource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); } if (content.Contains("DisplayOperation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); } if (content.Contains("DisplayDescription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -199,6 +207,18 @@ internal Operation(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Details of a REST API operation, returned from the Resource Provider Operations API [System.ComponentModel.TypeConverter(typeof(OperationTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Operation.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Operation.TypeConverter.cs similarity index 97% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/Operation.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/Operation.TypeConverter.cs index 15afd480a675..d33255aa7f3e 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Operation.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Operation.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -105,14 +105,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Operation.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Operation.cs similarity index 74% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/Operation.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/Operation.cs index 48863074adda..33b56cac5fbd 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Operation.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Operation.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -11,50 +11,50 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 /// Details of a REST API operation, returned from the Resource Provider Operations API /// public partial class Operation : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ActionType? _actionType; + private string _actionType; /// /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. /// [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ActionType? ActionType { get => this._actionType; } + public string ActionType { get => this._actionType; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay _display; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay _display; /// Localized display information for this particular operation. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.OperationDisplay()); set => this._display = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.OperationDisplay()); set => this._display = value; } /// /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. /// [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)Display).Description; } + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)Display).Operation; } + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)Display).Operation; } /// /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". /// [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)Display).Provider; } + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)Display).Resource; } + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)Display).Resource; } /// Backing field for property. private bool? _isDataAction; @@ -67,31 +67,31 @@ public partial class Operation : public bool? IsDataAction { get => this._isDataAction; } /// Internal Acessors for ActionType - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ActionType? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal.ActionType { get => this._actionType; set { {_actionType = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal.ActionType { get => this._actionType; set { {_actionType = value;} } } /// Internal Acessors for Display - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.OperationDisplay()); set { {_display = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.OperationDisplay()); set { {_display = value;} } } /// Internal Acessors for DisplayDescription - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal.DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)Display).Description = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal.DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)Display).Description = value; } /// Internal Acessors for DisplayOperation - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal.DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)Display).Operation = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal.DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)Display).Operation = value; } /// Internal Acessors for DisplayProvider - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal.DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)Display).Provider = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal.DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)Display).Provider = value; } /// Internal Acessors for DisplayResource - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal.DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)Display).Resource = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal.DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)Display).Resource = value; } /// Internal Acessors for IsDataAction - bool? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal.IsDataAction { get => this._isDataAction; set { {_isDataAction = value;} } } + bool? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal.IsDataAction { get => this._isDataAction; set { {_isDataAction = value;} } } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal.Name { get => this._name; set { {_name = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal.Name { get => this._name; set { {_name = value;} } } /// Internal Acessors for Origin - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.Origin? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationInternal.Origin { get => this._origin; set { {_origin = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationInternal.Origin { get => this._origin; set { {_origin = value;} } } /// Backing field for property. private string _name; @@ -104,14 +104,14 @@ public partial class Operation : public string Name { get => this._name; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.Origin? _origin; + private string _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.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.Origin? Origin { get => this._origin; } + public string Origin { get => this._origin; } /// Creates an new instance. public Operation() @@ -129,16 +129,23 @@ public partial interface IOperation : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, 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.Portal.Support.ActionType) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ActionType? ActionType { get; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("Internal")] + string ActionType { get; } /// /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. /// [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The short, localized friendly description of the operation; suitable for tool tips and detailed views.", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -150,6 +157,9 @@ public partial interface IOperation : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, 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) })] @@ -160,6 +170,9 @@ public partial interface IOperation : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The localized friendly form of the resource provider name, e.g. ""Microsoft Monitoring Insights"" or ""Microsoft Compute"".", SerializedName = @"provider", PossibleTypes = new [] { typeof(string) })] @@ -170,6 +183,9 @@ public partial interface IOperation : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, 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) })] @@ -181,6 +197,9 @@ public partial interface IOperation : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, 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) })] @@ -192,6 +211,9 @@ public partial interface IOperation : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, 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) })] @@ -203,10 +225,14 @@ public partial interface IOperation : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, 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.Portal.Support.Origin) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.Origin? Origin { get; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("user", "system", "user,system")] + string Origin { get; } } /// Details of a REST API operation, returned from the Resource Provider Operations API @@ -216,9 +242,10 @@ internal partial interface IOperationInternal /// /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. /// - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ActionType? ActionType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("Internal")] + string ActionType { get; set; } /// Localized display information for this particular operation. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay Display { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay Display { get; set; } /// /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. /// @@ -250,7 +277,8 @@ internal partial interface IOperationInternal /// 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.Portal.Support.Origin? Origin { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("user", "system", "user,system")] + string Origin { get; set; } } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Operation.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Operation.json.cs similarity index 91% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/Operation.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/Operation.json.cs index b9a5dbcc5147..cbb2b63ed634 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Operation.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Operation.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -56,13 +56,11 @@ public partial class Operation partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation. + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new Operation(json) : null; } @@ -79,11 +77,11 @@ internal Operation(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonOb { return; } - {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.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;} + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); } @@ -107,19 +105,19 @@ public Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode ToJson(Mi return container; } AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._isDataAction ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonBoolean((bool)this._isDataAction) : null, "isDataAction" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._origin)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._origin.ToString()) : null, "origin" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._actionType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._actionType.ToString()) : null, "actionType" ,container.Add ); } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationDisplay.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/OperationDisplay.PowerShell.cs similarity index 70% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationDisplay.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/OperationDisplay.PowerShell.cs index 22c009e37b58..95497bc3ca5c 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationDisplay.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/OperationDisplay.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class OperationDisplay partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OperationDisplay(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OperationDisplay(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationD /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,25 +111,25 @@ internal OperationDisplay(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Provider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); } if (content.Contains("Resource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("Description")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -136,19 +144,19 @@ internal OperationDisplay(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Provider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); } if (content.Contains("Resource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("Description")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -157,6 +165,18 @@ internal OperationDisplay(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Localized display information for this particular operation. [System.ComponentModel.TypeConverter(typeof(OperationDisplayTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationDisplay.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/OperationDisplay.TypeConverter.cs similarity index 97% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationDisplay.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/OperationDisplay.TypeConverter.cs index 940ad217a48e..491ba33997c0 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationDisplay.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/OperationDisplay.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationDisplay.cs b/generated/Portal/Portal.Autorest/generated/api/Models/OperationDisplay.cs similarity index 88% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationDisplay.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/OperationDisplay.cs index d83ed3393eb2..ce704fb1ac03 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationDisplay.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/OperationDisplay.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// Localized display information for this particular operation. public partial class OperationDisplay : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal { /// Backing field for property. @@ -23,16 +23,16 @@ public partial class OperationDisplay : public string Description { get => this._description; } /// Internal Acessors for Description - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal.Description { get => this._description; set { {_description = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal.Description { get => this._description; set { {_description = value;} } } /// Internal Acessors for Operation - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal.Operation { get => this._operation; set { {_operation = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal.Operation { get => this._operation; set { {_operation = value;} } } /// Internal Acessors for Provider - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal.Provider { get => this._provider; set { {_provider = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal.Provider { get => this._provider; set { {_provider = value;} } } /// Internal Acessors for Resource - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplayInternal.Resource { get => this._resource; set { {_resource = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplayInternal.Resource { get => this._resource; set { {_resource = value;} } } /// Backing field for property. private string _operation; @@ -78,6 +78,9 @@ public partial interface IOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The short, localized friendly description of the operation; suitable for tool tips and detailed views.", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -89,6 +92,9 @@ public partial interface IOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, 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) })] @@ -99,6 +105,9 @@ public partial interface IOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The localized friendly form of the resource provider name, e.g. ""Microsoft Monitoring Insights"" or ""Microsoft Compute"".", SerializedName = @"provider", PossibleTypes = new [] { typeof(string) })] @@ -109,6 +118,9 @@ public partial interface IOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, 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) })] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationDisplay.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/OperationDisplay.json.cs similarity index 91% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationDisplay.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/OperationDisplay.json.cs index c07d9e47b233..95add2e58208 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationDisplay.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/OperationDisplay.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class OperationDisplay partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new OperationDisplay(json) : null; } @@ -77,10 +77,10 @@ internal OperationDisplay(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json { 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;} + {_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); } @@ -103,19 +103,19 @@ public Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode ToJson(Mi { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationListResult.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/OperationListResult.PowerShell.cs similarity index 72% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationListResult.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/OperationListResult.PowerShell.cs index af23839823e6..5eb8578c2afa 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationListResult.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/OperationListResult.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -58,27 +58,35 @@ public partial class OperationListResult partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OperationListResult(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OperationListResult(content); } @@ -88,10 +96,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationL /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -106,17 +114,17 @@ internal OperationListResult(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.OperationTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.OperationTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -131,11 +139,11 @@ internal OperationListResult(global::System.Management.Automation.PSObject conte // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.OperationTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.OperationTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -144,6 +152,18 @@ internal OperationListResult(global::System.Management.Automation.PSObject conte /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of /// results. diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationListResult.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/OperationListResult.TypeConverter.cs similarity index 97% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationListResult.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/OperationListResult.TypeConverter.cs index 07ef39602531..a2bc1f100ba9 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationListResult.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/OperationListResult.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResult ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResult ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResult).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResult).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationListResult.cs b/generated/Portal/Portal.Autorest/generated/api/Models/OperationListResult.cs similarity index 72% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationListResult.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/OperationListResult.cs index 159114423613..c9e8d73b5d1d 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationListResult.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/OperationListResult.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -12,15 +12,15 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 /// results. /// public partial class OperationListResult : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResult, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResultInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResult, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResultInternal { /// Internal Acessors for NextLink - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResultInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResultInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } /// Internal Acessors for Value - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation[] Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResultInternal.Value { get => this._value; set { {_value = value;} } } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResultInternal.Value { get => this._value; set { {_value = value;} } } /// Backing field for property. private string _nextLink; @@ -30,11 +30,11 @@ public partial class OperationListResult : public string NextLink { get => this._nextLink; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation[] _value; + private System.Collections.Generic.List _value; /// List of operations supported by the resource provider [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation[] Value { get => this._value; } + public System.Collections.Generic.List Value { get => this._value; } /// Creates an new instance. public OperationListResult() @@ -51,6 +51,9 @@ public partial interface IOperationListResult : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"URL to get the next set of operation list results (if there are any).", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -59,10 +62,13 @@ public partial interface IOperationListResult : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"List of operations supported by the resource provider", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation[] Value { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation) })] + System.Collections.Generic.List 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 @@ -73,7 +79,7 @@ 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.Portal.Models.Api50.IOperation[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationListResult.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/OperationListResult.json.cs similarity index 89% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationListResult.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/OperationListResult.json.cs index b034a28eedaf..9e75afdd6487 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/OperationListResult.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/OperationListResult.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -57,13 +57,13 @@ public partial class OperationListResult partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResult. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResult. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResult. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResult. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new OperationListResult(json) : null; } @@ -80,8 +80,8 @@ internal OperationListResult(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.J { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Models.Api50.IOperation) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.Operation.FromJson(__u) )) ))() : null : Value;} - {_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.Portal.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation) (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Operation.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} AfterFromJson(json); } @@ -104,7 +104,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode ToJson(Mi { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { if (null != this._value) { @@ -116,7 +116,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode ToJson(Mi container.Add("value",__w); } } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboard.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboard.PowerShell.cs similarity index 62% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboard.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboard.PowerShell.cs index 4e2f584dfa58..1b81ce9f4e31 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboard.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboard.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class PatchableDashboard partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboard DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new PatchableDashboard(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboard DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new PatchableDashboard(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboard FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,25 +111,25 @@ internal PatchableDashboard(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesTypeConverter.ConvertFrom); } if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.PatchableDashboardTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.PatchableDashboardTagsTypeConverter.ConvertFrom); } if (content.Contains("Lens")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Lens = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[]) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Lens, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardLensTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Lens = (System.Collections.Generic.List) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Lens, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardLensTypeConverter.ConvertFrom)); } if (content.Contains("Metadata")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesMetadataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesMetadataTypeConverter.ConvertFrom); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -136,19 +144,19 @@ internal PatchableDashboard(global::System.Management.Automation.PSObject conten // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesTypeConverter.ConvertFrom); } if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.PatchableDashboardTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.PatchableDashboardTagsTypeConverter.ConvertFrom); } if (content.Contains("Lens")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Lens = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[]) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Lens, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardLensTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Lens = (System.Collections.Generic.List) content.GetValueForProperty("Lens",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Lens, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardLensTypeConverter.ConvertFrom)); } if (content.Contains("Metadata")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardPropertiesMetadataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Metadata = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata) content.GetValueForProperty("Metadata",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal)this).Metadata, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardPropertiesMetadataTypeConverter.ConvertFrom); } AfterDeserializePSObject(content); } @@ -157,6 +165,18 @@ internal PatchableDashboard(global::System.Management.Automation.PSObject conten /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The shared dashboard resource definition. [System.ComponentModel.TypeConverter(typeof(PatchableDashboardTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboard.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboard.TypeConverter.cs similarity index 96% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboard.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboard.TypeConverter.cs index f3dc80508ac3..e38532b7466c 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboard.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboard.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboard ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboard).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboard.cs b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboard.cs similarity index 53% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboard.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboard.cs index 1694a3b9760c..5695917c2a9c 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboard.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboard.cs @@ -3,40 +3,40 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// The shared dashboard resource definition. public partial class PatchableDashboard : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboard, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal { /// The dashboard lenses. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesInternal)Property).Lens; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesInternal)Property).Lens = value ?? null /* arrayOf */; } + public System.Collections.Generic.List Lens { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesInternal)Property).Lens; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesInternal)Property).Lens = value ?? null /* arrayOf */; } /// The dashboard metadata. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata Metadata { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesInternal)Property).Metadata; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesInternal)Property).Metadata = value ?? null /* model class */; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata Metadata { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesInternal)Property).Metadata; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesInternal)Property).Metadata = value ?? null /* model class */; } /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardProperties()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardProperties()); set { {_property = value;} } } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties _property; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties _property; /// The shared dashboard properties. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardProperties()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardProperties()); set => this._property = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags _tag; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags _tag; /// Resource tags [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.PatchableDashboardTags()); set => this._tag = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.PatchableDashboardTags()); set => this._tag = value; } /// Creates an new instance. public PatchableDashboard() @@ -52,26 +52,35 @@ public partial interface IPatchableDashboard : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard lenses.", SerializedName = @"lenses", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens) })] + System.Collections.Generic.List Lens { get; set; } /// The dashboard metadata. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The dashboard metadata.", SerializedName = @"metadata", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata Metadata { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata) })] + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata Metadata { get; set; } /// Resource tags [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource tags", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags Tag { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags Tag { get; set; } } /// The shared dashboard resource definition. @@ -79,13 +88,13 @@ internal partial interface IPatchableDashboardInternal { /// The dashboard lenses. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get; set; } + System.Collections.Generic.List Lens { get; set; } /// The dashboard metadata. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata Metadata { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata Metadata { get; set; } /// The shared dashboard properties. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardProperties Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardProperties Property { get; set; } /// Resource tags - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags Tag { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags Tag { get; set; } } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboard.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboard.json.cs similarity index 92% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboard.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboard.json.cs index d506f71b9a27..a4e35304f797 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboard.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboard.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class PatchableDashboard partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboard. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboard. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboard FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new PatchableDashboard(json) : null; } @@ -77,8 +77,8 @@ internal PatchableDashboard(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Js { return; } - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardProperties.FromJson(__jsonProperties) : Property;} - {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.PatchableDashboardTags.FromJson(__jsonTags) : Tag;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardProperties.FromJson(__jsonProperties) : _property;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.PatchableDashboardTags.FromJson(__jsonTags) : _tag;} AfterFromJson(json); } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.PowerShell.cs similarity index 81% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.PowerShell.cs index ceaf886c0946..42c5ade293fe 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,29 +55,35 @@ public partial class PatchableDashboardTags partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new PatchableDashboardTags(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new PatchableDashboardTags(content); } @@ -87,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Previe /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -109,7 +115,7 @@ internal PatchableDashboardTags(global::System.Collections.IDictionary content) } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -131,6 +137,18 @@ internal PatchableDashboardTags(global::System.Management.Automation.PSObject co /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Resource tags [System.ComponentModel.TypeConverter(typeof(PatchableDashboardTagsTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.TypeConverter.cs similarity index 96% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.TypeConverter.cs index 3ca495d04cea..f0a69c8acce2 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.cs b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.cs similarity index 77% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.cs index 1fd54de490b3..2ba0a50c8d32 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// Resource tags public partial class PatchableDashboardTags : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTagsInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTagsInternal { /// Creates an new instance. diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.dictionary.cs b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.dictionary.cs similarity index 95% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.dictionary.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.dictionary.cs index de767c5f780a..b489852161fa 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.dictionary.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.dictionary.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -70,6 +70,6 @@ public void CopyFrom(global::System.Management.Automation.PSObject source) /// - public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.PatchableDashboardTags source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.PatchableDashboardTags source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.json.cs similarity index 94% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.json.cs index d93f810e0c84..305f2341b23f 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api20221201Preview/PatchableDashboardTags.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/PatchableDashboardTags.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class PatchableDashboardTags partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new PatchableDashboardTags(json) : null; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/PortalIdentity.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/PortalIdentity.PowerShell.cs index 262d9b4e03d1..c0fcd55c83f1 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/PortalIdentity.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/PortalIdentity.PowerShell.cs @@ -53,6 +53,14 @@ public partial class PortalIdentity partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + /// /// Deserializes a into an instance of . @@ -156,6 +164,18 @@ internal PortalIdentity(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } [System.ComponentModel.TypeConverter(typeof(PortalIdentityTypeConverter))] public partial interface IPortalIdentity diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/PortalIdentity.cs b/generated/Portal/Portal.Autorest/generated/api/Models/PortalIdentity.cs index cfaedf6ac82a..f39d5e6931aa 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/PortalIdentity.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/PortalIdentity.cs @@ -53,6 +53,9 @@ public partial interface IPortalIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The name of the dashboard.", SerializedName = @"dashboardName", PossibleTypes = new [] { typeof(string) })] @@ -61,6 +64,9 @@ public partial interface IPortalIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource identity path", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -69,6 +75,9 @@ public partial interface IPortalIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The name of the resource group. The name is case insensitive.", SerializedName = @"resourceGroupName", PossibleTypes = new [] { typeof(string) })] @@ -77,6 +86,9 @@ public partial interface IPortalIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The ID of the target subscription. The value must be an UUID.", SerializedName = @"subscriptionId", PossibleTypes = new [] { typeof(string) })] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/PortalIdentity.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/PortalIdentity.json.cs index b6ef61435ca7..d9f3cfcd4e10 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/PortalIdentity.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/PortalIdentity.json.cs @@ -76,10 +76,10 @@ internal PortalIdentity(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.J { 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;} - {_dashboardName = If( json?.PropertyT("dashboardName"), out var __jsonDashboardName) ? (string)__jsonDashboardName : (string)DashboardName;} - {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)_subscriptionId;} + {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)_resourceGroupName;} + {_dashboardName = If( json?.PropertyT("dashboardName"), out var __jsonDashboardName) ? (string)__jsonDashboardName : (string)_dashboardName;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} AfterFromJson(json); } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Resource.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Resource.PowerShell.cs similarity index 59% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/Resource.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/Resource.PowerShell.cs index 7c7b64833294..825f1aaf10a3 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Resource.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Resource.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -57,27 +57,35 @@ public partial class Resource partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new Resource(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new Resource(content); } @@ -87,10 +95,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResource D /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -105,49 +113,49 @@ internal Resource(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("SystemData")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.SystemDataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.SystemDataTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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 into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -162,43 +170,43 @@ internal Resource(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("SystemData")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.SystemDataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.SystemDataTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); } @@ -207,6 +215,18 @@ internal Resource(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Common fields that are returned in the response for all Azure Resource Manager resources [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Resource.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Resource.TypeConverter.cs similarity index 97% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/Resource.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/Resource.TypeConverter.cs index d6db81f0bb55..968d6e6258ed 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Resource.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Resource.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -105,14 +105,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResource ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResource ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResource).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResource).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Resource.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Resource.cs similarity index 62% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/Resource.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/Resource.cs index 1c1a4b09a72c..9ff267597375 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Resource.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Resource.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -11,8 +11,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 /// Common fields that are returned in the response for all Azure Resource Manager resources /// public partial class Resource : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResource, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResource, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal { /// Backing field for property. @@ -25,16 +25,34 @@ public partial class Resource : public string Id { get => this._id; } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal.Id { get => this._id; set { {_id = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.Id { get => this._id; set { {_id = value;} } } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal.Name { get => this._name; set { {_name = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.Name { get => this._name; set { {_name = value;} } } /// Internal Acessors for SystemData - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.SystemData()); set { {_systemData = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.SystemData()); set { {_systemData = value;} } } + + /// Internal Acessors for SystemDataCreatedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).CreatedAt = value; } + + /// Internal Acessors for SystemDataCreatedBy + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).CreatedBy = value; } + + /// Internal Acessors for SystemDataCreatedByType + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).CreatedByType = value; } + + /// Internal Acessors for SystemDataLastModifiedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).LastModifiedAt = value; } + + /// Internal Acessors for SystemDataLastModifiedBy + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).LastModifiedBy = value; } + + /// Internal Acessors for SystemDataLastModifiedByType + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).LastModifiedByType = value; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal.Type { get => this._type; set { {_type = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.Type { get => this._type; set { {_type = value;} } } /// Backing field for property. private string _name; @@ -44,37 +62,37 @@ public partial class Resource : public string Name { get => this._name; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData _systemData; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData _systemData; /// /// Azure Resource Manager metadata containing createdBy and modifiedBy information. /// [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.SystemData()); } + internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.SystemData()); } /// The timestamp of resource creation (UTC). [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).CreatedAt; } /// The identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).CreatedBy; } /// The type of identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)SystemData).CreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType)""); } + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).CreatedByType; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).LastModifiedAt; } /// The identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).LastModifiedBy; } /// The type of identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)SystemData).LastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType)""); } + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)SystemData).LastModifiedByType; } /// Backing field for property. private string _type; @@ -101,6 +119,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Fully qualified resource ID for the resource. E.g. ""/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}""", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -109,6 +130,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The name of the resource", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -116,57 +140,80 @@ public partial interface IResource : /// The timestamp of resource creation (UTC). [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The timestamp of resource creation (UTC).", SerializedName = @"createdAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] - global::System.DateTime? SystemDataCreatedAt { get; set; } + global::System.DateTime? SystemDataCreatedAt { get; } /// The identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The identity that created the resource.", SerializedName = @"createdBy", PossibleTypes = new [] { typeof(string) })] - string SystemDataCreatedBy { get; set; } + string SystemDataCreatedBy { get; } /// The type of identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of identity that created the resource.", SerializedName = @"createdByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? SystemDataCreatedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The timestamp of resource last modification (UTC)", SerializedName = @"lastModifiedAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] - global::System.DateTime? SystemDataLastModifiedAt { get; set; } + global::System.DateTime? SystemDataLastModifiedAt { get; } /// The identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The identity that last modified the resource.", SerializedName = @"lastModifiedBy", PossibleTypes = new [] { typeof(string) })] - string SystemDataLastModifiedBy { get; set; } + string SystemDataLastModifiedBy { get; } /// The type of identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of identity that last modified the resource.", SerializedName = @"lastModifiedByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? SystemDataLastModifiedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } /// /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" /// [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of the resource. E.g. ""Microsoft.Compute/virtualMachines"" or ""Microsoft.Storage/storageAccounts""", SerializedName = @"type", PossibleTypes = new [] { typeof(string) })] @@ -186,19 +233,21 @@ internal partial interface IResourceInternal /// /// Azure Resource Manager metadata containing createdBy and modifiedBy information. /// - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData SystemData { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Support.CreatedByType? SystemDataCreatedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string 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.Portal.Support.CreatedByType? SystemDataLastModifiedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } /// /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" /// diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Resource.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/Resource.json.cs similarity index 90% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/Resource.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/Resource.json.cs index 1b0ee5e1b1c5..5731440ce1ad 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/Resource.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/Resource.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -56,13 +56,11 @@ public partial class Resource partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResource. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResource. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResource. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResource. + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new Resource(json) : null; } @@ -79,10 +77,10 @@ internal Resource(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObj { return; } - {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.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;} + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); } @@ -105,19 +103,19 @@ public Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode ToJson(Mi { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/SystemData.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/SystemData.PowerShell.cs similarity index 66% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/SystemData.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/SystemData.PowerShell.cs index ae4d0ac6267e..744652008110 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/SystemData.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/SystemData.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class SystemData partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new SystemData(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new SystemData(content); } @@ -85,10 +93,10 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,33 +111,33 @@ internal SystemData(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("CreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); } if (content.Contains("CreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).CreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).CreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).CreatedByType, global::System.Convert.ToString); } if (content.Contains("CreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Models.Api50.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); } if (content.Contains("LastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).LastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).LastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).LastModifiedByType, global::System.Convert.ToString); } if (content.Contains("LastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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 into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -144,27 +152,27 @@ internal SystemData(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("CreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); } if (content.Contains("CreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).CreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).CreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).CreatedByType, global::System.Convert.ToString); } if (content.Contains("CreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Models.Api50.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); } if (content.Contains("LastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).LastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).LastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).LastModifiedByType, global::System.Convert.ToString); } if (content.Contains("LastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); } @@ -173,6 +181,18 @@ internal SystemData(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Metadata pertaining to creation and last modification of the resource. [System.ComponentModel.TypeConverter(typeof(SystemDataTypeConverter))] diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/SystemData.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/SystemData.TypeConverter.cs similarity index 97% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/SystemData.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/SystemData.TypeConverter.cs index b518c05c3f62..3d9e565b154e 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/SystemData.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/SystemData.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -105,14 +105,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/SystemData.cs b/generated/Portal/Portal.Autorest/generated/api/Models/SystemData.cs similarity index 78% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/SystemData.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/SystemData.cs index e8ca15510c0d..eb8ea357b91e 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/SystemData.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/SystemData.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// Metadata pertaining to creation and last modification of the resource. public partial class SystemData : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemDataInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemDataInternal { /// Backing field for property. @@ -28,11 +28,11 @@ public partial class SystemData : public string CreatedBy { get => this._createdBy; set => this._createdBy = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? _createdByType; + private string _createdByType; /// The type of identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? CreatedByType { get => this._createdByType; set => this._createdByType = value; } + public string CreatedByType { get => this._createdByType; set => this._createdByType = value; } /// Backing field for property. private global::System.DateTime? _lastModifiedAt; @@ -49,11 +49,11 @@ public partial class SystemData : public string LastModifiedBy { get => this._lastModifiedBy; set => this._lastModifiedBy = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? _lastModifiedByType; + private string _lastModifiedByType; /// The type of identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? LastModifiedByType { get => this._lastModifiedByType; set => this._lastModifiedByType = value; } + public string LastModifiedByType { get => this._lastModifiedByType; set => this._lastModifiedByType = value; } /// Creates an new instance. public SystemData() @@ -69,6 +69,9 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The timestamp of resource creation (UTC).", SerializedName = @"createdAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -77,6 +80,9 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The identity that created the resource.", SerializedName = @"createdBy", PossibleTypes = new [] { typeof(string) })] @@ -85,14 +91,21 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The type of identity that created the resource.", SerializedName = @"createdByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? CreatedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string CreatedByType { get; set; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The timestamp of resource last modification (UTC)", SerializedName = @"lastModifiedAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -101,6 +114,9 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The identity that last modified the resource.", SerializedName = @"lastModifiedBy", PossibleTypes = new [] { typeof(string) })] @@ -109,10 +125,14 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The type of identity that last modified the resource.", SerializedName = @"lastModifiedByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? LastModifiedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string LastModifiedByType { get; set; } } /// Metadata pertaining to creation and last modification of the resource. @@ -124,13 +144,15 @@ internal partial interface ISystemDataInternal /// The identity that created the resource. string CreatedBy { get; set; } /// The type of identity that created the resource. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? CreatedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string 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.Portal.Support.CreatedByType? LastModifiedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string LastModifiedByType { get; set; } } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/SystemData.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/SystemData.json.cs similarity index 93% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/SystemData.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/SystemData.json.cs index de5f7ba23efe..a88839a3be2e 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/SystemData.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/SystemData.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -54,13 +54,11 @@ public partial class SystemData partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData. + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new SystemData(json) : null; } @@ -77,12 +75,12 @@ internal SystemData(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonO { 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;} + {_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); } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResource.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResource.PowerShell.cs similarity index 57% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResource.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/TrackedResource.PowerShell.cs index cfd9ccd5f2b2..64b4f972ce72 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResource.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResource.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -57,27 +57,35 @@ public partial class TrackedResource partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResource DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new TrackedResource(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new TrackedResource(content); } @@ -87,15 +95,27 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedRes /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -110,57 +130,57 @@ internal TrackedResource(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.TrackedResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.TrackedResourceTagsTypeConverter.ConvertFrom); } if (content.Contains("Location")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Models.Api50.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.SystemDataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.SystemDataTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -175,51 +195,51 @@ internal TrackedResource(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Tag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.TrackedResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.TrackedResourceTagsTypeConverter.ConvertFrom); } if (content.Contains("Location")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Models.Api50.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.SystemDataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.SystemDataTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } AfterDeserializePSObject(content); } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResource.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResource.TypeConverter.cs similarity index 97% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResource.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/TrackedResource.TypeConverter.cs index 1e8b0e7b0276..401608400224 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResource.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResource.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResource ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResource ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResource).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResource).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResource.cs b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResource.cs similarity index 54% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResource.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/TrackedResource.cs index 657f73829d59..1a06374aeec7 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResource.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResource.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -11,20 +11,20 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 /// 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.Portal.Models.Api50.ITrackedResource, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResource, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceInternal, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IValidates { /// - /// Backing field for Inherited model + /// Backing field for Inherited model /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.Resource(); + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Resource(); /// /// Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" /// [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).Id; } + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).Id; } /// Backing field for property. private string _location; @@ -34,63 +34,81 @@ public partial class TrackedResource : public string Location { get => this._location; set => this._location = value; } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).Id = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).Id = value; } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).Name = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).Name = value; } /// Internal Acessors for SystemData - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemData = value; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemData = value; } + + /// Internal Acessors for SystemDataCreatedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataCreatedAt = value; } + + /// Internal Acessors for SystemDataCreatedBy + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataCreatedBy = value; } + + /// Internal Acessors for SystemDataCreatedByType + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataCreatedByType = value; } + + /// Internal Acessors for SystemDataLastModifiedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataLastModifiedAt = value; } + + /// Internal Acessors for SystemDataLastModifiedBy + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataLastModifiedBy = value; } + + /// Internal Acessors for SystemDataLastModifiedByType + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataLastModifiedByType = value; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).Type = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).Type = value; } /// The name of the resource [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).Name; } + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).Name; } /// /// Azure Resource Manager metadata containing createdBy and modifiedBy information. /// [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemData; } + internal Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemData = value ?? null /* model class */; } /// The timestamp of resource creation (UTC). [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataCreatedAt; } /// The identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataCreatedBy; } /// The type of identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType)""); } + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataCreatedByType; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataLastModifiedAt; } /// The identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataLastModifiedBy; } /// The type of identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType)""); } + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).SystemDataLastModifiedByType; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags _tag; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags _tag; /// Resource tags. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.TrackedResourceTags()); set => this._tag = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.TrackedResourceTags()); set => this._tag = value; } /// /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" /// [Microsoft.Azure.PowerShell.Cmdlets.Portal.Origin(Microsoft.Azure.PowerShell.Cmdlets.Portal.PropertyOrigin.Inherited)] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResourceInternal)__resource).Type; } + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal)__resource).Type; } /// Creates an new instance. public TrackedResource() @@ -113,12 +131,15 @@ public TrackedResource() /// 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.Portal.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IResource + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResource { /// The geo-location where the resource lives [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( - Required = true, + Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = false, Description = @"The geo-location where the resource lives", SerializedName = @"location", PossibleTypes = new [] { typeof(string) })] @@ -127,20 +148,23 @@ public partial interface ITrackedResource : [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource tags.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags) })] - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags Tag { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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.Portal.Models.Api50.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IResourceInternal { /// The geo-location where the resource lives string Location { get; set; } /// Resource tags. - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags Tag { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags Tag { get; set; } } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResource.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResource.json.cs similarity index 87% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResource.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/TrackedResource.json.cs index 9b67a4fb2fc0..6a19ddfdd88f 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResource.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResource.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -56,13 +56,13 @@ public partial class TrackedResource partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResource. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResource. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResource. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResource. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new TrackedResource(json) : null; } @@ -88,7 +88,10 @@ public Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode ToJson(Mi } __resource?.ToJson(container, serializationMode); AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); - AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeRead)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + } AfterToJson(ref container); return container; } @@ -105,9 +108,9 @@ internal TrackedResource(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json. { return; } - __resource = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.Resource(json); - {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.TrackedResourceTags.FromJson(__jsonTags) : Tag;} - {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Resource(json); + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.TrackedResourceTags.FromJson(__jsonTags) : _tag;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)_location;} AfterFromJson(json); } } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.PowerShell.cs b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.PowerShell.cs similarity index 81% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.PowerShell.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.PowerShell.cs index 9d35c51fc55c..090851d08ccc 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.PowerShell.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -55,27 +55,35 @@ public partial class TrackedResourceTags partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new TrackedResourceTags(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new TrackedResourceTags(content); } @@ -85,15 +93,27 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedRes /// /// a string containing a JSON serialized instance of this model. /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(jsonText)); + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.SerializationMode.IncludeAll)?.ToString(); + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -112,7 +132,7 @@ internal TrackedResourceTags(global::System.Collections.IDictionary content) } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.TypeConverter.cs similarity index 97% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.TypeConverter.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.TypeConverter.cs index 48cd43683c52..f674af99581d 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.TypeConverter.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; @@ -106,14 +106,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags).IsAssignableFrom(type)) { return sourceValue; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.cs b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.cs similarity index 80% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.cs index 43e511b43f74..9969e00be568 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; /// Resource tags. public partial class TrackedResourceTags : - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTagsInternal + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTagsInternal { /// Creates an new instance. diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.dictionary.cs b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.dictionary.cs similarity index 95% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.dictionary.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.dictionary.cs index b81acf07694d..4e8cf5482685 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.dictionary.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.dictionary.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -70,6 +70,6 @@ public void CopyFrom(global::System.Management.Automation.PSObject source) /// - public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.TrackedResourceTags source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.TrackedResourceTags source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.json.cs b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.json.cs similarity index 95% rename from generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.json.cs rename to generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.json.cs index 14423aef271a..52cf6474de10 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Models/Api50/TrackedResourceTags.json.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Models/TrackedResourceTags.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50 +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; @@ -54,13 +54,13 @@ public partial class TrackedResourceTags partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonObject json ? new TrackedResourceTags(json) : null; } diff --git a/generated/Portal/Portal.Autorest/generated/api/Portal.cs b/generated/Portal/Portal.Autorest/generated/api/Portal.cs index 0ff59f391728..57ef37df2788 100644 --- a/generated/Portal/Portal.Autorest/generated/api/Portal.cs +++ b/generated/Portal/Portal.Autorest/generated/api/Portal.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal public partial class Portal { - /// Creates or updates a Dashboard. + /// update a Dashboard. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the dashboard. @@ -25,10 +25,11 @@ public partial class Portal /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DashboardsCreateOrUpdate(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DashboardsCreateOrUpdate(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2022-12-01-preview"; // Constant Parameters @@ -55,15 +56,15 @@ public partial class Portal await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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 = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).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.Portal.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DashboardsCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + await this.DashboardsCreateOrUpdate_Call (request, onOk,onCreated,onDefault,eventListener,sender); } } - /// Creates or updates a Dashboard. + /// update a Dashboard. /// /// The parameters required to create or update a dashboard. /// a delegate that is called when the remote service returns 200 (OK). @@ -72,10 +73,11 @@ public partial class Portal /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DashboardsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DashboardsCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2022-12-01-preview"; // Constant Parameters @@ -114,114 +116,132 @@ public partial class Portal await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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 = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).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.Portal.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DashboardsCreateOrUpdate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + await this.DashboardsCreateOrUpdate_Call (request, onOk,onCreated,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 201 (Created). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// update a Dashboard. + /// + /// The parameters required to create or update a dashboard. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A that + /// will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task DashboardsCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DashboardsCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard body, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeUpdate) { + var apiVersion = @"2022-12-01-preview"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + // verify that Identity format is an exact match for uri - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.Dashboard.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - case global::System.Net.HttpStatusCode.Created: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.Dashboard.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Portal/dashboards/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}'"); } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var dashboardName = _match.Groups["dashboardName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Portal/dashboards/" + + dashboardName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // 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.Portal.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).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.Portal.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DashboardsCreateOrUpdateWithResult_Call (request, eventListener,sender); } } - /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. - /// + /// update a Dashboard. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the dashboard. - /// The parameters required to create or update a dashboard. + /// Json string supplied to the DashboardsCreateOrUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// 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.Portal.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 DashboardsCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard body, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener) + public async global::System.Threading.Tasks.Task DashboardsCreateOrUpdateViaJsonString(string subscriptionId, string resourceGroupName, string dashboardName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { + var apiVersion = @"2022-12-01-preview"; + // Constant Parameters using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); - await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"); - await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); - await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); - await eventListener.AssertNotNull(nameof(dashboardName),dashboardName); - await eventListener.AssertMinimumLength(nameof(dashboardName),dashboardName,3); - await eventListener.AssertMaximumLength(nameof(dashboardName),dashboardName,64); - await eventListener.AssertRegEx(nameof(dashboardName),dashboardName,@"^[a-zA-Z0-9-]{3,24}$"); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Portal/dashboards/" + + global::System.Uri.EscapeDataString(dashboardName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, 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.Portal.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DashboardsCreateOrUpdate_Call (request, onOk,onCreated,onDefault,eventListener,sender); } } - /// Deletes the Dashboard. + /// update a Dashboard. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the dashboard. - /// 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). + /// Json string supplied to the DashboardsCreateOrUpdate operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that + /// will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DashboardsDelete(string subscriptionId, string resourceGroupName, string dashboardName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DashboardsCreateOrUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string dashboardName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { var apiVersion = @"2022-12-01-preview"; // Constant Parameters @@ -239,77 +259,140 @@ public partial class Portal + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // 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.Portal.Runtime.Method.Delete, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, 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.Portal.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.DashboardsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + return await this.DashboardsCreateOrUpdateWithResult_Call (request, eventListener,sender); } } - /// Deletes the Dashboard. - /// - /// 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). + /// update a Dashboard. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the dashboard. + /// The parameters required to create or update a dashboard. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A that + /// will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DashboardsDeleteViaIdentity(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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DashboardsCreateOrUpdateWithResult(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard body, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2022-12-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.Portal/dashboards/(?[^/]+)$", 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.Portal/dashboards/{dashboardName}'"); - } - - // replace URI parameters with values from identity - var subscriptionId = _match.Groups["subscriptionId"].Value; - var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var dashboardName = _match.Groups["dashboardName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + subscriptionId + + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" - + resourceGroupName + + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.Portal/dashboards/" - + dashboardName + + global::System.Uri.EscapeDataString(dashboardName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // 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.Portal.Runtime.Method.Delete, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).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.Portal.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.DashboardsDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + return await this.DashboardsCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.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 DashboardsCreateOrUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Dashboard.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Dashboard.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } - /// Actual wire call for method. + /// 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 201 (Created). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -317,7 +400,7 @@ public partial class Portal /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task DashboardsDelete_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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task DashboardsCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -328,6 +411,7 @@ public partial class Portal await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -335,19 +419,19 @@ public partial class Portal case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Dashboard.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } - case global::System.Net.HttpStatusCode.NoContent: + case global::System.Net.HttpStatusCode.Created: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Dashboard.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -363,17 +447,18 @@ public partial class Portal } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the dashboard. + /// The parameters required to create or update a dashboard. /// 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 DashboardsDelete_Validate(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task DashboardsCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard body, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -385,15 +470,18 @@ public partial class Portal await eventListener.AssertNotNull(nameof(dashboardName),dashboardName); await eventListener.AssertMinimumLength(nameof(dashboardName),dashboardName,3); await eventListener.AssertMaximumLength(nameof(dashboardName),dashboardName,64); - await eventListener.AssertRegEx(nameof(dashboardName),dashboardName,@"^[a-zA-Z0-9-]{3,24}$"); + await eventListener.AssertRegEx(nameof(dashboardName), dashboardName, @"^[a-zA-Z0-9-]{3,24}$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Gets the Dashboard. + /// Deletes the Dashboard. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the dashboard. /// 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. @@ -401,7 +489,7 @@ public partial class Portal /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DashboardsGet(string subscriptionId, string resourceGroupName, string dashboardName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DashboardsDelete(string subscriptionId, string resourceGroupName, string dashboardName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { var apiVersion = @"2022-12-01-preview"; // Constant Parameters @@ -423,18 +511,19 @@ public partial class Portal // 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.Portal.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DashboardsGet_Call(request,onOk,onDefault,eventListener,sender); + await this.DashboardsDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); } } - /// Gets the Dashboard. + /// Deletes the Dashboard. /// /// 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. @@ -442,7 +531,7 @@ public partial class Portal /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DashboardsGetViaIdentity(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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DashboardsDeleteViaIdentity(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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { var apiVersion = @"2022-12-01-preview"; // Constant Parameters @@ -476,18 +565,19 @@ public partial class Portal // 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.Portal.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DashboardsGet_Call(request,onOk,onDefault,eventListener,sender); + await this.DashboardsDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -495,7 +585,7 @@ public partial class Portal /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task DashboardsGet_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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task DashboardsDelete_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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -506,6 +596,7 @@ public partial class Portal await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -513,13 +604,19 @@ public partial class Portal case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.Dashboard.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -535,7 +632,7 @@ public partial class Portal } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// /// The ID of the target subscription. The value must be an UUID. @@ -545,7 +642,7 @@ public partial class Portal /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task DashboardsGet_Validate(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task DashboardsDelete_Validate(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -557,13 +654,14 @@ public partial class Portal await eventListener.AssertNotNull(nameof(dashboardName),dashboardName); await eventListener.AssertMinimumLength(nameof(dashboardName),dashboardName,3); await eventListener.AssertMaximumLength(nameof(dashboardName),dashboardName,64); - await eventListener.AssertRegEx(nameof(dashboardName),dashboardName,@"^[a-zA-Z0-9-]{3,24}$"); + await eventListener.AssertRegEx(nameof(dashboardName), dashboardName, @"^[a-zA-Z0-9-]{3,24}$"); } } - /// Gets all the Dashboards within a resource group. + /// Gets the Dashboard. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. + /// The name of the dashboard. /// 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). @@ -572,7 +670,7 @@ public partial class Portal /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DashboardsListByResourceGroup(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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DashboardsGet(string subscriptionId, string resourceGroupName, string dashboardName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { var apiVersion = @"2022-12-01-preview"; // Constant Parameters @@ -584,7 +682,8 @@ public partial class Portal + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Portal/dashboards" + + "/providers/Microsoft.Portal/dashboards/" + + global::System.Uri.EscapeDataString(dashboardName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -598,11 +697,11 @@ public partial class Portal await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DashboardsListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + await this.DashboardsGet_Call (request, onOk,onDefault,eventListener,sender); } } - /// Gets all the Dashboards within a resource group. + /// Gets the Dashboard. /// /// 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 @@ -612,7 +711,7 @@ public partial class Portal /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DashboardsListByResourceGroupViaIdentity(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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DashboardsGetViaIdentity(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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { var apiVersion = @"2022-12-01-preview"; // Constant Parameters @@ -620,22 +719,24 @@ public partial class Portal { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Portal/dashboards$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Portal/dashboards/(?[^/]+)$", 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.Portal/dashboards'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var dashboardName = _match.Groups["dashboardName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Portal/dashboards" + + "/providers/Microsoft.Portal/dashboards/" + + dashboardName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -649,11 +750,163 @@ public partial class Portal await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DashboardsListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + await this.DashboardsGet_Call (request, onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Gets the Dashboard. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.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 DashboardsGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-12-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.Portal/dashboards/(?[^/]+)$", 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.Portal/dashboards/{dashboardName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var dashboardName = _match.Groups["dashboardName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Portal/dashboards/" + + dashboardName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // 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.Portal.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DashboardsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Gets the Dashboard. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the dashboard. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.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 DashboardsGetWithResult(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-12-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.Portal/dashboards/" + + global::System.Uri.EscapeDataString(dashboardName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // 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.Portal.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DashboardsGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.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 DashboardsGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Dashboard.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// 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 @@ -663,7 +916,7 @@ public partial class Portal /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task DashboardsListByResourceGroup_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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task DashboardsGet_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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -674,6 +927,7 @@ public partial class Portal await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -681,13 +935,13 @@ public partial class Portal case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Dashboard.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -703,16 +957,17 @@ public partial class Portal } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. + /// The name of the dashboard. /// 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 DashboardsListByResourceGroup_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task DashboardsGet_Validate(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -721,11 +976,16 @@ public partial class Portal await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(dashboardName),dashboardName); + await eventListener.AssertMinimumLength(nameof(dashboardName),dashboardName,3); + await eventListener.AssertMaximumLength(nameof(dashboardName),dashboardName,64); + await eventListener.AssertRegEx(nameof(dashboardName), dashboardName, @"^[a-zA-Z0-9-]{3,24}$"); } } - /// Gets all the dashboards within a subscription. + /// Gets all the Dashboards within a resource group. /// The ID of the target subscription. The value must be an UUID. + /// 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). @@ -734,7 +994,7 @@ public partial class Portal /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DashboardsListBySubscription(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DashboardsListByResourceGroup(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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { var apiVersion = @"2022-12-01-preview"; // Constant Parameters @@ -744,6 +1004,8 @@ public partial class Portal var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.Portal/dashboards" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) @@ -758,12 +1020,751 @@ public partial class Portal await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DashboardsListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + await this.DashboardsListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); } } - /// Gets all the dashboards within a subscription. + /// Gets all the Dashboards within a resource group. + /// + /// 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.Portal.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 DashboardsListByResourceGroupViaIdentity(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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-12-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.Portal/dashboards$", 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.Portal/dashboards'"); + } + + // 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.Portal/dashboards" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DashboardsListByResourceGroup_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Gets all the Dashboards within a resource group. /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.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 DashboardsListByResourceGroupViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-12-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.Portal/dashboards$", 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.Portal/dashboards'"); + } + + // 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.Portal/dashboards" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // 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.Portal.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DashboardsListByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// Gets all the Dashboards within a resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.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 DashboardsListByResourceGroupWithResult(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-12-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.Portal/dashboards" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // 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.Portal.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DashboardsListByResourceGroupWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.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 DashboardsListByResourceGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// 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.Portal.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 DashboardsListByResourceGroup_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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Progress, "intentional placeholder", 100); 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.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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 value must be an UUID. + /// 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 DashboardsListByResourceGroup_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + } + } + + /// Gets all the dashboards within a subscription. + /// The ID of the target subscription. The value must be an UUID. + /// 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.Portal.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 DashboardsListBySubscription(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-12-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Portal/dashboards" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DashboardsListBySubscription_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Gets all the dashboards within a 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.Portal.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 DashboardsListBySubscriptionViaIdentity(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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-12-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.Portal/dashboards$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Portal/dashboards'"); + } + + // 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.Portal/dashboards" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DashboardsListBySubscription_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Gets all the dashboards within a subscription. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.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 DashboardsListBySubscriptionViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-12-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.Portal/dashboards$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Portal/dashboards'"); + } + + // 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.Portal/dashboards" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // 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.Portal.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DashboardsListBySubscriptionWithResult_Call (request, eventListener,sender); + } + } + + /// Gets all the dashboards within a subscription. + /// The ID of the target subscription. The value must be an UUID. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.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 DashboardsListBySubscriptionWithResult(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-12-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Portal/dashboards" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // 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.Portal.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DashboardsListBySubscriptionWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.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 DashboardsListBySubscriptionWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// 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.Portal.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 DashboardsListBySubscription_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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Progress, "intentional placeholder", 100); 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.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.DashboardListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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 value must be an UUID. + /// 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 DashboardsListBySubscription_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"); + } + } + + /// update an existing Dashboard. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the dashboard. + /// The updatable fields of a Dashboard. + /// 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.Portal.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DashboardsUpdate(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2022-12-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.Portal/dashboards/" + + global::System.Uri.EscapeDataString(dashboardName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).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.Portal.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DashboardsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an existing Dashboard. + /// + /// The updatable fields of a Dashboard. + /// 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.Portal.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DashboardsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2022-12-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.Portal/dashboards/(?[^/]+)$", 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.Portal/dashboards/{dashboardName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var dashboardName = _match.Groups["dashboardName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Portal/dashboards/" + + dashboardName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).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.Portal.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.DashboardsUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// update an existing Dashboard. + /// + /// The updatable fields of a Dashboard. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that + /// will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DashboardsUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard body, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2022-12-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.Portal/dashboards/(?[^/]+)$", 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.Portal/dashboards/{dashboardName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var dashboardName = _match.Groups["dashboardName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Portal/dashboards/" + + dashboardName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // 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.Portal.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).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.Portal.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.DashboardsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// update an existing Dashboard. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the dashboard. + /// Json string supplied to the DashboardsUpdate 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). @@ -772,27 +1773,20 @@ public partial class Portal /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DashboardsListBySubscriptionViaIdentity(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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DashboardsUpdateViaJsonString(string subscriptionId, string resourceGroupName, string dashboardName, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { var apiVersion = @"2022-12-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.Portal/dashboards$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Portal/dashboards'"); - } - - // 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.Portal/dashboards" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Portal/dashboards/" + + global::System.Uri.EscapeDataString(dashboardName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -801,96 +1795,31 @@ public partial class Portal // 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.Portal.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, 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.Portal.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.DashboardsListBySubscription_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.Portal.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 DashboardsListBySubscription_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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.DashboardListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally - { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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 value must be an UUID. - /// 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 DashboardsListBySubscription_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); - await eventListener.AssertRegEx(nameof(subscriptionId),subscriptionId,@"^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"); + await this.DashboardsUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Updates an existing Dashboard. + /// update an existing Dashboard. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the dashboard. - /// The updatable fields of a Dashboard. - /// 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). + /// Json string supplied to the DashboardsUpdate operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that + /// will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DashboardsUpdate(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboard body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DashboardsUpdateViaJsonStringWithResult(string subscriptionId, string resourceGroupName, string dashboardName, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { var apiVersion = @"2022-12-01-preview"; // Constant Parameters @@ -908,82 +1837,131 @@ public partial class Portal + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // 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.Portal.Runtime.Method.Patch, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(jsonString, 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.Portal.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.DashboardsUpdate_Call(request,onOk,onDefault,eventListener,sender); + return await this.DashboardsUpdateWithResult_Call (request, eventListener,sender); } } - /// Updates an existing Dashboard. - /// + /// update an existing Dashboard. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the dashboard. /// The updatable fields of a Dashboard. - /// 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.Portal.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A that + /// will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task DashboardsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboard body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DashboardsUpdateWithResult(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard body, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeUpdate) { var apiVersion = @"2022-12-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.Portal/dashboards/(?[^/]+)$", 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.Portal/dashboards/{dashboardName}'"); - } - - // replace URI parameters with values from identity - var subscriptionId = _match.Groups["subscriptionId"].Value; - var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var dashboardName = _match.Groups["dashboardName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" - + subscriptionId + + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" - + resourceGroupName + + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.Portal/dashboards/" - + dashboardName + + global::System.Uri.EscapeDataString(dashboardName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // 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.Portal.Runtime.Method.Patch, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).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.Portal.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.DashboardsUpdate_Call(request,onOk,onDefault,eventListener,sender); + return await this.DashboardsUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.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 DashboardsUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Dashboard.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } - /// Actual wire call for method. + /// 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 @@ -993,7 +1971,7 @@ public partial class Portal /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task DashboardsUpdate_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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task DashboardsUpdate_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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1004,6 +1982,7 @@ public partial class Portal await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1011,13 +1990,13 @@ public partial class Portal case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.Dashboard.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Dashboard.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1044,7 +2023,7 @@ public partial class Portal /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task DashboardsUpdate_Validate(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboard body, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task DashboardsUpdate_Validate(string subscriptionId, string resourceGroupName, string dashboardName, Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard body, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -1056,7 +2035,7 @@ public partial class Portal await eventListener.AssertNotNull(nameof(dashboardName),dashboardName); await eventListener.AssertMinimumLength(nameof(dashboardName),dashboardName,3); await eventListener.AssertMaximumLength(nameof(dashboardName),dashboardName,64); - await eventListener.AssertRegEx(nameof(dashboardName),dashboardName,@"^[a-zA-Z0-9-]{3,24}$"); + await eventListener.AssertRegEx(nameof(dashboardName), dashboardName, @"^[a-zA-Z0-9-]{3,24}$"); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } @@ -1071,7 +2050,7 @@ public partial class Portal /// /// 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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + 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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { var apiVersion = @"2022-12-01-preview"; // Constant Parameters @@ -1093,7 +2072,7 @@ public partial class Portal await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + await this.OperationsList_Call (request, onOk,onDefault,eventListener,sender); } } @@ -1107,7 +2086,7 @@ public partial class Portal /// /// 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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + 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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { var apiVersion = @"2022-12-01-preview"; // Constant Parameters @@ -1138,11 +2117,147 @@ public partial class Portal await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + await this.OperationsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List the operations for the provider + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.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 OperationsListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-12-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.Portal/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Portal/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Portal/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // 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.Portal.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.OperationsListWithResult_Call (request, eventListener,sender); + } + } + + /// List the operations for the provider + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.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 OperationsListWithResult(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + { + var apiVersion = @"2022-12-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Portal/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // 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.Portal.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.OperationsListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Portal.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 OperationsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.OperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } - /// Actual wire call for method. + /// 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 @@ -1152,7 +2267,7 @@ public partial class Portal /// /// 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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) + 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.Portal.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1163,6 +2278,7 @@ public partial class Portal await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1170,13 +2286,13 @@ public partial class Portal case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.OperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.OperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } diff --git a/generated/Portal/Portal.Autorest/generated/api/Support/ActionType.Completer.cs b/generated/Portal/Portal.Autorest/generated/api/Support/ActionType.Completer.cs deleted file mode 100644 index 837a60dfcb84..000000000000 --- a/generated/Portal/Portal.Autorest/generated/api/Support/ActionType.Completer.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Support -{ - - /// - /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - /// - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.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/generated/Portal/Portal.Autorest/generated/api/Support/ActionType.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Support/ActionType.TypeConverter.cs deleted file mode 100644 index 07709f392856..000000000000 --- a/generated/Portal/Portal.Autorest/generated/api/Support/ActionType.TypeConverter.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.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/generated/Portal/Portal.Autorest/generated/api/Support/ActionType.cs b/generated/Portal/Portal.Autorest/generated/api/Support/ActionType.cs deleted file mode 100644 index 7b7ae904ef2c..000000000000 --- a/generated/Portal/Portal.Autorest/generated/api/Support/ActionType.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.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.Portal.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.Portal.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.Portal.Support.ActionType e1, Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Support.ActionType e1, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ActionType e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Support/CreatedByType.Completer.cs b/generated/Portal/Portal.Autorest/generated/api/Support/CreatedByType.Completer.cs deleted file mode 100644 index 17b2d74201a4..000000000000 --- a/generated/Portal/Portal.Autorest/generated/api/Support/CreatedByType.Completer.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Support -{ - - /// The type of identity that created the resource. - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.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/generated/Portal/Portal.Autorest/generated/api/Support/CreatedByType.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Support/CreatedByType.TypeConverter.cs deleted file mode 100644 index b186bda96287..000000000000 --- a/generated/Portal/Portal.Autorest/generated/api/Support/CreatedByType.TypeConverter.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.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/generated/Portal/Portal.Autorest/generated/api/Support/CreatedByType.cs b/generated/Portal/Portal.Autorest/generated/api/Support/CreatedByType.cs deleted file mode 100644 index 91235b0bb7e1..000000000000 --- a/generated/Portal/Portal.Autorest/generated/api/Support/CreatedByType.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Support -{ - - /// The type of identity that created the resource. - public partial struct CreatedByType : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType Application = @"Application"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType Key = @"Key"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType ManagedIdentity = @"ManagedIdentity"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.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.Portal.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.Portal.Support.CreatedByType e1, Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Support.CreatedByType e1, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.CreatedByType e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Support/Origin.Completer.cs b/generated/Portal/Portal.Autorest/generated/api/Support/Origin.Completer.cs deleted file mode 100644 index 14ae99f24896..000000000000 --- a/generated/Portal/Portal.Autorest/generated/api/Support/Origin.Completer.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.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/generated/Portal/Portal.Autorest/generated/api/Support/Origin.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Support/Origin.TypeConverter.cs deleted file mode 100644 index 1614d6f26156..000000000000 --- a/generated/Portal/Portal.Autorest/generated/api/Support/Origin.TypeConverter.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.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/generated/Portal/Portal.Autorest/generated/api/Support/Origin.cs b/generated/Portal/Portal.Autorest/generated/api/Support/Origin.cs deleted file mode 100644 index 984d4ef3f612..000000000000 --- a/generated/Portal/Portal.Autorest/generated/api/Support/Origin.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Support.Origin System = @"system"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.Origin User = @"user"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.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.Portal.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.Portal.Support.Origin e1, Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Support.Origin e1, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.Origin e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/api/Support/ResourceProvisioningState.Completer.cs b/generated/Portal/Portal.Autorest/generated/api/Support/ResourceProvisioningState.Completer.cs deleted file mode 100644 index 4d3e1f6290ad..000000000000 --- a/generated/Portal/Portal.Autorest/generated/api/Support/ResourceProvisioningState.Completer.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Support -{ - - /// The provisioning state of a resource type. - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningStateTypeConverter))] - public partial struct ResourceProvisioningState : - 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) || "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/generated/Portal/Portal.Autorest/generated/api/Support/ResourceProvisioningState.TypeConverter.cs b/generated/Portal/Portal.Autorest/generated/api/Support/ResourceProvisioningState.TypeConverter.cs deleted file mode 100644 index 8a71466eb5d7..000000000000 --- a/generated/Portal/Portal.Autorest/generated/api/Support/ResourceProvisioningState.TypeConverter.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Support -{ - - /// The provisioning state of a resource type. - public partial class ResourceProvisioningStateTypeConverter : - 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) => ResourceProvisioningState.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/generated/Portal/Portal.Autorest/generated/api/Support/ResourceProvisioningState.cs b/generated/Portal/Portal.Autorest/generated/api/Support/ResourceProvisioningState.cs deleted file mode 100644 index ea8398f6fd26..000000000000 --- a/generated/Portal/Portal.Autorest/generated/api/Support/ResourceProvisioningState.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Support -{ - - /// The provisioning state of a resource type. - public partial struct ResourceProvisioningState : - System.IEquatable - { - /// Resource creation was canceled. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState Canceled = @"Canceled"; - - /// Resource creation failed. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState Failed = @"Failed"; - - /// Resource has been created. - public static Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState Succeeded = @"Succeeded"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to ResourceProvisioningState - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new ResourceProvisioningState(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type ResourceProvisioningState - /// 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.Portal.Support.ResourceProvisioningState e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type ResourceProvisioningState (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 ResourceProvisioningState && Equals((ResourceProvisioningState)obj); - } - - /// Returns hashCode for enum ResourceProvisioningState - /// 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 ResourceProvisioningState(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Returns string representation for ResourceProvisioningState - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to ResourceProvisioningState - /// the value to convert to an instance of . - - public static implicit operator ResourceProvisioningState(string value) - { - return new ResourceProvisioningState(value); - } - - /// Implicit operator to convert ResourceProvisioningState to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState e) - { - return e._value; - } - - /// Overriding != operator for enum ResourceProvisioningState - /// 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.Portal.Support.ResourceProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum ResourceProvisioningState - /// 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.Portal.Support.ResourceProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.Portal.Support.ResourceProvisioningState e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_Get.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_Get.cs index faa0b30efe4c..9b99f5909092 100644 --- a/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_Get.cs +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_Get.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; using System; /// Gets the Dashboard. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPortalDashboard_Get")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"Gets the Dashboard.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] public partial class GetAzPortalDashboard_Get : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,11 +37,26 @@ public partial class GetAzPortalDashboard_Get : global::System.Management.Automa /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.ClientAPI; @@ -52,6 +70,9 @@ public partial class GetAzPortalDashboard_Get : global::System.Management.Automa [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// 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] @@ -93,7 +114,7 @@ public partial class GetAzPortalDashboard_Get : global::System.Management.Automa /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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")] @@ -139,7 +160,8 @@ public partial class GetAzPortalDashboard_Get : global::System.Management.Automa [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -148,24 +170,24 @@ public partial class GetAzPortalDashboard_Get : global::System.Management.Automa /// 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); + 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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); + 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) @@ -188,6 +210,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -209,7 +236,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzPortalDashboard_Get() { @@ -260,8 +287,33 @@ public GetAzPortalDashboard_Get() 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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -314,7 +366,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -335,7 +387,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.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}) + 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 } }); @@ -373,12 +425,12 @@ protected override void 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -395,15 +447,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + 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 } }); @@ -413,12 +465,12 @@ protected override void StopProcessing() /// 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -430,8 +482,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_GetViaIdentity.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_GetViaIdentity.cs index 3fb7af33ed54..df483c4c63fb 100644 --- a/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_GetViaIdentity.cs +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_GetViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; using System; /// Gets the Dashboard. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPortalDashboard_GetViaIdentity")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"Gets the Dashboard.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] public partial class GetAzPortalDashboard_GetViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,11 +37,26 @@ public partial class GetAzPortalDashboard_GetViaIdentity : global::System.Manage /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.ClientAPI; @@ -52,6 +70,9 @@ public partial class GetAzPortalDashboard_GetViaIdentity : global::System.Manage [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// 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] @@ -86,7 +107,7 @@ public partial class GetAzPortalDashboard_GetViaIdentity : global::System.Manage /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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")] @@ -109,24 +130,24 @@ public partial class GetAzPortalDashboard_GetViaIdentity : global::System.Manage /// 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); + 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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); + 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) @@ -149,6 +170,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -170,7 +196,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzPortalDashboard_GetViaIdentity() { @@ -221,8 +247,33 @@ public GetAzPortalDashboard_GetViaIdentity() 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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -275,7 +326,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -313,7 +364,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + 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 } }); @@ -351,12 +402,12 @@ protected override void 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -373,7 +424,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 } @@ -391,12 +442,12 @@ protected override void StopProcessing() /// 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -408,8 +459,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_List.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_List.cs index 84152e412e2d..7b37da692634 100644 --- a/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_List.cs +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; using System; /// Gets all the dashboards within a subscription. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets /// [OpenAPI] ListBySubscription=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Portal/dashboards" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPortalDashboard_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"Gets all the dashboards within a subscription.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.Portal/dashboards", ApiVersion = "2022-12-01-preview")] public partial class GetAzPortalDashboard_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,17 +37,32 @@ public partial class GetAzPortalDashboard_List : global::System.Management.Autom /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// A flag to tell whether it is the first onOK call. private bool _isFirst = true; /// Link to retrieve next page. private string _nextLink; + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.ClientAPI; @@ -58,6 +76,9 @@ public partial class GetAzPortalDashboard_List : global::System.Management.Autom [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// 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] @@ -84,7 +105,7 @@ public partial class GetAzPortalDashboard_List : global::System.Management.Autom /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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")] @@ -116,7 +137,8 @@ public partial class GetAzPortalDashboard_List : global::System.Management.Autom [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -125,24 +147,24 @@ public partial class GetAzPortalDashboard_List : global::System.Management.Autom /// 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); + 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.Portal.Models.Api20221201Preview.IDashboardListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult /// 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); + 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) @@ -165,6 +187,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -186,7 +213,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzPortalDashboard_List() { @@ -237,8 +264,33 @@ public GetAzPortalDashboard_List() 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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -291,7 +343,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -312,7 +364,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + 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 } }); @@ -350,12 +402,12 @@ protected override void 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -372,15 +424,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 { SubscriptionId=SubscriptionId }) + 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 } }); @@ -390,12 +442,12 @@ protected override void StopProcessing() /// 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.Portal.Models.Api20221201Preview.IDashboardListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult /// 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) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -407,15 +459,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult + var result = (await response); // response should be returning an array of some kind. +Pageable // pageable / value / nextLink - var result = await response; - WriteObject(result.Value,true); + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } _nextLink = result.NextLink; if (_isFirst) { _isFirst = false; - while (_nextLink != null) + while (!String.IsNullOrEmpty(_nextLink)) { if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) { diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_List1.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_List1.cs index 84c4c1badfa6..2a79beda863e 100644 --- a/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_List1.cs +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalDashboard_List1.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; using System; /// Gets all the Dashboards within a resource group. @@ -13,12 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets /// [OpenAPI] ListByResourceGroup=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPortalDashboard_List1")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"Gets all the Dashboards within a resource group.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards", ApiVersion = "2022-12-01-preview")] public partial class GetAzPortalDashboard_List1 : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,17 +37,32 @@ public partial class GetAzPortalDashboard_List1 : global::System.Management.Auto /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// A flag to tell whether it is the first onOK call. private bool _isFirst = true; /// Link to retrieve next page. private string _nextLink; + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.ClientAPI; @@ -58,6 +76,9 @@ public partial class GetAzPortalDashboard_List1 : global::System.Management.Auto [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// 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] @@ -84,7 +105,7 @@ public partial class GetAzPortalDashboard_List1 : global::System.Management.Auto /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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")] @@ -130,7 +151,8 @@ public partial class GetAzPortalDashboard_List1 : global::System.Management.Auto [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -139,24 +161,24 @@ public partial class GetAzPortalDashboard_List1 : global::System.Management.Auto /// 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); + 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.Portal.Models.Api20221201Preview.IDashboardListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult /// 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); + 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) @@ -179,6 +201,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -200,7 +227,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzPortalDashboard_List1() { @@ -251,8 +278,33 @@ public GetAzPortalDashboard_List1() 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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -305,7 +357,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -326,7 +378,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.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}) + 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 } }); @@ -364,12 +416,12 @@ protected override void 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -386,15 +438,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName }) + 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 } }); @@ -404,12 +456,12 @@ protected override void StopProcessing() /// 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.Portal.Models.Api20221201Preview.IDashboardListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult /// 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) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -421,15 +473,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardListResult + var result = (await response); // response should be returning an array of some kind. +Pageable // pageable / value / nextLink - var result = await response; - WriteObject(result.Value,true); + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } _nextLink = result.NextLink; if (_isFirst) { _isFirst = false; - while (_nextLink != null) + while (!String.IsNullOrEmpty(_nextLink)) { if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) { diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalOperation_List.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalOperation_List.cs index 83e7a28fa407..b3db475dcad0 100644 --- a/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalOperation_List.cs +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/GetAzPortalOperation_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; using System; /// List the operations for the provider @@ -14,12 +16,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzPortalOperation_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation))] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"List the operations for the provider")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/providers/Microsoft.Portal/operations", ApiVersion = "2022-12-01-preview")] public partial class GetAzPortalOperation_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,17 +38,32 @@ public partial class GetAzPortalOperation_List : global::System.Management.Autom /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// A flag to tell whether it is the first onOK call. private bool _isFirst = true; /// Link to retrieve next page. private string _nextLink; + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.ClientAPI; @@ -59,6 +77,9 @@ public partial class GetAzPortalOperation_List : global::System.Management.Autom [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// 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] @@ -85,7 +106,7 @@ public partial class GetAzPortalOperation_List : global::System.Management.Autom /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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")] @@ -108,24 +129,24 @@ public partial class GetAzPortalOperation_List : global::System.Management.Autom /// 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); + 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.Portal.Models.Api50.IOperationListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); + 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) @@ -148,6 +169,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -169,7 +195,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzPortalOperation_List() { @@ -220,8 +246,33 @@ public GetAzPortalOperation_List() 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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -274,7 +325,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -292,7 +343,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + 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 } }); @@ -330,12 +381,12 @@ protected override void 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -352,7 +403,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 } @@ -370,12 +421,12 @@ protected override void StopProcessing() /// 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.Portal.Models.Api50.IOperationListResult + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -387,15 +438,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperationListResult + var result = (await response); // response should be returning an array of some kind. +Pageable // pageable / value / nextLink - var result = await response; - WriteObject(result.Value,true); + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } _nextLink = result.NextLink; if (_isFirst) { _isFirst = false; - while (_nextLink != null) + while (!String.IsNullOrEmpty(_nextLink)) { if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) { diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/NewAzPortalDashboard_Create.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/NewAzPortalDashboard_Create.cs index 66f9029c3d02..3e10784f3a3e 100644 --- a/generated/Portal/Portal.Autorest/generated/cmdlets/NewAzPortalDashboard_Create.cs +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/NewAzPortalDashboard_Create.cs @@ -6,19 +6,22 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; using System; - /// Creates or updates a Dashboard. + /// create a Dashboard. /// /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzPortalDashboard_Create", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"Creates or updates a Dashboard.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"create a Dashboard.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] public partial class NewAzPortalDashboard_Create : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,11 +37,26 @@ public partial class NewAzPortalDashboard_Create : global::System.Management.Aut /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.ClientAPI; @@ -52,6 +70,9 @@ public partial class NewAzPortalDashboard_Create : global::System.Management.Aut [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// 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] @@ -93,7 +114,7 @@ public partial class NewAzPortalDashboard_Create : global::System.Management.Aut /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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")] @@ -112,7 +133,7 @@ public partial class NewAzPortalDashboard_Create : global::System.Management.Aut public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard _resource; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard _resource; /// The shared dashboard resource definition. [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The shared dashboard resource definition.", ValueFromPipeline = true)] @@ -121,8 +142,9 @@ public partial class NewAzPortalDashboard_Create : global::System.Management.Aut ReadOnly = false, Description = @"The shared dashboard resource definition.", SerializedName = @"resource", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard) })] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard Resource { get => this._resource; set => this._resource = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard Resource { get => this._resource; set => this._resource = value; } /// Backing field for property. private string _resourceGroupName; @@ -152,7 +174,8 @@ public partial class NewAzPortalDashboard_Create : global::System.Management.Aut [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -161,36 +184,36 @@ public partial class NewAzPortalDashboard_Create : global::System.Management.Aut /// 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// from the remote call /// /// Determines if the rest of the onCreated method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); + 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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); + 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) @@ -213,6 +236,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -277,8 +305,33 @@ protected override void EndProcessing() 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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -288,7 +341,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public NewAzPortalDashboard_Create() { @@ -342,7 +395,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -355,12 +408,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.DashboardsCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, Resource, onOk, onCreated, onDefault, this, Pipeline); + await this.Client.DashboardsCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, Resource, onOk, onCreated, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeCreate); await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.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=Resource}) + 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 } }); @@ -396,12 +449,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 201 (Created). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -413,8 +466,26 @@ protected override void StopProcessing() return ; } // onCreated - response for 201 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } @@ -422,12 +493,12 @@ protected override void 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -444,15 +515,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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=Resource }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=Resource }) + 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 } }); @@ -462,12 +533,12 @@ protected override void StopProcessing() /// 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -479,8 +550,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/NewAzPortalDashboard_CreateExpanded.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/NewAzPortalDashboard_CreateExpanded.cs index 65574a08a7c1..7215d60bfbba 100644 --- a/generated/Portal/Portal.Autorest/generated/cmdlets/NewAzPortalDashboard_CreateExpanded.cs +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/NewAzPortalDashboard_CreateExpanded.cs @@ -6,19 +6,22 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; using System; - /// Creates or updates a Dashboard. + /// create a Dashboard. /// /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzPortalDashboard_CreateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"Creates or updates a Dashboard.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"create a Dashboard.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] public partial class NewAzPortalDashboard_CreateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,14 +37,29 @@ public partial class NewAzPortalDashboard_CreateExpanded : global::System.Manage /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// The shared dashboard resource definition. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard _resourceBody = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.Dashboard(); + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard _resourceBody = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Dashboard(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.ClientAPI; @@ -55,6 +73,9 @@ public partial class NewAzPortalDashboard_CreateExpanded : global::System.Manage [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// 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] @@ -79,8 +100,8 @@ public partial class NewAzPortalDashboard_CreateExpanded : global::System.Manage ReadOnly = false, Description = @"The dashboard lenses.", SerializedName = @"lenses", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens) })] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get => _resourceBody.Lens ?? null /* arrayOf */; set => _resourceBody.Lens = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens) })] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens[] Lens { get => _resourceBody.Lens?.ToArray() ?? null /* fixedArrayOf */; set => _resourceBody.Lens = (value != null ? new System.Collections.Generic.List(value) : null); } /// The geo-location where the resource lives [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] @@ -102,8 +123,8 @@ public partial class NewAzPortalDashboard_CreateExpanded : global::System.Manage ReadOnly = false, Description = @"The dashboard metadata.", SerializedName = @"metadata", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata) })] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get => _resourceBody.Metadata ?? null /* object */; set => _resourceBody.Metadata = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata) })] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get => _resourceBody.Metadata ?? null /* object */; set => _resourceBody.Metadata = value; } /// /// cancellation delegate. Stops the cmdlet when called. @@ -131,7 +152,7 @@ public partial class NewAzPortalDashboard_CreateExpanded : global::System.Manage /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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")] @@ -177,7 +198,8 @@ public partial class NewAzPortalDashboard_CreateExpanded : global::System.Manage [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -190,44 +212,44 @@ public partial class NewAzPortalDashboard_CreateExpanded : global::System.Manage ReadOnly = false, Description = @"Resource tags.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags Tag { get => _resourceBody.Tag ?? null /* object */; set => _resourceBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags Tag { get => _resourceBody.Tag ?? null /* object */; set => _resourceBody.Tag = value; } /// /// overrideOnCreated will be called before the regular onCreated 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// from the remote call /// /// Determines if the rest of the onCreated method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); + 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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); + 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) @@ -250,6 +272,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -314,8 +341,33 @@ protected override void EndProcessing() 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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -325,7 +377,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public NewAzPortalDashboard_CreateExpanded() { @@ -379,7 +431,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -392,12 +444,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.DashboardsCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _resourceBody, onOk, onCreated, onDefault, this, Pipeline); + await this.Client.DashboardsCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _resourceBody, onOk, onCreated, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeCreate); await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.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=_resourceBody}) + 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 } }); @@ -433,12 +485,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 201 (Created). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -450,8 +502,26 @@ protected override void StopProcessing() return ; } // onCreated - response for 201 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } @@ -459,12 +529,12 @@ protected override void 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -481,15 +551,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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=_resourceBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_resourceBody }) + 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 } }); @@ -499,12 +569,12 @@ protected override void StopProcessing() /// 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -516,8 +586,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/NewAzPortalDashboard_CreateViaJsonFilePath.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/NewAzPortalDashboard_CreateViaJsonFilePath.cs new file mode 100644 index 000000000000..1f8a75a2f695 --- /dev/null +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/NewAzPortalDashboard_CreateViaJsonFilePath.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.Portal.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; + using System; + + /// create a Dashboard. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzPortalDashboard_CreateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"create a Dashboard.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.NotSuggestDefaultParameterSet] + public partial class NewAzPortalDashboard_CreateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext + { + /// 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 dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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 _jsonFilePath; + + /// Path of Json file supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Create operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the dashboard. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the dashboard.")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the dashboard.", + SerializedName = @"dashboardName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("DashboardName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated 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.Portal.Models.IDashboard + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Portal.Models.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.Portal.Models.IDashboard + /// 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.Portal.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// 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.Portal.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.Portal.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzPortalDashboard_CreateViaJsonFilePath() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DashboardsCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DashboardsCreateOrUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onCreated, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + + /// + /// 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.Portal.Models.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.Portal.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.Portal.Models.IDashboard + /// 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.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/NewAzPortalDashboard_CreateViaJsonString.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/NewAzPortalDashboard_CreateViaJsonString.cs new file mode 100644 index 000000000000..0216542f87b2 --- /dev/null +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/NewAzPortalDashboard_CreateViaJsonString.cs @@ -0,0 +1,576 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; + using System; + + /// create a Dashboard. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzPortalDashboard_CreateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"create a Dashboard.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.NotSuggestDefaultParameterSet] + public partial class NewAzPortalDashboard_CreateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext + { + /// 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 dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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 _jsonString; + + /// Json string supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Create operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the dashboard. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the dashboard.")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the dashboard.", + SerializedName = @"dashboardName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("DashboardName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated 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.Portal.Models.IDashboard + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Portal.Models.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.Portal.Models.IDashboard + /// 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.Portal.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// 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.Portal.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.Portal.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzPortalDashboard_CreateViaJsonString() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DashboardsCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DashboardsCreateOrUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onCreated, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + + /// + /// 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.Portal.Models.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.Portal.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.Portal.Models.IDashboard + /// 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.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/RemoveAzPortalDashboard_Delete.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/RemoveAzPortalDashboard_Delete.cs index f227d85f480b..ede7842ed5bf 100644 --- a/generated/Portal/Portal.Autorest/generated/cmdlets/RemoveAzPortalDashboard_Delete.cs +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/RemoveAzPortalDashboard_Delete.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; using System; /// Deletes the Dashboard. @@ -18,7 +20,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] public partial class RemoveAzPortalDashboard_Delete : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,11 +37,26 @@ public partial class RemoveAzPortalDashboard_Delete : global::System.Management. /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.ClientAPI; @@ -52,6 +70,9 @@ public partial class RemoveAzPortalDashboard_Delete : global::System.Management. [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// 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] @@ -100,7 +121,7 @@ public partial class RemoveAzPortalDashboard_Delete : global::System.Management. /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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")] @@ -146,7 +167,8 @@ public partial class RemoveAzPortalDashboard_Delete : global::System.Management. [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -155,12 +177,12 @@ public partial class RemoveAzPortalDashboard_Delete : global::System.Management. /// 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); + 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 @@ -203,6 +225,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -267,8 +294,33 @@ protected override void EndProcessing() 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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -324,7 +376,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -342,7 +394,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.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}) + 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 } }); @@ -355,7 +407,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public RemoveAzPortalDashboard_Delete() { @@ -388,12 +440,12 @@ protected override void 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -410,15 +462,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + 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 } }); diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/RemoveAzPortalDashboard_DeleteViaIdentity.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/RemoveAzPortalDashboard_DeleteViaIdentity.cs index 9aecda77d0ad..05262f0325bb 100644 --- a/generated/Portal/Portal.Autorest/generated/cmdlets/RemoveAzPortalDashboard_DeleteViaIdentity.cs +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/RemoveAzPortalDashboard_DeleteViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; using System; /// Deletes the Dashboard. @@ -18,7 +20,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] public partial class RemoveAzPortalDashboard_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,11 +37,26 @@ public partial class RemoveAzPortalDashboard_DeleteViaIdentity : global::System. /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.ClientAPI; @@ -52,6 +70,9 @@ public partial class RemoveAzPortalDashboard_DeleteViaIdentity : global::System. [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// 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] @@ -93,7 +114,7 @@ public partial class RemoveAzPortalDashboard_DeleteViaIdentity : global::System. /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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")] @@ -116,12 +137,12 @@ public partial class RemoveAzPortalDashboard_DeleteViaIdentity : global::System. /// 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); + 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 @@ -164,6 +185,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -228,8 +254,33 @@ protected override void EndProcessing() 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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -285,7 +336,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -323,7 +374,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + 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 } }); @@ -336,7 +387,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public RemoveAzPortalDashboard_DeleteViaIdentity() { @@ -369,12 +420,12 @@ protected override void 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -391,7 +442,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 } diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/SetAzPortalDashboard_Update.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/SetAzPortalDashboard_Update.cs index 76a5763d8ada..a857877f5a2e 100644 --- a/generated/Portal/Portal.Autorest/generated/cmdlets/SetAzPortalDashboard_Update.cs +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/SetAzPortalDashboard_Update.cs @@ -6,20 +6,23 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; using System; - /// Creates or updates a Dashboard. + /// update a Dashboard. /// /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" /// [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzPortalDashboard_Update", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"Creates or updates a Dashboard.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"update a Dashboard.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] public partial class SetAzPortalDashboard_Update : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,11 +38,26 @@ public partial class SetAzPortalDashboard_Update : global::System.Management.Aut /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.ClientAPI; @@ -53,6 +71,9 @@ public partial class SetAzPortalDashboard_Update : global::System.Management.Aut [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// 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] @@ -94,7 +115,7 @@ public partial class SetAzPortalDashboard_Update : global::System.Management.Aut /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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")] @@ -113,7 +134,7 @@ public partial class SetAzPortalDashboard_Update : global::System.Management.Aut public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard _resource; + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard _resource; /// The shared dashboard resource definition. [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The shared dashboard resource definition.", ValueFromPipeline = true)] @@ -122,8 +143,9 @@ public partial class SetAzPortalDashboard_Update : global::System.Management.Aut ReadOnly = false, Description = @"The shared dashboard resource definition.", SerializedName = @"resource", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard) })] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard Resource { get => this._resource; set => this._resource = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard Resource { get => this._resource; set => this._resource = value; } /// Backing field for property. private string _resourceGroupName; @@ -153,7 +175,8 @@ public partial class SetAzPortalDashboard_Update : global::System.Management.Aut [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -162,36 +185,36 @@ public partial class SetAzPortalDashboard_Update : global::System.Management.Aut /// 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// from the remote call /// /// Determines if the rest of the onCreated method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); + 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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); + 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) @@ -214,6 +237,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -278,8 +306,33 @@ protected override void EndProcessing() 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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -335,7 +388,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -348,12 +401,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.DashboardsCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, Resource, onOk, onCreated, onDefault, this, Pipeline); + await this.Client.DashboardsCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, Resource, onOk, onCreated, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeCreate); await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.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=Resource}) + 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 } }); @@ -366,7 +419,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public SetAzPortalDashboard_Update() { @@ -397,12 +450,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 201 (Created). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -414,8 +467,26 @@ protected override void StopProcessing() return ; } // onCreated - response for 201 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } @@ -423,12 +494,12 @@ protected override void 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -445,15 +516,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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=Resource }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=Resource }) + 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 } }); @@ -463,12 +534,12 @@ protected override void StopProcessing() /// 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -480,8 +551,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/SetAzPortalDashboard_UpdateExpanded.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/SetAzPortalDashboard_UpdateExpanded.cs index 7adfd4a50fad..f180c9a00572 100644 --- a/generated/Portal/Portal.Autorest/generated/cmdlets/SetAzPortalDashboard_UpdateExpanded.cs +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/SetAzPortalDashboard_UpdateExpanded.cs @@ -6,20 +6,23 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; using System; - /// Creates or updates a Dashboard. + /// update a Dashboard. /// /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" /// [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzPortalDashboard_UpdateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"Creates or updates a Dashboard.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"update a Dashboard.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] public partial class SetAzPortalDashboard_UpdateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,14 +38,29 @@ public partial class SetAzPortalDashboard_UpdateExpanded : global::System.Manage /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// The shared dashboard resource definition. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard _resourceBody = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.Dashboard(); + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard _resourceBody = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Dashboard(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.ClientAPI; @@ -56,6 +74,9 @@ public partial class SetAzPortalDashboard_UpdateExpanded : global::System.Manage [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// 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] @@ -80,8 +101,8 @@ public partial class SetAzPortalDashboard_UpdateExpanded : global::System.Manage ReadOnly = false, Description = @"The dashboard lenses.", SerializedName = @"lenses", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens) })] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get => _resourceBody.Lens ?? null /* arrayOf */; set => _resourceBody.Lens = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens) })] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens[] Lens { get => _resourceBody.Lens?.ToArray() ?? null /* fixedArrayOf */; set => _resourceBody.Lens = (value != null ? new System.Collections.Generic.List(value) : null); } /// The geo-location where the resource lives [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The geo-location where the resource lives")] @@ -103,8 +124,8 @@ public partial class SetAzPortalDashboard_UpdateExpanded : global::System.Manage ReadOnly = false, Description = @"The dashboard metadata.", SerializedName = @"metadata", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata) })] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get => _resourceBody.Metadata ?? null /* object */; set => _resourceBody.Metadata = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata) })] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata Metadata { get => _resourceBody.Metadata ?? null /* object */; set => _resourceBody.Metadata = value; } /// /// cancellation delegate. Stops the cmdlet when called. @@ -132,7 +153,7 @@ public partial class SetAzPortalDashboard_UpdateExpanded : global::System.Manage /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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")] @@ -178,7 +199,8 @@ public partial class SetAzPortalDashboard_UpdateExpanded : global::System.Manage [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -191,44 +213,44 @@ public partial class SetAzPortalDashboard_UpdateExpanded : global::System.Manage ReadOnly = false, Description = @"Resource tags.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags Tag { get => _resourceBody.Tag ?? null /* object */; set => _resourceBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags Tag { get => _resourceBody.Tag ?? null /* object */; set => _resourceBody.Tag = value; } /// /// overrideOnCreated will be called before the regular onCreated 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// from the remote call /// /// Determines if the rest of the onCreated method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); + 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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); + 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) @@ -251,6 +273,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -315,8 +342,33 @@ protected override void EndProcessing() 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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -372,7 +424,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -385,12 +437,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.DashboardsCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _resourceBody, onOk, onCreated, onDefault, this, Pipeline); + await this.Client.DashboardsCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _resourceBody, onOk, onCreated, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeCreate); await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.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=_resourceBody}) + 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 } }); @@ -403,7 +455,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public SetAzPortalDashboard_UpdateExpanded() { @@ -434,12 +486,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 201 (Created). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -451,8 +503,26 @@ protected override void StopProcessing() return ; } // onCreated - response for 201 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } @@ -460,12 +530,12 @@ protected override void 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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -482,15 +552,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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=_resourceBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_resourceBody }) + 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 } }); @@ -500,12 +570,12 @@ protected override void StopProcessing() /// 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -517,8 +587,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/SetAzPortalDashboard_UpdateViaJsonFilePath.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/SetAzPortalDashboard_UpdateViaJsonFilePath.cs new file mode 100644 index 000000000000..5599be65bd34 --- /dev/null +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/SetAzPortalDashboard_UpdateViaJsonFilePath.cs @@ -0,0 +1,579 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; + using System; + + /// update a Dashboard. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzPortalDashboard_UpdateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"update a Dashboard.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.NotSuggestDefaultParameterSet] + public partial class SetAzPortalDashboard_UpdateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext + { + /// 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 dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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 _jsonFilePath; + + /// Path of Json file supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Update operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the dashboard. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the dashboard.")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the dashboard.", + SerializedName = @"dashboardName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("DashboardName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated 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.Portal.Models.IDashboard + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Portal.Models.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.Portal.Models.IDashboard + /// 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.Portal.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// 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.Portal.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.Portal.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DashboardsCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DashboardsCreateOrUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onCreated, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public SetAzPortalDashboard_UpdateViaJsonFilePath() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + + /// + /// 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.Portal.Models.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.Portal.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.Portal.Models.IDashboard + /// 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.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/SetAzPortalDashboard_UpdateViaJsonString.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/SetAzPortalDashboard_UpdateViaJsonString.cs new file mode 100644 index 000000000000..59a527d9ffbd --- /dev/null +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/SetAzPortalDashboard_UpdateViaJsonString.cs @@ -0,0 +1,577 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; + using System; + + /// update a Dashboard. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzPortalDashboard_UpdateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"update a Dashboard.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.NotSuggestDefaultParameterSet] + public partial class SetAzPortalDashboard_UpdateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext + { + /// 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 dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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 _jsonString; + + /// Json string supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Update operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the dashboard. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the dashboard.")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the dashboard.", + SerializedName = @"dashboardName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("DashboardName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated 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.Portal.Models.IDashboard + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Portal.Models.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.Portal.Models.IDashboard + /// 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.Portal.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// 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.Portal.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.Portal.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DashboardsCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DashboardsCreateOrUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onCreated, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public SetAzPortalDashboard_UpdateViaJsonString() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + + /// + /// 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.Portal.Models.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.Portal.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.Portal.Models.IDashboard + /// 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.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/UpdateAzPortalDashboard_UpdateExpanded.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/UpdateAzPortalDashboard_UpdateExpanded.cs index 256c2d7f7643..ffcd111f1e45 100644 --- a/generated/Portal/Portal.Autorest/generated/cmdlets/UpdateAzPortalDashboard_UpdateExpanded.cs +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/UpdateAzPortalDashboard_UpdateExpanded.cs @@ -6,19 +6,22 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; using System; - /// Updates an existing Dashboard. + /// update an existing Dashboard. /// /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzPortalDashboard_UpdateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"Updates an existing Dashboard.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"update an existing Dashboard.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] public partial class UpdateAzPortalDashboard_UpdateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,14 +37,29 @@ public partial class UpdateAzPortalDashboard_UpdateExpanded : global::System.Man /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// The shared dashboard resource definition. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboard _propertiesBody = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.PatchableDashboard(); + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard _propertiesBody = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.PatchableDashboard(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.ClientAPI; @@ -55,6 +73,9 @@ public partial class UpdateAzPortalDashboard_UpdateExpanded : global::System.Man [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// 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] @@ -79,8 +100,8 @@ public partial class UpdateAzPortalDashboard_UpdateExpanded : global::System.Man ReadOnly = false, Description = @"The dashboard lenses.", SerializedName = @"lenses", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens) })] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get => _propertiesBody.Lens ?? null /* arrayOf */; set => _propertiesBody.Lens = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens) })] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens[] Lens { get => _propertiesBody.Lens?.ToArray() ?? null /* fixedArrayOf */; set => _propertiesBody.Lens = (value != null ? new System.Collections.Generic.List(value) : null); } /// The dashboard metadata. [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ExportAs(typeof(global::System.Collections.Hashtable))] @@ -91,8 +112,8 @@ public partial class UpdateAzPortalDashboard_UpdateExpanded : global::System.Man ReadOnly = false, Description = @"The dashboard metadata.", SerializedName = @"metadata", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata) })] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata Metadata { get => _propertiesBody.Metadata ?? null /* object */; set => _propertiesBody.Metadata = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata) })] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata Metadata { get => _propertiesBody.Metadata ?? null /* object */; set => _propertiesBody.Metadata = value; } /// /// cancellation delegate. Stops the cmdlet when called. @@ -120,7 +141,7 @@ public partial class UpdateAzPortalDashboard_UpdateExpanded : global::System.Man /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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")] @@ -166,7 +187,8 @@ public partial class UpdateAzPortalDashboard_UpdateExpanded : global::System.Man [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } @@ -179,32 +201,32 @@ public partial class UpdateAzPortalDashboard_UpdateExpanded : global::System.Man ReadOnly = false, Description = @"Resource tags", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags Tag { get => _propertiesBody.Tag ?? null /* object */; set => _propertiesBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags Tag { get => _propertiesBody.Tag ?? null /* object */; set => _propertiesBody.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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); + 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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); + 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) @@ -227,6 +249,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -291,8 +318,33 @@ protected override void EndProcessing() 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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -348,7 +400,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -361,12 +413,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.DashboardsUpdate(SubscriptionId, ResourceGroupName, Name, _propertiesBody, onOk, onDefault, this, Pipeline); + await this.Client.DashboardsUpdate(SubscriptionId, ResourceGroupName, Name, _propertiesBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeUpdate); await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.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=_propertiesBody}) + 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 } }); @@ -386,7 +438,7 @@ protected override void StopProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public UpdateAzPortalDashboard_UpdateExpanded() { @@ -412,12 +464,12 @@ public UpdateAzPortalDashboard_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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -434,15 +486,15 @@ public UpdateAzPortalDashboard_UpdateExpanded() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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=_propertiesBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name, body=_propertiesBody }) + 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 } }); @@ -452,12 +504,12 @@ public UpdateAzPortalDashboard_UpdateExpanded() /// 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -469,8 +521,26 @@ public UpdateAzPortalDashboard_UpdateExpanded() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/UpdateAzPortalDashboard_UpdateViaIdentityExpanded.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/UpdateAzPortalDashboard_UpdateViaIdentityExpanded.cs index 1c5029e599e8..91ae34c244b6 100644 --- a/generated/Portal/Portal.Autorest/generated/cmdlets/UpdateAzPortalDashboard_UpdateViaIdentityExpanded.cs +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/UpdateAzPortalDashboard_UpdateViaIdentityExpanded.cs @@ -6,19 +6,22 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; using System; - /// Updates an existing Dashboard. + /// update an existing Dashboard. /// /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzPortalDashboard_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"Updates an existing Dashboard.")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"update an existing Dashboard.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] public partial class UpdateAzPortalDashboard_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,14 +37,29 @@ public partial class UpdateAzPortalDashboard_UpdateViaIdentityExpanded : global: /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// The shared dashboard resource definition. - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboard _propertiesBody = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.PatchableDashboard(); + private Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboard _propertiesBody = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.PatchableDashboard(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.ClientAPI; @@ -55,6 +73,9 @@ public partial class UpdateAzPortalDashboard_UpdateViaIdentityExpanded : global: [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// 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] @@ -87,8 +108,8 @@ public partial class UpdateAzPortalDashboard_UpdateViaIdentityExpanded : global: ReadOnly = false, Description = @"The dashboard lenses.", SerializedName = @"lenses", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens) })] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[] Lens { get => _propertiesBody.Lens ?? null /* arrayOf */; set => _propertiesBody.Lens = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens) })] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens[] Lens { get => _propertiesBody.Lens?.ToArray() ?? null /* fixedArrayOf */; set => _propertiesBody.Lens = (value != null ? new System.Collections.Generic.List(value) : null); } /// The dashboard metadata. [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ExportAs(typeof(global::System.Collections.Hashtable))] @@ -99,8 +120,8 @@ public partial class UpdateAzPortalDashboard_UpdateViaIdentityExpanded : global: ReadOnly = false, Description = @"The dashboard metadata.", SerializedName = @"metadata", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata) })] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesMetadata Metadata { get => _propertiesBody.Metadata ?? null /* object */; set => _propertiesBody.Metadata = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata) })] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesMetadata Metadata { get => _propertiesBody.Metadata ?? null /* object */; set => _propertiesBody.Metadata = value; } /// /// cancellation delegate. Stops the cmdlet when called. @@ -113,7 +134,7 @@ public partial class UpdateAzPortalDashboard_UpdateViaIdentityExpanded : global: /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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")] @@ -140,32 +161,32 @@ public partial class UpdateAzPortalDashboard_UpdateViaIdentityExpanded : global: ReadOnly = false, Description = @"Resource tags", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IPatchableDashboardTags Tag { get => _propertiesBody.Tag ?? null /* object */; set => _propertiesBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IPatchableDashboardTags Tag { get => _propertiesBody.Tag ?? null /* object */; set => _propertiesBody.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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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); + 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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); + 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) @@ -188,6 +209,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); if (telemetryInfo != null) { @@ -252,8 +278,33 @@ protected override void EndProcessing() 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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -309,7 +360,7 @@ protected override void ProcessRecord() using( NoSynchronizationContext ) { await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -324,7 +375,7 @@ protected override void ProcessRecord() await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } if (InputObject?.Id != null) { - await this.Client.DashboardsUpdateViaIdentity(InputObject.Id, _propertiesBody, onOk, onDefault, this, Pipeline); + await this.Client.DashboardsUpdateViaIdentity(InputObject.Id, _propertiesBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeUpdate); } else { @@ -341,13 +392,13 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.DashboardName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.DashboardsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.DashboardName ?? null, _propertiesBody, onOk, onDefault, this, Pipeline); + await this.Client.DashboardsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.DashboardName ?? null, _propertiesBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.SerializationMode.IncludeUpdate); } await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_propertiesBody}) + 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 } }); @@ -367,7 +418,7 @@ protected override void StopProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public UpdateAzPortalDashboard_UpdateViaIdentityExpanded() { @@ -393,12 +444,12 @@ public UpdateAzPortalDashboard_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.Portal.Models.Api50.IErrorResponse + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.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) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -415,15 +466,15 @@ public UpdateAzPortalDashboard_UpdateViaIdentityExpanded() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_propertiesBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Portal.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 { body=_propertiesBody }) + 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 } }); @@ -433,12 +484,12 @@ public UpdateAzPortalDashboard_UpdateViaIdentityExpanded() /// 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.Portal.Models.Api20221201Preview.IDashboard + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard /// 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) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -450,8 +501,26 @@ public UpdateAzPortalDashboard_UpdateViaIdentityExpanded() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/UpdateAzPortalDashboard_UpdateViaJsonFilePath.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/UpdateAzPortalDashboard_UpdateViaJsonFilePath.cs new file mode 100644 index 000000000000..1da6e1620632 --- /dev/null +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/UpdateAzPortalDashboard_UpdateViaJsonFilePath.cs @@ -0,0 +1,524 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; + using System; + + /// update an existing Dashboard. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzPortalDashboard_UpdateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"update an existing Dashboard.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.NotSuggestDefaultParameterSet] + public partial class UpdateAzPortalDashboard_UpdateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext + { + /// 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 dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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 _jsonFilePath; + + /// Path of Json file supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Update operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the dashboard. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the dashboard.")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the dashboard.", + SerializedName = @"dashboardName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("DashboardName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Models.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.Portal.Models.IDashboard + /// 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.Portal.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// 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.Portal.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.Portal.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DashboardsUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DashboardsUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzPortalDashboard_UpdateViaJsonFilePath() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// 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.Portal.Models.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.Portal.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.Portal.Models.IDashboard + /// 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.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/cmdlets/UpdateAzPortalDashboard_UpdateViaJsonString.cs b/generated/Portal/Portal.Autorest/generated/cmdlets/UpdateAzPortalDashboard_UpdateViaJsonString.cs new file mode 100644 index 000000000000..01530e3e0c32 --- /dev/null +++ b/generated/Portal/Portal.Autorest/generated/cmdlets/UpdateAzPortalDashboard_UpdateViaJsonString.cs @@ -0,0 +1,522 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Cmdlets; + using System; + + /// update an existing Dashboard. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzPortalDashboard_UpdateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Description(@"update an existing Dashboard.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", ApiVersion = "2022-12-01-preview")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.NotSuggestDefaultParameterSet] + public partial class UpdateAzPortalDashboard_UpdateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext + { + /// 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 dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client => Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// 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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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 _jsonString; + + /// Json string supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Update operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the dashboard. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the dashboard.")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the dashboard.", + SerializedName = @"dashboardName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("DashboardName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.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.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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. The value must be an UUID. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription. The value must be an UUID.")] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription. The value must be an UUID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Portal.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Models.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.Portal.Models.IDashboard + /// 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.Portal.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId); + if (telemetryInfo != null) + { + telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning); + telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties); + telemetryInfo.TryGetValue("InvocationName", out var invocationName); + if (showSecretsWarning == "true") + { + if (string.IsNullOrEmpty(sanitizedProperties)) + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + else + { + WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844"); + } + } + } + } + + /// 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.Portal.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.Portal.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DashboardsUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DashboardsUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Portal.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.Portal.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzPortalDashboard_UpdateViaJsonString() + { + + } + + /// + new protected void WriteObject(object sendToPipeline) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline); + } + + /// + /// + new protected void WriteObject(object sendToPipeline, bool enumerateCollection) + { + Microsoft.Azure.PowerShell.Cmdlets.Portal.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId); + base.WriteObject(sendToPipeline, enumerateCollection); + } + + /// + /// 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.Portal.Models.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.Portal.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.Portal.Models.IDashboard + /// 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.Portal.Models.IDashboard + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs b/generated/Portal/Portal.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs new file mode 100644 index 000000000000..237c04e0fcef --- /dev/null +++ b/generated/Portal/Portal.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.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. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal +{ + using System; + using System.Collections.Generic; + using System.Text; + + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)] + public class ExternalDocsAttribute : Attribute + { + + public string Description { get; } + + public string Url { get; } + + public ExternalDocsAttribute(string url) + { + Url = url; + } + + public ExternalDocsAttribute(string url, string description) + { + Url = url; + Description = description; + } + } +} diff --git a/generated/Portal/Portal.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs b/generated/Portal/Portal.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs new file mode 100644 index 000000000000..5d61edfba14f --- /dev/null +++ b/generated/Portal/Portal.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs @@ -0,0 +1,52 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Collections.Generic; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Portal +{ + public class PSArgumentCompleterAttribute : ArgumentCompleterAttribute + { + internal string[] ResourceTypes; + + public PSArgumentCompleterAttribute(params string[] argumentList) : base(CreateScriptBlock(argumentList)) + { + ResourceTypes = argumentList; + } + + public static ScriptBlock CreateScriptBlock(string[] resourceTypes) + { + List outputResourceTypes = new List(); + foreach (string resourceType in resourceTypes) + { + if (resourceType.Contains(" ")) + { + outputResourceTypes.Add("\'\'" + resourceType + "\'\'"); + } + else + { + outputResourceTypes.Add(resourceType); + } + } + string scriptResourceTypeList = "'" + String.Join("' , '", outputResourceTypes) + "'"; + string script = "param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)\n" + + String.Format("$values = {0}\n", scriptResourceTypeList) + + "$values | Where-Object { $_ -Like \"$wordToComplete*\" -or $_ -Like \"'$wordToComplete*\" } | Sort-Object | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) }"; + ScriptBlock scriptBlock = ScriptBlock.Create(script); + return scriptBlock; + } + } +} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs index 349fe9f3287e..10483129487c 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs @@ -20,11 +20,13 @@ public class ExportFormatPs1xml : PSCmdlet public string FilePath { get; set; } private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Portal.Models"; - private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Portal.Support"; + private const string SupportNamespace = @"${$project.supportNamespace.fullName}"; private const string PropertiesExcludedForTableview = @"Id,Type"; private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + private static string SelectedBySuffix = @"#Multiple"; + protected override void ProcessRecord() { try @@ -76,7 +78,7 @@ private static View CreateViewModel(ViewParameters viewParameters) Name = viewParameters.Type.FullName, ViewSelectedBy = new ViewSelectedBy { - TypeName = viewParameters.Type.FullName + TypeName = string.Concat(viewParameters.Type.FullName, SelectedBySuffix) }, TableControl = new TableControl { diff --git a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs index 617b2caeb457..020df9159d98 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs @@ -24,7 +24,7 @@ public class ExportModelSurface : PSCmdlet public bool UseExpandedFormat { get; set; } private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Portal.Models"; - private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Portal.Support"; + private const string SupportNamespace = @"${$project.supportNamespace.fullName}"; protected override void ProcessRecord() { diff --git a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs index 781e2f53a87a..0c345e926074 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -70,9 +70,8 @@ protected override void ProcessRecord() 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))) + Path.Combine(vg.Key.IsInternal ? InternalFolder : ExportsFolder, pg.ProfileFolder), pg.ProfileName, isInternal: vg.Key.IsInternal))) .ToArray(); - var license = new StringBuilder(); license.Append(@" # ---------------------------------------------------------------------------------- @@ -114,6 +113,7 @@ protected override void ProcessRecord() 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; diff --git a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs index a8c27930e4a8..2cae7546599b 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs @@ -137,7 +137,7 @@ protected override void ProcessRecord() } else { - var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().Append("*").ToPsList(); + var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().ToPsList(); sb.AppendLine($@"{Indent}FunctionsToExport = {cmdletsList}"); } @@ -148,8 +148,10 @@ protected override void ProcessRecord() } else { - var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().Append("*").ToPsList(); - sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().ToPsList(); + if (!String.IsNullOrEmpty(aliasesList)) { + sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + } } // CmdletsToExport diff --git a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs index 1c46de2d7d49..80be4ad3ab6a 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -12,50 +12,96 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.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() + [Cmdlet(VerbsData.Export, "TestStub")] + [DoNotExport] + public class ExportTestStub : PSCmdlet { - try - { - if (!Directory.Exists(ExportsFolder)) - { - throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); - } + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } - var exportDirectories = Directory.GetDirectories(ExportsFolder); - if (!exportDirectories.Any()) - { - exportDirectories = new[] { ExportsFolder }; - } - var utilFile = Path.Combine(OutputFolder, "utils.ps1"); - if (!File.Exists(utilFile)) + [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() { - var sc = new StringBuilder(); - sc.AppendLine(@"function RandomString([bool]$allChars, [int32]$len) { + 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 loadEnvFile = Path.Combine(OutputFolder, "loadEnv.ps1"); + if (!File.Exists(loadEnvFile)) + { + var sc = new StringBuilder(); + sc.AppendLine(@" +$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 +}"); + File.WriteAllText(loadEnvFile, sc.ToString()); + }*/ + 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]$_}) } } +function Start-TestSleep { + [CmdletBinding(DefaultParameterSetName = 'SleepBySeconds')] + param( + [parameter(Mandatory = $true, Position = 0, ParameterSetName = 'SleepBySeconds')] + [ValidateRange(0.0, 2147483.0)] + [double] $Seconds, + + [parameter(Mandatory = $true, ParameterSetName = 'SleepByMilliseconds')] + [ValidateRange('NonNegative')] + [Alias('ms')] + [int] $Milliseconds + ) + + if ($TestMode -ne 'playback') { + switch ($PSCmdlet.ParameterSetName) { + 'SleepBySeconds' { + Start-Sleep -Seconds $Seconds + } + 'SleepByMilliseconds' { + Start-Sleep -Milliseconds $Milliseconds + } + } + } +} + $env = @{} if ($UsePreviousConfigForRecord) { $previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json @@ -80,37 +126,40 @@ 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(@"{ + 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 + ); + 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 @@ -120,29 +169,29 @@ function cleanupEnv() { "); - sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{"); - var variants = variantGroup.Variants - .Where(v => IncludeGenerated || !v.Attributes.OfType().Any()) - .ToList(); + sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{"); + var variants = variantGroup.Variants + .Where(v => IncludeGenerated || !v.Attributes.OfType().Any()) + .ToList(); - foreach (var variant in variants) + 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) { - 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}"); + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; } - sb.AppendLine("}"); - - File.WriteAllText(variantGroup.FilePath, sb.ToString()); - } } - } - catch (Exception ee) - { - Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); - throw ee; - } } - } } diff --git a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs index 2175dea86cff..5179eccec3bb 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -94,7 +94,7 @@ public static void WriteMarkdowns(IEnumerable variantGroups, PsMod sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}"); foreach (var relatedLink in markdownInfo.RelatedLinks) { - sb.Append($"{relatedLink}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"[{relatedLink}]({relatedLink}){Environment.NewLine}{Environment.NewLine}"); } File.WriteAllText(Path.Combine(docsFolder, $"{markdownInfo.CmdletName}.md"), sb.ToString()); diff --git a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs index 2c747405988c..17c77e3b5908 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs @@ -31,7 +31,7 @@ internal class MarkdownHelpInfo public string[] Inputs { get; } public string[] Outputs { get; } public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } - public string[] RelatedLinks { get; } + public MarkdownRelatedLinkInfo[] RelatedLinks { get; } public bool SupportsShouldProcess { get; } public bool SupportsPaging { get; } @@ -67,7 +67,11 @@ public MarkdownHelpInfo(VariantGroup variantGroup, string examplesFolder, string ComplexInterfaceInfos = variantGroup.ComplexInterfaceInfos; OnlineVersion = commentInfo.OnlineVersion; - RelatedLinks = commentInfo.RelatedLinks; + + var relatedLinkLists = new List(); + relatedLinkLists.AddRange(commentInfo.RelatedLinks?.Select(link => new MarkdownRelatedLinkInfo(link))); + relatedLinkLists.AddRange(variantGroup.Variants.SelectMany(v => v.Attributes).OfType()?.Distinct()?.Select(link => new MarkdownRelatedLinkInfo(link.Url, link.Description))); + RelatedLinks = relatedLinkLists?.ToArray(); SupportsShouldProcess = variantGroup.SupportsShouldProcess; SupportsPaging = variantGroup.SupportsPaging; @@ -218,14 +222,45 @@ public MarkdownParameterHelpInfo(PsParameterHelpInfo[] parameterHelpInfos, Param } } + internal class MarkdownRelatedLinkInfo + { + public string Url { get; } + public string Description { get; } + + public MarkdownRelatedLinkInfo(string url) + { + Url = url; + } + + public MarkdownRelatedLinkInfo(string url, string description) + { + Url = url; + Description = description; + } + + public override string ToString() + { + if (string.IsNullOrEmpty(Description)) + { + return Url; + } + else + { + return $@"[{Description}]({Url})"; + + } + + } + } + 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 }}"), + new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here (remove the output block if the example doesn't have an output) }}}}", @"{{ Add description here }}"), + new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here (remove the output block if the example doesn't have an output) }}}}", @"{{ Add description here }}"), }; public static MarkdownParameterHelpInfo[] SupportsShouldProcessParameters = diff --git a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs index f52dc97b3f6e..9f4e744f2bef 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -121,6 +121,21 @@ public override string ToString() => CompleterInfo != null : String.Empty; } + internal class PSArgumentCompleterOutput : ArgumentCompleterOutput + { + public PSArgumentCompleterInfo PSArgumentCompleterInfo { get; } + + public PSArgumentCompleterOutput(PSArgumentCompleterInfo completerInfo) : base(completerInfo) + { + PSArgumentCompleterInfo = completerInfo; + } + + + public override string ToString() => PSArgumentCompleterInfo != null + ? $"{Indent}[{typeof(PSArgumentCompleterAttribute)}({(PSArgumentCompleterInfo.IsTypeCompleter ? $"[{PSArgumentCompleterInfo.Type.Unwrap().ToPsType()}]" : $"{PSArgumentCompleterInfo.ResourceTypes?.Select(r => $"\"{r}\"")?.JoinIgnoreEmpty(", ")}")})]{Environment.NewLine}" + : String.Empty; + } + internal class DefaultInfoOutput { public bool HasDefaultInfo { get; } @@ -173,6 +188,7 @@ internal class BaseOutput public VariantGroup VariantGroup { get; } protected static readonly bool IsAzure = Convert.ToBoolean(@"true"); + public BaseOutput(VariantGroup variantGroup) { VariantGroup = variantGroup; @@ -200,6 +216,21 @@ public string GetProcessCustomAttributesAtRuntime() {Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)"; } + private string GetLoginVerification() + { + if (!VariantGroup.IsInternal && IsAzure && !VariantGroup.IsModelCmdlet) + { + return $@" +{Indent}{Indent}$context = Get-AzContext +{Indent}{Indent}if (-not $context -and -not $testPlayback) {{ +{Indent}{Indent}{Indent}Write-Error ""No Azure login detected. Please run 'Connect-AzAccount' to log in."" +{Indent}{Indent}{Indent}exit +{Indent}{Indent}}} +"; + } + return ""; + } + private string GetTelemetry() { if (!VariantGroup.IsInternal && IsAzure) @@ -232,10 +263,16 @@ public override string ToString() => $@"begin {{ {Indent}{Indent}{Indent}$PSBoundParameters['OutBuffer'] = 1 {Indent}{Indent}}} {Indent}{Indent}$parameterSet = $PSCmdlet.ParameterSetName -{GetTelemetry()} +{Indent}{Indent} +{Indent}{Indent}$testPlayback = $false +{Indent}{Indent}$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object {{ if ($_) {{ $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }} }} +{GetLoginVerification()}{GetTelemetry()} {GetParameterSetToCmdletMapping()}{GetDefaultValuesStatements()} {GetProcessCustomAttributesAtRuntime()} {Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) +{Indent}{Indent}if ($wrappedCmd -eq $null) {{ +{Indent}{Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) +{Indent}{Indent}}} {Indent}{Indent}$scriptCmd = {{& $wrappedCmd @PSBoundParameters}} {Indent}{Indent}$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) {Indent}{Indent}$steppablePipeline.Begin($PSCmdlet) @@ -269,13 +306,16 @@ private string GetDefaultValuesStatements() var variantListString = defaultInfo.ParameterGroup.VariantNames.ToPsList(); var parameterName = defaultInfo.ParameterGroup.ParameterName; sb.AppendLine(); + var setCondition = " "; + if (!String.IsNullOrEmpty(defaultInfo.SetCondition)) + { + setCondition = $" -and {defaultInfo.SetCondition}"; + } //Yabo: this is bad to hard code the subscription id, but autorest load input README.md reversely (entry readme -> required readme), there are no other way to //override default value set in required readme if ("SubscriptionId".Equals(parameterName)) { - sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{"); - sb.AppendLine($"{Indent}{Indent}{Indent}$testPlayback = $false"); - sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object {{ if ($_) {{ $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }} }}"); + sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{"); sb.AppendLine($"{Indent}{Indent}{Indent}if ($testPlayback) {{"); sb.AppendLine($"{Indent}{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')"); sb.AppendLine($"{Indent}{Indent}{Indent}}} else {{"); @@ -285,13 +325,15 @@ private string GetDefaultValuesStatements() } else { - sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{"); + sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{"); sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}"); sb.Append($"{Indent}{Indent}}}"); } + } return sb.ToString(); } + } internal class ProcessOutput : BaseOutput @@ -381,6 +423,8 @@ public override string ToString() 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 externalUrls = String.Join(Environment.NewLine, CommentInfo.ExternalUrls.Select(l => $".Link{Environment.NewLine}{l}")); + var externalUrlsText = !String.IsNullOrEmpty(externalUrls) ? $"{Environment.NewLine}{externalUrls}" : String.Empty; var examples = ""; foreach (var example in VariantGroup.HelpInfo.Examples) { @@ -393,7 +437,7 @@ public override string ToString() {CommentInfo.Description.ToDescriptionFormat(false)} {examples}{inputsText}{outputsText}{notesText} .Link -{CommentInfo.OnlineVersion}{relatedLinksText} +{CommentInfo.OnlineVersion}{relatedLinksText}{externalUrlsText} #> "; } @@ -587,7 +631,9 @@ public static string ToSyntaxTypeName(this Type type) public static AllowEmptyArrayOutput ToAllowEmptyArray(this bool hasAllowEmptyArray) => new AllowEmptyArrayOutput(hasAllowEmptyArray); - public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => new ArgumentCompleterOutput(completerInfo); + public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => (completerInfo is PSArgumentCompleterInfo psArgumentCompleterInfo) ? psArgumentCompleterInfo.ToArgumentCompleterOutput() : new ArgumentCompleterOutput(completerInfo); + + public static PSArgumentCompleterOutput ToArgumentCompleterOutput(this PSArgumentCompleterInfo completerInfo) => new PSArgumentCompleterOutput(completerInfo); public static DefaultInfoOutput ToDefaultInfoOutput(this ParameterGroup parameterGroup) => new DefaultInfoOutput(parameterGroup); diff --git a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs index fb11a1771f33..19644eeca6ec 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -31,7 +31,7 @@ internal class VariantGroup { public string ModuleName { get; } - public string RootModuleName {get => @"";} + public string RootModuleName { get => @""; } public string CmdletName { get; } public string CmdletVerb { get; } public string CmdletNoun { get; } @@ -49,7 +49,7 @@ internal class VariantGroup public PsHelpInfo HelpInfo { get; } public bool IsGenerated { get; } public bool IsInternal { get; } - + public bool IsModelCmdlet { get; } public string OutputFolder { get; } public string FileName { get; } public string FilePath { get; } @@ -84,7 +84,7 @@ public VariantGroup(string moduleName, string cmdletName, Variant[] variants, st HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo(); IsGenerated = Variants.All(v => v.Attributes.OfType().Any()); IsInternal = isInternal; - + IsModelCmdlet = Variants.All(v => v.IsModelCmdlet); OutputFolder = outputFolder; FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1"; FilePath = Path.Combine(OutputFolder, FileName); @@ -101,12 +101,23 @@ private string DetermineDefaultParameterSetName() if (String.IsNullOrEmpty(defaultParameterSet)) { var variantParamCountGroups = Variants + .Where(v => !v.IsNotSuggestDefaultParameterSet) .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(); + if (variantParamCountGroups.Length == 0) + { + 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; @@ -134,7 +145,9 @@ internal class Variant public Parameter[] Parameters { get; } public Parameter[] CmdletOnlyParameters { get; } public bool IsInternal { get; } + public bool IsModelCmdlet { get; } public bool IsDoNotExport { get; } + public bool IsNotSuggestDefaultParameterSet { get; } public string[] Profiles { get; } public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null) @@ -155,6 +168,8 @@ public Variant(string cmdletName, string variantName, CommandInfo info, CommandM Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray(); IsInternal = Attributes.OfType().Any(); IsDoNotExport = Attributes.OfType().Any(); + IsModelCmdlet = Attributes.OfType().Any(); + IsNotSuggestDefaultParameterSet = 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(); } @@ -210,6 +225,7 @@ public ParameterGroup(string parameterName, Parameter[] parameters, string[] all 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.PSArgumentCompleterAttribute).FirstOrDefault()?.ToPSArgumentCompleterInfo() ?? 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); @@ -244,7 +260,6 @@ internal class Parameter public ParameterMetadata Metadata { get; } public PsParameterHelpInfo HelpInfo { get; } public Type ParameterType { get; } - public Attribute[] Attributes { get; } public ParameterCategory[] Categories { get; } public ParameterCategory OrderCategory { get; } @@ -254,6 +269,7 @@ internal class Parameter public bool SupportsWildcards { get; } public CompleterInfoAttribute CompleterInfoAttribute { get; } public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; } + public PSArgumentCompleterAttribute PSArgumentCompleterAttribute { get; } public bool ValueFromPipeline { get; } public bool ValueFromPipelineByPropertyName { get; } @@ -286,7 +302,8 @@ public Parameter(string variantName, string parameterName, ParameterMetadata met } SupportsWildcards = Attributes.OfType().Any(); CompleterInfoAttribute = Attributes.OfType().FirstOrDefault(); - ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + PSArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(attr => !attr.GetType().Equals(typeof(PSArgumentCompleterAttribute))); ValueFromPipeline = ParameterAttribute.ValueFromPipeline; ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName; @@ -295,10 +312,10 @@ public Parameter(string variantName, string parameterName, ParameterMetadata met 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 complexMessage = $"{Environment.NewLine}"; 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); + description = description.NormalizeNewLines(); // 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 @@ -318,7 +335,7 @@ internal class ComplexInterfaceInfo public bool Required { get; } public bool ReadOnly { get; } public string Description { get; } - + public ComplexInterfaceInfo[] NestedInfos { get; } public bool IsComplexInterface { get; } @@ -335,7 +352,7 @@ public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, var unwrappedType = Type.Unwrap(); var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false; (seenTypes ?? (seenTypes = new List())).Add(unwrappedType); - NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} : + NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[] { } : unwrappedType.GetInterfaces() .Concat(InfoAttribute.PossibleTypes) .SelectMany(pt => pt.GetProperties() @@ -366,6 +383,7 @@ internal class CommentInfo public string OnlineVersion { get; } public string[] RelatedLinks { get; } + public string[] ExternalUrls { get; } private const string HelpLinkPrefix = @"https://learn.microsoft.com/powershell/module/"; @@ -391,6 +409,9 @@ public CommentInfo(VariantGroup variantGroup) 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(); + + // Get external urls from attribute + ExternalUrls = variantGroup.Variants.SelectMany(v => v.Attributes).OfType()?.Select(e => e.Url)?.Distinct()?.ToArray(); } } @@ -420,11 +441,22 @@ public CompleterInfo(ArgumentCompleterAttribute completerAttribute) } } + internal class PSArgumentCompleterInfo : CompleterInfo + { + public string[] ResourceTypes { get; } + + public PSArgumentCompleterInfo(PSArgumentCompleterAttribute completerAttribute) : base(completerAttribute) + { + ResourceTypes = completerAttribute.ResourceTypes; + } + } + internal class DefaultInfo { public string Name { get; } public string Description { get; } public string Script { get; } + public string SetCondition { get; } public ParameterGroup ParameterGroup { get; } public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) @@ -432,6 +464,7 @@ public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterG Name = infoAttribute.Name; Description = infoAttribute.Description; Script = infoAttribute.Script; + SetCondition = infoAttribute.SetCondition; ParameterGroup = parameterGroup; } @@ -479,7 +512,8 @@ public static Parameter[] ToParameters(this Variant variant) 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 (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."; @@ -507,7 +541,7 @@ public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute inf public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute); public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute); - + public static PSArgumentCompleterInfo ToPSArgumentCompleterInfo(this PSArgumentCompleterAttribute completerAttribute) => new PSArgumentCompleterInfo(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/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/PsAttributes.cs b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/PsAttributes.cs index 989f4806c1a2..766fb8c53e50 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/PsAttributes.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/PsAttributes.cs @@ -22,6 +22,11 @@ public class DoNotExportAttribute : Attribute { } + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class ModelCmdletAttribute : Attribute + { + } + [AttributeUsage(AttributeTargets.Class)] public class InternalExportAttribute : Attribute { @@ -55,6 +60,11 @@ public class HttpPathAttribute : Attribute public string ApiVersion { get; set; } } + [AttributeUsage(AttributeTargets.Class)] + public class NotSuggestDefaultParameterSetAttribute : Attribute + { + } + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] public class CategoryAttribute : Attribute { @@ -109,6 +119,11 @@ public enum PropertyOrigin Inlined } + [AttributeUsage(AttributeTargets.Property)] + public class ConstantAttribute : Attribute + { + } + [AttributeUsage(AttributeTargets.Property)] public class FormatTableAttribute : Attribute { diff --git a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/PsExtensions.cs b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/PsExtensions.cs index e92918a74edf..e1074a5aad8d 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/PsExtensions.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/PsExtensions.cs @@ -13,6 +13,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PowerShell { internal static class PsExtensions { + public static PSObject AddMultipleTypeNameIntoPSObject(this object obj, string multipleTag = "#Multiple") + { + var psObj = new PSObject(obj); + psObj.TypeNames.Insert(0, $"{psObj.TypeNames[0]}{multipleTag}"); + return psObj; + } + // https://stackoverflow.com/a/863944/294804 // https://stackoverflow.com/a/4452598/294804 // https://stackoverflow.com/a/28701974/294804 diff --git a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/PsHelpers.cs b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/PsHelpers.cs index 2e935e530cae..b29f5948b57d 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/PsHelpers.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/BuildTime/PsHelpers.cs @@ -67,7 +67,7 @@ public static IEnumerable GetScriptHelpInfo(params string[] modulePath public static IEnumerable GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) { - var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp => + 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)) @@ -88,7 +88,7 @@ public static Guid ReadGuidFromPsd1(string psd1Path) if (File.Exists(psd1Path)) { var currentGuid = File.ReadAllLines(psd1Path) - .FirstOrDefault(l => l.StartsWith(GuidStart))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) + .FirstOrDefault(l => l.TrimStart().StartsWith(GuidStart.TrimStart()))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) .LastOrDefault()?.Replace("'", String.Empty); guid = currentGuid != null ? Guid.Parse(currentGuid) : guid; } diff --git a/generated/Portal/Portal.Autorest/generated/runtime/Context.cs b/generated/Portal/Portal.Autorest/generated/runtime/Context.cs new file mode 100644 index 000000000000..0429638d1b14 --- /dev/null +++ b/generated/Portal/Portal.Autorest/generated/runtime/Context.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.Portal.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.Portal.Runtime.Extensions; + + /// + /// The IContext Interface defines the communication mechanism for input customization. + /// + /// + /// In the context, we will have client, pipeline, PSBoundParamters, default EventListener, Cancellation. + /// + public interface IContext + { + System.Management.Automation.InvocationInfo InvocationInformation { get; set; } + System.Threading.CancellationTokenSource CancellationTokenSource { get; set; } + System.Collections.Generic.IDictionary ExtensibleParameters { get; } + HttpPipeline Pipeline { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Portal.Portal Client { get; } + } +} diff --git a/generated/Portal/Portal.Autorest/generated/runtime/Events.cs b/generated/Portal/Portal.Autorest/generated/runtime/Events.cs index 00d0ad731b1a..d74c20f9412e 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/Events.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/Events.cs @@ -22,6 +22,6 @@ public static partial class Events public const string FollowingNextLink = nameof(FollowingNextLink); public const string DelayBeforePolling = nameof(DelayBeforePolling); public const string Polling = nameof(Polling); - + public const string Progress = nameof(Progress); } -} \ No newline at end of file +} diff --git a/generated/Portal/Portal.Autorest/generated/runtime/ISendAsync.cs b/generated/Portal/Portal.Autorest/generated/runtime/ISendAsync.cs index 16a5ed525a1f..0e23674654f0 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/ISendAsync.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/ISendAsync.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime using System.Threading.Tasks; using System.Collections; using System.Linq; + using System; + /// /// The interface for sending an HTTP request across the wire. @@ -70,6 +72,7 @@ public interface ISendAsyncTerminalFactory public partial class HttpPipeline : ISendAsync { + private const int DefaultMaxRetry = 3; private ISendAsync pipeline; private ISendAsyncTerminalFactory terminal; private List steps = new List(); @@ -92,6 +95,111 @@ public HttpPipeline(ISendAsyncTerminalFactory terminalStep) /// public HttpPipeline Clone() => new HttpPipeline(terminal) { steps = this.steps.ToList(), pipeline = this.pipeline }; + private bool shouldRetry429(HttpResponseMessage response) + { + if (response.StatusCode == (System.Net.HttpStatusCode)429) + { + var retryAfter = response.Headers.RetryAfter; + if (retryAfter != null && retryAfter.Delta.HasValue) + { + return true; + } + } + return false; + } + /// + /// The step to handle 429 response with retry-after header. + /// + public async Task Retry429(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + int retryCount = int.MaxValue; + + try + { + try + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("PS_HTTP_MAX_RETRIES_FOR_429")); + } + finally + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("AZURE_PS_HTTP_MAX_RETRIES_FOR_429")); + } + } + catch (System.Exception) + { + //no action + } + var cloneRequest = await request.CloneWithContent(); + var response = await next.SendAsync(request, callback); + int count = 0; + while (shouldRetry429(response) && count++ < retryCount) + { + request = await cloneRequest.CloneWithContent(); + var retryAfter = response.Headers.RetryAfter; + await Task.Delay(retryAfter.Delta.Value, callback.Token); + await callback.Signal("Debug", $"Start to retry {count} time(s) on status code 429 after waiting {retryAfter.Delta.Value.TotalSeconds} seconds."); + response = await next.SendAsync(request, callback); + } + return response; + } + + private bool shouldRetryError(HttpResponseMessage response) + { + if (response.StatusCode >= System.Net.HttpStatusCode.InternalServerError) + { + if (response.StatusCode != System.Net.HttpStatusCode.NotImplemented && + response.StatusCode != System.Net.HttpStatusCode.HttpVersionNotSupported) + { + return true; + } + } + else if (response.StatusCode == System.Net.HttpStatusCode.RequestTimeout) + { + return true; + } + else if (response.StatusCode == (System.Net.HttpStatusCode)429 && response.Headers.RetryAfter == null) + { + return true; + } + return false; + } + + /// + /// Returns true if status code in HttpRequestExceptionWithStatus exception is greater + /// than or equal to 500 and not NotImplemented (501) or HttpVersionNotSupported (505). + /// Or it's 429 (TOO MANY REQUESTS) without Retry-After header. + /// + public async Task RetryError(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + int retryCount = DefaultMaxRetry; + + try + { + try + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("PS_HTTP_MAX_RETRIES")); + } + finally + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("AZURE_PS_HTTP_MAX_RETRIES")); + } + } + catch (System.Exception) + { + //no action + } + var cloneRequest = await request.CloneWithContent(); + var response = await next.SendAsync(request, callback); + int count = 0; + while (shouldRetryError(response) && count++ < retryCount) + { + await callback.Signal("Debug", $"Start to retry {count} time(s) on status code {response.StatusCode}"); + request = await cloneRequest.CloneWithContent(); + response = await next.SendAsync(request, callback); + } + return response; + } + public ISendAsyncTerminalFactory TerminalFactory { get => terminal; @@ -117,6 +225,11 @@ public ISendAsync Pipeline // create the pipeline from scratch. var next = terminal.Create(); + if (Convert.ToBoolean(@"true")) + { + next = (new SendAsyncFactory(Retry429)).Create(next) ?? next; + next = (new SendAsyncFactory(RetryError)).Create(next) ?? next; + } foreach (var factory in steps) { // skip factories that return null. diff --git a/generated/Portal/Portal.Autorest/generated/runtime/InfoAttribute.cs b/generated/Portal/Portal.Autorest/generated/runtime/InfoAttribute.cs index 6414211d377c..0b590eba4f8e 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/InfoAttribute.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/InfoAttribute.cs @@ -11,6 +11,9 @@ public class InfoAttribute : Attribute { public bool Required { get; set; } = false; public bool ReadOnly { get; set; } = false; + public bool Read { get; set; } = true; + public bool Create { get; set; } = true; + public bool Update { get; set; } = true; public Type[] PossibleTypes { get; set; } = new Type[0]; public string Description { get; set; } = ""; public string SerializedName { get; set; } = ""; @@ -30,5 +33,6 @@ public class DefaultInfoAttribute : Attribute public string Script { get; set; } = ""; public string Name { get; set; } = ""; public string Description { get; set; } = ""; + public string SetCondition { get; set; } = ""; } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/runtime/InputHandler.cs b/generated/Portal/Portal.Autorest/generated/runtime/InputHandler.cs new file mode 100644 index 000000000000..f3483264d9ce --- /dev/null +++ b/generated/Portal/Portal.Autorest/generated/runtime/InputHandler.cs @@ -0,0 +1,22 @@ +/*--------------------------------------------------------------------------------------------- + * 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.Portal.Runtime.Cmdlets +{ + public abstract class InputHandler + { + protected InputHandler NextHandler = null; + + public void SetNextHandler(InputHandler nextHandler) + { + this.NextHandler = nextHandler; + } + + public abstract void Process(Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.IContext context); + } +} \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs b/generated/Portal/Portal.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs index e9ad2bd0246e..0bd305a5fe1d 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs @@ -21,6 +21,11 @@ internal XNodeArray(params JsonNode[] values) items = new List(values); } + internal XNodeArray(System.Collections.Generic.List values) + { + items = new List(values); + } + public override JsonNode this[int index] => items[index]; internal override JsonType? ElementType => null; diff --git a/generated/Portal/Portal.Autorest/generated/runtime/SerializationMode.cs b/generated/Portal/Portal.Autorest/generated/runtime/SerializationMode.cs index 9bafade0a0ca..889cde7d14f1 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/SerializationMode.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/SerializationMode.cs @@ -9,8 +9,10 @@ public enum SerializationMode { None = 0, IncludeHeaders = 1 << 0, - IncludeReadOnly = 1 << 1, - - IncludeAll = IncludeHeaders | IncludeReadOnly + IncludeRead = 1 << 1, + IncludeCreate = 1 << 2, + IncludeUpdate = 1 << 3, + IncludeAll = IncludeHeaders | IncludeRead | IncludeCreate | IncludeUpdate, + IncludeCreateOrUpdate = IncludeCreate | IncludeUpdate } } \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/generated/runtime/TypeConverterExtensions.cs b/generated/Portal/Portal.Autorest/generated/runtime/TypeConverterExtensions.cs index a273a0421bdf..05778acdf304 100644 --- a/generated/Portal/Portal.Autorest/generated/runtime/TypeConverterExtensions.cs +++ b/generated/Portal/Portal.Autorest/generated/runtime/TypeConverterExtensions.cs @@ -62,6 +62,56 @@ internal static T[] SelectToArray(object source, System.Func return result.ToArray(); } + internal static System.Collections.Generic.List SelectToList(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) }.ToList(); + } +#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].ToList(); // 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; + } internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.Generic.IDictionary dictionary) { if (null != dictionary) diff --git a/generated/Portal/Portal.Autorest/internal/Get-AzPortalOperation.ps1 b/generated/Portal/Portal.Autorest/internal/Get-AzPortalOperation.ps1 index 12ec6d3e7ff8..2bc5a7fc451d 100644 --- a/generated/Portal/Portal.Autorest/internal/Get-AzPortalOperation.ps1 +++ b/generated/Portal/Portal.Autorest/internal/Get-AzPortalOperation.ps1 @@ -25,12 +25,12 @@ List the operations for the provider {{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation .Link https://learn.microsoft.com/powershell/module/az.portal/get-azportaloperation #> function Get-AzPortalOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter()] @@ -89,12 +89,18 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ List = 'Az.Portal.private\Get-AzPortalOperation_List'; } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/Portal/Portal.Autorest/internal/ProxyCmdletDefinitions.ps1 b/generated/Portal/Portal.Autorest/internal/ProxyCmdletDefinitions.ps1 index c41fb29e4b4b..f06da1454287 100644 --- a/generated/Portal/Portal.Autorest/internal/ProxyCmdletDefinitions.ps1 +++ b/generated/Portal/Portal.Autorest/internal/ProxyCmdletDefinitions.ps1 @@ -25,12 +25,12 @@ List the operations for the provider {{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation .Link https://learn.microsoft.com/powershell/module/az.portal/get-azportaloperation #> function Get-AzPortalOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.IOperation])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IOperation])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter()] @@ -89,12 +89,18 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ List = 'Az.Portal.private\Get-AzPortalOperation_List'; } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) @@ -126,16 +132,16 @@ end { <# .Synopsis -Creates or updates a Dashboard. +update a Dashboard. .Description -Creates or updates a Dashboard. +update a Dashboard. .Example Set-AzPortalDashboard -DashboardPath .\resources\dash1-update.json -ResourceGroupName my-rg -DashboardName dashbase03 .Inputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard .Notes COMPLEX PARAMETER PROPERTIES @@ -143,7 +149,7 @@ To create the parameters described below, construct a hash table containing the LENS : The dashboard lenses. Order : The lens order. - Part : The dashboard parts. + Part >: The dashboard parts. PositionColSpan : The dashboard's part column span. PositionRowSpan : The dashboard's part row span. PositionX : The dashboard's part x coordinate. @@ -152,18 +158,12 @@ LENS : The dashboard lenses. [Metadata ]: The dashboard len's metadata. RESOURCE : The shared dashboard resource definition. - Location : The geo-location where the resource lives + [Location ]: The geo-location where the resource lives [Tag ]: Resource tags. [(Any) ]: This indicates any property can be added to this object. - [SystemDataCreatedAt ]: The timestamp of resource creation (UTC). - [SystemDataCreatedBy ]: The identity that created the resource. - [SystemDataCreatedByType ]: The type of identity that created the resource. - [SystemDataLastModifiedAt ]: The timestamp of resource last modification (UTC) - [SystemDataLastModifiedBy ]: The identity that last modified the resource. - [SystemDataLastModifiedByType ]: The type of identity that last modified the resource. - [Lens ]: The dashboard lenses. + [Lens >]: The dashboard lenses. Order : The lens order. - Part : The dashboard parts. + Part >: The dashboard parts. PositionColSpan : The dashboard's part column span. PositionRowSpan : The dashboard's part row span. PositionX : The dashboard's part x coordinate. @@ -176,7 +176,7 @@ RESOURCE : The shared dashboard resource definition. https://learn.microsoft.com/powershell/module/az.portal/set-azportaldashboard #> function Set-AzPortalDashboard { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard])] [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -203,9 +203,8 @@ param( [Parameter(ParameterSetName='Update', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard] # The shared dashboard resource definition. - # To construct, see NOTES section for RESOURCE properties and create a hash table. ${Resource}, [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] @@ -217,25 +216,36 @@ param( [Parameter(ParameterSetName='UpdateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[]] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens[]] # The dashboard lenses. - # To construct, see NOTES section for LENS properties and create a hash table. ${Lens}, [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata]))] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata]))] [System.Collections.Hashtable] # The dashboard metadata. ${Metadata}, [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags]))] [System.Collections.Hashtable] # Resource tags. ${Tag}, + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -292,14 +302,17 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ Update = 'Az.Portal.private\Set-AzPortalDashboard_Update'; UpdateExpanded = 'Az.Portal.private\Set-AzPortalDashboard_UpdateExpanded'; + UpdateViaJsonFilePath = 'Az.Portal.private\Set-AzPortalDashboard_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.Portal.private\Set-AzPortalDashboard_UpdateViaJsonString'; } - if (('Update', 'UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Update', 'UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -308,6 +321,9 @@ begin { } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/Portal/Portal.Autorest/internal/Set-AzPortalDashboard.ps1 b/generated/Portal/Portal.Autorest/internal/Set-AzPortalDashboard.ps1 index cf3d132fe12a..7bf5c6193d0f 100644 --- a/generated/Portal/Portal.Autorest/internal/Set-AzPortalDashboard.ps1 +++ b/generated/Portal/Portal.Autorest/internal/Set-AzPortalDashboard.ps1 @@ -16,16 +16,16 @@ <# .Synopsis -Creates or updates a Dashboard. +update a Dashboard. .Description -Creates or updates a Dashboard. +update a Dashboard. .Example Set-AzPortalDashboard -DashboardPath .\resources\dash1-update.json -ResourceGroupName my-rg -DashboardName dashbase03 .Inputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard +Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard .Notes COMPLEX PARAMETER PROPERTIES @@ -33,7 +33,7 @@ To create the parameters described below, construct a hash table containing the LENS : The dashboard lenses. Order : The lens order. - Part : The dashboard parts. + Part >: The dashboard parts. PositionColSpan : The dashboard's part column span. PositionRowSpan : The dashboard's part row span. PositionX : The dashboard's part x coordinate. @@ -42,18 +42,12 @@ LENS : The dashboard lenses. [Metadata ]: The dashboard len's metadata. RESOURCE : The shared dashboard resource definition. - Location : The geo-location where the resource lives + [Location ]: The geo-location where the resource lives [Tag ]: Resource tags. [(Any) ]: This indicates any property can be added to this object. - [SystemDataCreatedAt ]: The timestamp of resource creation (UTC). - [SystemDataCreatedBy ]: The identity that created the resource. - [SystemDataCreatedByType ]: The type of identity that created the resource. - [SystemDataLastModifiedAt ]: The timestamp of resource last modification (UTC) - [SystemDataLastModifiedBy ]: The identity that last modified the resource. - [SystemDataLastModifiedByType ]: The type of identity that last modified the resource. - [Lens ]: The dashboard lenses. + [Lens >]: The dashboard lenses. Order : The lens order. - Part : The dashboard parts. + Part >: The dashboard parts. PositionColSpan : The dashboard's part column span. PositionRowSpan : The dashboard's part row span. PositionX : The dashboard's part x coordinate. @@ -66,7 +60,7 @@ RESOURCE : The shared dashboard resource definition. https://learn.microsoft.com/powershell/module/az.portal/set-azportaldashboard #> function Set-AzPortalDashboard { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard])] [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -93,9 +87,8 @@ param( [Parameter(ParameterSetName='Update', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboard] # The shared dashboard resource definition. - # To construct, see NOTES section for RESOURCE properties and create a hash table. ${Resource}, [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] @@ -107,25 +100,36 @@ param( [Parameter(ParameterSetName='UpdateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardLens[]] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardLens[]] # The dashboard lenses. - # To construct, see NOTES section for LENS properties and create a hash table. ${Lens}, [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboardPropertiesWithProvisioningStateMetadata]))] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.IDashboardPropertiesWithProvisioningStateMetadata]))] [System.Collections.Hashtable] # The dashboard metadata. ${Metadata}, [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.ITrackedResourceTags]))] [System.Collections.Hashtable] # Resource tags. ${Tag}, + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -182,14 +186,17 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + $testPlayback = $false + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } $mapping = @{ Update = 'Az.Portal.private\Set-AzPortalDashboard_Update'; UpdateExpanded = 'Az.Portal.private\Set-AzPortalDashboard_UpdateExpanded'; + UpdateViaJsonFilePath = 'Az.Portal.private\Set-AzPortalDashboard_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.Portal.private\Set-AzPortalDashboard_UpdateViaJsonString'; } - if (('Update', 'UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $testPlayback = $false - $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } + if (('Update', 'UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { @@ -198,6 +205,9 @@ begin { } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + if ($wrappedCmd -eq $null) { + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) + } $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) diff --git a/generated/Portal/Portal.Autorest/resources/README.md b/generated/Portal/Portal.Autorest/resources/README.md new file mode 100644 index 000000000000..937f07f8fec2 --- /dev/null +++ b/generated/Portal/Portal.Autorest/resources/README.md @@ -0,0 +1,11 @@ +# Resources +This directory can contain any additional resources for module that are not required at runtime. This directory **does not** get packaged with the module. If you have assets for custom implementation, place them into the `..\custom` folder. + +## Info +- Modifiable: yes +- Generated: no +- Committed: yes +- Packaged: no + +## Purpose +Use this folder to put anything you want to keep around as part of the repository for the module, but is not something that is required for the module. For example, development files, packaged builds, or additional information. This is only intended to be used in repositories where the module's output directory is cleaned, but tangential resources for the module want to remain intact. \ No newline at end of file diff --git a/generated/Portal/Portal.Autorest/test-module.ps1 b/generated/Portal/Portal.Autorest/test-module.ps1 index 47b0cc9828a0..2dfe30ee634e 100644 --- a/generated/Portal/Portal.Autorest/test-module.ps1 +++ b/generated/Portal/Portal.Autorest/test-module.ps1 @@ -12,17 +12,17 @@ # 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) +param([switch]$NotIsolated, [switch]$Live, [switch]$Record, [switch]$Playback, [switch]$RegenerateSupportModule, [switch]$UsePreviousConfigForRecord, [string[]]$TestName) $ErrorActionPreference = 'Stop' -if(-not $Isolated) +if(-not $NotIsolated) { 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 + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated return } @@ -34,7 +34,7 @@ if ($PSBoundParameters.ContainsKey("TestName") -and ($TestName.count -eq 1) -and $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 +. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -NotIsolated -Accounts:$false -Pester -Resources:$requireResourceModule -RegenerateSupportModule:$RegenerateSupportModule . ("$PSScriptRoot\test\utils.ps1") if ($requireResourceModule) @@ -95,4 +95,4 @@ try } } -Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file +Write-Host -ForegroundColor Green '-------------Done-------------'