Skip to content

Commit

Permalink
Migrate Portal from generation to main (#27071)
Browse files Browse the repository at this point in the history
* Move Portal to main

* Update ChangeLog.md

---------

Co-authored-by: Yash <[email protected]>
  • Loading branch information
azure-powershell-bot and notyashhh authored Feb 5, 2025
1 parent 63cd140 commit 7259733
Show file tree
Hide file tree
Showing 189 changed files with 9,411 additions and 5,285 deletions.
364 changes: 312 additions & 52 deletions src/Portal/Portal.Autorest/Az.Portal.format.ps1xml

Large diffs are not rendered by default.

21 changes: 18 additions & 3 deletions src/Portal/Portal.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ In this directory, run AutoRest:
> see https://aka.ms/autorest
``` yaml
commit: 0dd49a444195fef7f3555cad038cb7665cbd928c
commit: 570ea717eb84ecf725399353d2b52a590353e589
require:
- $(this-folder)/../../readme.azure.noprofile.md
input-file:
- $(repo)/specification/portal/resource-manager/Microsoft.Portal/preview/2019-01-01-preview/portal.json
- $(repo)/specification/portal/resource-manager/Microsoft.Portal/preview/2022-12-01-preview/portal.json

metadata:
authors: Microsoft Corporation
Expand Down Expand Up @@ -73,6 +73,21 @@ directive:
subject: Dashboard
variant: ^Update$|^UpdateViaIdentity$
remove: true

- from: swagger-document
where: $.definitions.DashboardPropertiesWithProvisioningState.properties.metadata
transform: >-
return {
"type": "object",
"additionalProperties": {"type": "object"},
"description": "The dashboard metadata."
}
- from: swagger-document
where: $.definitions.DashboardProperties.properties.metadata
transform: >-
return {
"type": "object",
"additionalProperties": {"type": "object"},
"description": "The dashboard metadata."
}
```
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "dashboards",
"apiVersion": "2019-01-01-preview",
"apiVersion": "2022-12-01-preview",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.portal"
},
Expand Down
17 changes: 14 additions & 3 deletions src/Portal/Portal.Autorest/build-module.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
# is regenerated.
# ----------------------------------------------------------------------------------
param([switch]$Isolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs)
param([switch]$Isolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs, [Switch]$DisableAfterBuildTasks)
$ErrorActionPreference = 'Stop'

