|
| 1 | + |
| 2 | +# ---------------------------------------------------------------------------------- |
| 3 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# Unless required by applicable law or agreed to in writing, software |
| 9 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +# See the License for the specific language governing permissions and |
| 12 | +# limitations under the License. |
| 13 | +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code |
| 14 | +# is regenerated. |
| 15 | +# ---------------------------------------------------------------------------------- |
| 16 | + |
| 17 | +<# |
| 18 | +.Synopsis |
| 19 | +Get the properties of a specific dashboard for grafana resource. |
| 20 | +.Description |
| 21 | +Get the properties of a specific dashboard for grafana resource. |
| 22 | +.Example |
| 23 | +Get-AzGrafanaDashboard |
| 24 | +.Example |
| 25 | +Get-AzGrafanaDashboard -ResourceGroupName azpstest-gp |
| 26 | +.Example |
| 27 | +Get-AzGrafanaDashboard -ResourceGroupName azpstest-gp -Name dashboard-01 |
| 28 | +
|
| 29 | +.Inputs |
| 30 | +Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Models.IDashboardIdentity |
| 31 | +.Outputs |
| 32 | +Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Models.IManagedDashboard |
| 33 | +.Notes |
| 34 | +COMPLEX PARAMETER PROPERTIES |
| 35 | +
|
| 36 | +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. |
| 37 | +
|
| 38 | +INPUTOBJECT <IDashboardIdentity>: Identity Parameter |
| 39 | + [DashboardName <String>]: The name of the Azure Managed Dashboard. |
| 40 | + [Id <String>]: Resource identity path |
| 41 | + [IntegrationFabricName <String>]: The integration fabric name of Azure Managed Grafana. |
| 42 | + [ManagedPrivateEndpointName <String>]: The managed private endpoint name of Azure Managed Grafana. |
| 43 | + [PrivateEndpointConnectionName <String>]: The private endpoint connection name of Azure Managed Grafana. |
| 44 | + [PrivateLinkResourceName <String>]: |
| 45 | + [ResourceGroupName <String>]: The name of the resource group. The name is case insensitive. |
| 46 | + [SubscriptionId <String>]: The ID of the target subscription. |
| 47 | + [WorkspaceName <String>]: The workspace name of Azure Managed Grafana. |
| 48 | +.Link |
| 49 | +https://learn.microsoft.com/powershell/module/az.dashboard/get-azgrafanadashboard |
| 50 | +#> |
| 51 | +function Get-AzGrafanaDashboard { |
| 52 | +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Models.IManagedDashboard])] |
| 53 | +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] |
| 54 | +param( |
| 55 | + [Parameter(ParameterSetName='Get', Mandatory)] |
| 56 | + [Alias('DashboardName')] |
| 57 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Category('Path')] |
| 58 | + [System.String] |
| 59 | + # The name of the Azure Managed Dashboard. |
| 60 | + ${Name}, |
| 61 | + |
| 62 | + [Parameter(ParameterSetName='Get', Mandatory)] |
| 63 | + [Parameter(ParameterSetName='List1', Mandatory)] |
| 64 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Category('Path')] |
| 65 | + [System.String] |
| 66 | + # The name of the resource group. |
| 67 | + # The name is case insensitive. |
| 68 | + ${ResourceGroupName}, |
| 69 | + |
| 70 | + [Parameter(ParameterSetName='Get')] |
| 71 | + [Parameter(ParameterSetName='List')] |
| 72 | + [Parameter(ParameterSetName='List1')] |
| 73 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Category('Path')] |
| 74 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] |
| 75 | + [System.String[]] |
| 76 | + # The ID of the target subscription. |
| 77 | + ${SubscriptionId}, |
| 78 | + |
| 79 | + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] |
| 80 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Category('Path')] |
| 81 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Models.IDashboardIdentity] |
| 82 | + # Identity Parameter |
| 83 | + ${InputObject}, |
| 84 | + |
| 85 | + [Parameter()] |
| 86 | + [Alias('AzureRMContext', 'AzureCredential')] |
| 87 | + [ValidateNotNull()] |
| 88 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Category('Azure')] |
| 89 | + [System.Management.Automation.PSObject] |
| 90 | + # The DefaultProfile parameter is not functional. |
| 91 | + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. |
| 92 | + ${DefaultProfile}, |
| 93 | + |
| 94 | + [Parameter(DontShow)] |
| 95 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Category('Runtime')] |
| 96 | + [System.Management.Automation.SwitchParameter] |
| 97 | + # Wait for .NET debugger to attach |
| 98 | + ${Break}, |
| 99 | + |
| 100 | + [Parameter(DontShow)] |
| 101 | + [ValidateNotNull()] |
| 102 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Category('Runtime')] |
| 103 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Runtime.SendAsyncStep[]] |
| 104 | + # SendAsync Pipeline Steps to be appended to the front of the pipeline |
| 105 | + ${HttpPipelineAppend}, |
| 106 | + |
| 107 | + [Parameter(DontShow)] |
| 108 | + [ValidateNotNull()] |
| 109 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Category('Runtime')] |
| 110 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Runtime.SendAsyncStep[]] |
| 111 | + # SendAsync Pipeline Steps to be prepended to the front of the pipeline |
| 112 | + ${HttpPipelinePrepend}, |
| 113 | + |
| 114 | + [Parameter(DontShow)] |
| 115 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Category('Runtime')] |
| 116 | + [System.Uri] |
| 117 | + # The URI for the proxy server to use |
| 118 | + ${Proxy}, |
| 119 | + |
| 120 | + [Parameter(DontShow)] |
| 121 | + [ValidateNotNull()] |
| 122 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Category('Runtime')] |
| 123 | + [System.Management.Automation.PSCredential] |
| 124 | + # Credentials for a proxy server to use for the remote call |
| 125 | + ${ProxyCredential}, |
| 126 | + |
| 127 | + [Parameter(DontShow)] |
| 128 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Category('Runtime')] |
| 129 | + [System.Management.Automation.SwitchParameter] |
| 130 | + # Use the default credentials for the proxy |
| 131 | + ${ProxyUseDefaultCredentials} |
| 132 | +) |
| 133 | + |
| 134 | +begin { |
| 135 | + try { |
| 136 | + $outBuffer = $null |
| 137 | + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { |
| 138 | + $PSBoundParameters['OutBuffer'] = 1 |
| 139 | + } |
| 140 | + $parameterSet = $PSCmdlet.ParameterSetName |
| 141 | + |
| 142 | + $testPlayback = $false |
| 143 | + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } |
| 144 | + |
| 145 | + $context = Get-AzContext |
| 146 | + if (-not $context -and -not $testPlayback) { |
| 147 | + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." |
| 148 | + exit |
| 149 | + } |
| 150 | + |
| 151 | + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { |
| 152 | + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() |
| 153 | + } |
| 154 | + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId |
| 155 | + if ($preTelemetryId -eq '') { |
| 156 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() |
| 157 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) |
| 158 | + } else { |
| 159 | + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets |
| 160 | + if ($internalCalledCmdlets -eq '') { |
| 161 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name |
| 162 | + } else { |
| 163 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name |
| 164 | + } |
| 165 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' |
| 166 | + } |
| 167 | + |
| 168 | + $mapping = @{ |
| 169 | + Get = 'Az.Dashboard.private\Get-AzGrafanaDashboard_Get'; |
| 170 | + GetViaIdentity = 'Az.Dashboard.private\Get-AzGrafanaDashboard_GetViaIdentity'; |
| 171 | + List = 'Az.Dashboard.private\Get-AzGrafanaDashboard_List'; |
| 172 | + List1 = 'Az.Dashboard.private\Get-AzGrafanaDashboard_List1'; |
| 173 | + } |
| 174 | + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { |
| 175 | + if ($testPlayback) { |
| 176 | + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') |
| 177 | + } else { |
| 178 | + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id |
| 179 | + } |
| 180 | + } |
| 181 | + $cmdInfo = Get-Command -Name $mapping[$parameterSet] |
| 182 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) |
| 183 | + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ |
| 184 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) |
| 185 | + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) |
| 186 | + } |
| 187 | + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) |
| 188 | + if ($wrappedCmd -eq $null) { |
| 189 | + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) |
| 190 | + } |
| 191 | + $scriptCmd = {& $wrappedCmd @PSBoundParameters} |
| 192 | + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) |
| 193 | + $steppablePipeline.Begin($PSCmdlet) |
| 194 | + } catch { |
| 195 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 196 | + throw |
| 197 | + } |
| 198 | +} |
| 199 | + |
| 200 | +process { |
| 201 | + try { |
| 202 | + $steppablePipeline.Process($_) |
| 203 | + } catch { |
| 204 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 205 | + throw |
| 206 | + } |
| 207 | + |
| 208 | + finally { |
| 209 | + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId |
| 210 | + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets |
| 211 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 212 | + } |
| 213 | + |
| 214 | +} |
| 215 | +end { |
| 216 | + try { |
| 217 | + $steppablePipeline.End() |
| 218 | + |
| 219 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId |
| 220 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets |
| 221 | + if ($preTelemetryId -eq '') { |
| 222 | + [Microsoft.Azure.PowerShell.Cmdlets.Dashboard.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) |
| 223 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 224 | + } |
| 225 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId |
| 226 | + |
| 227 | + } catch { |
| 228 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 229 | + throw |
| 230 | + } |
| 231 | +} |
| 232 | +} |
0 commit comments