if($PSEdition -ne 'Core') {
Expand Down Expand Up @@ -67,6 +67,8 @@ if(-not $Isolated -and -not $Debugger) {
$binFolder = Join-Path $PSScriptRoot 'bin'
$objFolder = Join-Path $PSScriptRoot 'obj'

$isAzure = [System.Convert]::ToBoolean('true')

if(-not $Debugger) {
Write-Host -ForegroundColor Green 'Cleaning build folders...'
$null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path $binFolder, $objFolder
Expand Down Expand Up @@ -143,7 +145,7 @@ if($NoDocs) {
$null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
}
$null = New-Item -ItemType Directory -Force -Path $docsFolder
$addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true')
$addComplexInterfaceInfo = !$isAzure
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid -AddComplexInterfaceInfo:$addComplexInterfaceInfo
}

Expand All @@ -169,4 +171,13 @@ if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1'))
. (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')
}

Write-Host -ForegroundColor Green '-------------Done-------------'
if (-not $DisableAfterBuildTasks){
$afterBuildTasksPath = Join-Path $PSScriptRoot ''
$afterBuildTasksArgs = ConvertFrom-Json 'true' -AsHashtable
if(Test-Path -Path $afterBuildTasksPath -PathType leaf){
Write-Host -ForegroundColor Green 'Running after build tasks...'
. $afterBuildTasksPath @afterBuildTasksArgs
}
}

Write-Host -ForegroundColor Green '-------------Done-------------'
6 changes: 3 additions & 3 deletions src/Portal/Portal.Autorest/custom/New-AzPortalDashboard.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


function New-AzPortalDashboard {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api201901Preview.IDashboard])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard])]
[CmdletBinding(SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(ParameterSetName='CreateByFile', Mandatory)]
Expand Down Expand Up @@ -112,9 +112,9 @@ begin {
if (Test-Path $dashboardPath)
{
$content = (Get-content -Path $dashboardPath)
$deserializedContent = [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api201901Preview.Dashboard]::FromJsonString($content)
$deserializedContent = [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.Dashboard]::FromJsonString($content)
$PSBoundParameters.Remove('DashboardPath') | Out-Null
$PSBoundParameters.Add('Dashboard', $deserializedContent) | Out-Null
$PSBoundParameters.Add('Resource', $deserializedContent) | Out-Null
$scriptCmd = {& $wrappedCmd @PSBoundParameters}
$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
$steppablePipeline.Begin($PSCmdlet)
Expand Down
6 changes: 3 additions & 3 deletions src/Portal/Portal.Autorest/custom/Set-AzPortalDashboard.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


function Set-AzPortalDashboard {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api201901Preview.IDashboard])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard])]
[CmdletBinding(SupportsShouldProcess, PositionalBinding=$false, ConfirmImpact='Medium')]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Description("Creates or updates a Dashboard.")]
param(
Expand Down Expand Up @@ -112,9 +112,9 @@ begin {
if (Test-Path $dashboardPath)
{
$content = (Get-content -Path $dashboardPath)
$deserializedContent = [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api201901Preview.Dashboard]::FromJsonString($content)
$deserializedContent = [Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.Dashboard]::FromJsonString($content)
$PSBoundParameters.Remove('DashboardPath') | Out-Null
$PSBoundParameters.Add('Dashboard', $deserializedContent) | Out-Null
$PSBoundParameters.Add('Resource', $deserializedContent) | Out-Null
$scriptCmd = {& $wrappedCmd @PSBoundParameters}
$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
$steppablePipeline.Begin($PSCmdlet)
Expand Down
25 changes: 9 additions & 16 deletions src/Portal/Portal.Autorest/exports/Get-AzPortalDashboard.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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.Api201901Preview.IDashboard
Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard
.Notes
COMPLEX PARAMETER PROPERTIES
Expand All @@ -36,14 +36,14 @@ To create the parameters described below, construct a hash table containing the
INPUTOBJECT <IPortalIdentity>: Identity Parameter
[DashboardName <String>]: The name of the dashboard.
[Id <String>]: Resource identity path
[ResourceGroupName <String>]: The name of the resource group.
[SubscriptionId <String>]: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
[ResourceGroupName <String>]: The name of the resource group. The name is case insensitive.
[SubscriptionId <String>]: The ID of the target subscription. The value must be an UUID.
.Link
https://learn.microsoft.com/powershell/module/az.portal/get-azportaldashboard
#>
function Get-AzPortalDashboard {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api201901Preview.IDashboard])]
[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard])]
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
param(
[Parameter(ParameterSetName='Get', Mandatory)]
[Alias('DashboardName')]
Expand All @@ -53,10 +53,11 @@ param(
${Name},

[Parameter(ParameterSetName='Get', Mandatory)]
[Parameter(ParameterSetName='List', Mandatory)]
[Parameter(ParameterSetName='List1', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')]
[System.String]
# The name of the resource group.
# The name is case insensitive.
${ResourceGroupName},

[Parameter(ParameterSetName='Get')]
Expand All @@ -65,9 +66,8 @@ param(
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
[System.String[]]
# The Azure subscription ID.
# This is a GUID-formatted string (e.g.
# 00000000-0000-0000-0000-000000000000)
# The ID of the target subscription.
# The value must be an UUID.
${SubscriptionId},

[Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)]
Expand Down Expand Up @@ -106,13 +106,6 @@ param(
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
${HttpPipelinePrepend},

[Parameter(ParameterSetName='Get')]
[Parameter(ParameterSetName='GetViaIdentity')]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Returns true when the command succeeds
${PassThru},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Runtime')]
[System.Uri]
Expand Down
68 changes: 46 additions & 22 deletions src/Portal/Portal.Autorest/exports/New-AzPortalDashboard.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,50 @@ Creates or updates a Dashboard.
New-AzPortalDashboard -DashboardPath .\resources\dash1.json -ResourceGroupName mydash-rg -DashboardName my-dashboard03
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api201901Preview.IDashboard
Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api201901Preview.IDashboard
Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard
.Notes
COMPLEX PARAMETER PROPERTIES
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
DASHBOARD <IDashboard>: The shared dashboard resource definition.
Location <String>: Resource location
[Lens <IDashboardPropertiesLenses>]: The dashboard lenses.
[(Any) <IDashboardLens>]: This indicates any property can be added to this object.
[Metadata <IDashboardPropertiesMetadata>]: The dashboard metadata.
[(Any) <Object>]: This indicates any property can be added to this object.
[Tag <IDashboardTags>]: Resource tags
LENS <IDashboardLens[]>: The dashboard lenses.
Order <Int32>: The lens order.
Part <IDashboardParts[]>: The dashboard parts.
PositionColSpan <Int32>: The dashboard's part column span.
PositionRowSpan <Int32>: The dashboard's part row span.
PositionX <Int32>: The dashboard's part x coordinate.
PositionY <Int32>: The dashboard's part y coordinate.
[PositionMetadata <IAny>]: The dashboard part's metadata.
[Metadata <IAny>]: The dashboard len's metadata.
RESOURCE <IDashboard>: The shared dashboard resource definition.
Location <String>: The geo-location where the resource lives
[Tag <ITrackedResourceTags>]: Resource tags.
[(Any) <String>]: This indicates any property can be added to this object.
[SystemDataCreatedAt <DateTime?>]: The timestamp of resource creation (UTC).
[SystemDataCreatedBy <String>]: The identity that created the resource.
[SystemDataCreatedByType <CreatedByType?>]: The type of identity that created the resource.
[SystemDataLastModifiedAt <DateTime?>]: The timestamp of resource last modification (UTC)
[SystemDataLastModifiedBy <String>]: The identity that last modified the resource.
[SystemDataLastModifiedByType <CreatedByType?>]: The type of identity that last modified the resource.
[Lens <IDashboardLens[]>]: The dashboard lenses.
Order <Int32>: The lens order.
Part <IDashboardParts[]>: The dashboard parts.
PositionColSpan <Int32>: The dashboard's part column span.
PositionRowSpan <Int32>: The dashboard's part row span.
PositionX <Int32>: The dashboard's part x coordinate.
PositionY <Int32>: The dashboard's part y coordinate.
[PositionMetadata <IAny>]: The dashboard part's metadata.
[Metadata <IAny>]: The dashboard len's metadata.
[Metadata <IDashboardPropertiesWithProvisioningStateMetadata>]: The dashboard metadata.
[(Any) <Object>]: This indicates any property can be added to this object.
.Link
https://learn.microsoft.com/powershell/module/az.portal/new-azportaldashboard
#>
function New-AzPortalDashboard {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api201901Preview.IDashboard])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard])]
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(Mandatory)]
Expand All @@ -57,49 +80,50 @@ param(
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')]
[System.String]
# The name of the resource group.
# The name is case insensitive.
${ResourceGroupName},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
[System.String]
# The Azure subscription ID.
# This is a GUID-formatted string (e.g.
# 00000000-0000-0000-0000-000000000000)
# The ID of the target subscription.
# The value must be an UUID.
${SubscriptionId},

[Parameter(ParameterSetName='Create', Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api201901Preview.IDashboard]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.IDashboard]
# The shared dashboard resource definition.
# To construct, see NOTES section for DASHBOARD properties and create a hash table.
${Dashboard},
# To construct, see NOTES section for RESOURCE properties and create a hash table.
${Resource},

[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')]
[System.String]
# Resource location
# The geo-location where the resource lives
${Location},

[Parameter(ParameterSetName='CreateExpanded')]
[AllowEmptyCollection()]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api201901Preview.IDashboardPropertiesLenses]))]
[System.Collections.Hashtable]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.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.Api201901Preview.IDashboardPropertiesMetadata]))]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api20221201Preview.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.Api201901Preview.IDashboardTags]))]
[Microsoft.Azure.PowerShell.Cmdlets.Portal.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Portal.Models.Api50.ITrackedResourceTags]))]
[System.Collections.Hashtable]
# Resource tags
# Resource tags.
${Tag},

[Parameter(ParameterSetName='CreateByFile', Mandatory)]
Expand Down
Loading

0 comments on commit 7259733

Please sign in to comment.