|
| 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 a Branch |
| 20 | +.Description |
| 21 | +Get a Branch |
| 22 | +.Example |
| 23 | +Get-AzNeonPostgresBranch -ProjectName "dawn-breeze-86932056" -OrganizationName "NeonDemoOrgPS1" -ResourceGroupName "neonrg" -SubscriptionId "00000000-0000-0000-0000-000000000000" |
| 24 | +.Example |
| 25 | +Get-AzNeonPostgresBranch -Name "br-damp-bird-a82olmcu" -ProjectName "dawn-breeze-86932056" -OrganizationName "NeonDemoOrgPS1" -ResourceGroupName "neonrg" -SubscriptionId "00000000-0000-0000-0000-000000000000" |
| 26 | +
|
| 27 | +.Inputs |
| 28 | +Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Models.INeonPostgresIdentity |
| 29 | +.Outputs |
| 30 | +Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Models.IBranch |
| 31 | +.Notes |
| 32 | +COMPLEX PARAMETER PROPERTIES |
| 33 | +
|
| 34 | +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. |
| 35 | +
|
| 36 | +INPUTOBJECT <INeonPostgresIdentity>: Identity Parameter |
| 37 | + [BranchName <String>]: The name of the Branch |
| 38 | + [Id <String>]: Resource identity path |
| 39 | + [OrganizationName <String>]: Name of the Neon Organizations resource |
| 40 | + [ProjectName <String>]: The name of the Project |
| 41 | + [ResourceGroupName <String>]: The name of the resource group. The name is case insensitive. |
| 42 | + [SubscriptionId <String>]: The ID of the target subscription. The value must be an UUID. |
| 43 | +
|
| 44 | +ORGANIZATIONINPUTOBJECT <INeonPostgresIdentity>: Identity Parameter |
| 45 | + [BranchName <String>]: The name of the Branch |
| 46 | + [Id <String>]: Resource identity path |
| 47 | + [OrganizationName <String>]: Name of the Neon Organizations resource |
| 48 | + [ProjectName <String>]: The name of the Project |
| 49 | + [ResourceGroupName <String>]: The name of the resource group. The name is case insensitive. |
| 50 | + [SubscriptionId <String>]: The ID of the target subscription. The value must be an UUID. |
| 51 | +
|
| 52 | +PROJECTINPUTOBJECT <INeonPostgresIdentity>: Identity Parameter |
| 53 | + [BranchName <String>]: The name of the Branch |
| 54 | + [Id <String>]: Resource identity path |
| 55 | + [OrganizationName <String>]: Name of the Neon Organizations resource |
| 56 | + [ProjectName <String>]: The name of the Project |
| 57 | + [ResourceGroupName <String>]: The name of the resource group. The name is case insensitive. |
| 58 | + [SubscriptionId <String>]: The ID of the target subscription. The value must be an UUID. |
| 59 | +.Link |
| 60 | +https://learn.microsoft.com/powershell/module/az.neonpostgres/get-azneonpostgresbranch |
| 61 | +#> |
| 62 | +function Get-AzNeonPostgresBranch { |
| 63 | +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Models.IBranch])] |
| 64 | +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] |
| 65 | +param( |
| 66 | + [Parameter(ParameterSetName='Get', Mandatory)] |
| 67 | + [Parameter(ParameterSetName='GetViaIdentityOrganization', Mandatory)] |
| 68 | + [Parameter(ParameterSetName='GetViaIdentityProject', Mandatory)] |
| 69 | + [Alias('BranchName')] |
| 70 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Path')] |
| 71 | + [System.String] |
| 72 | + # The name of the Branch |
| 73 | + ${Name}, |
| 74 | + |
| 75 | + [Parameter(ParameterSetName='Get', Mandatory)] |
| 76 | + [Parameter(ParameterSetName='List', Mandatory)] |
| 77 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Path')] |
| 78 | + [System.String] |
| 79 | + # Name of the Neon Organizations resource |
| 80 | + ${OrganizationName}, |
| 81 | + |
| 82 | + [Parameter(ParameterSetName='Get', Mandatory)] |
| 83 | + [Parameter(ParameterSetName='GetViaIdentityOrganization', Mandatory)] |
| 84 | + [Parameter(ParameterSetName='List', Mandatory)] |
| 85 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Path')] |
| 86 | + [System.String] |
| 87 | + # The name of the Project |
| 88 | + ${ProjectName}, |
| 89 | + |
| 90 | + [Parameter(ParameterSetName='Get', Mandatory)] |
| 91 | + [Parameter(ParameterSetName='List', Mandatory)] |
| 92 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Path')] |
| 93 | + [System.String] |
| 94 | + # The name of the resource group. |
| 95 | + # The name is case insensitive. |
| 96 | + ${ResourceGroupName}, |
| 97 | + |
| 98 | + [Parameter(ParameterSetName='Get')] |
| 99 | + [Parameter(ParameterSetName='List')] |
| 100 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Path')] |
| 101 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] |
| 102 | + [System.String[]] |
| 103 | + # The ID of the target subscription. |
| 104 | + # The value must be an UUID. |
| 105 | + ${SubscriptionId}, |
| 106 | + |
| 107 | + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] |
| 108 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Path')] |
| 109 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Models.INeonPostgresIdentity] |
| 110 | + # Identity Parameter |
| 111 | + ${InputObject}, |
| 112 | + |
| 113 | + [Parameter(ParameterSetName='GetViaIdentityOrganization', Mandatory, ValueFromPipeline)] |
| 114 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Path')] |
| 115 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Models.INeonPostgresIdentity] |
| 116 | + # Identity Parameter |
| 117 | + ${OrganizationInputObject}, |
| 118 | + |
| 119 | + [Parameter(ParameterSetName='GetViaIdentityProject', Mandatory, ValueFromPipeline)] |
| 120 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Path')] |
| 121 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Models.INeonPostgresIdentity] |
| 122 | + # Identity Parameter |
| 123 | + ${ProjectInputObject}, |
| 124 | + |
| 125 | + [Parameter()] |
| 126 | + [Alias('AzureRMContext', 'AzureCredential')] |
| 127 | + [ValidateNotNull()] |
| 128 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Azure')] |
| 129 | + [System.Management.Automation.PSObject] |
| 130 | + # The DefaultProfile parameter is not functional. |
| 131 | + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. |
| 132 | + ${DefaultProfile}, |
| 133 | + |
| 134 | + [Parameter(DontShow)] |
| 135 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Runtime')] |
| 136 | + [System.Management.Automation.SwitchParameter] |
| 137 | + # Wait for .NET debugger to attach |
| 138 | + ${Break}, |
| 139 | + |
| 140 | + [Parameter(DontShow)] |
| 141 | + [ValidateNotNull()] |
| 142 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Runtime')] |
| 143 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Runtime.SendAsyncStep[]] |
| 144 | + # SendAsync Pipeline Steps to be appended to the front of the pipeline |
| 145 | + ${HttpPipelineAppend}, |
| 146 | + |
| 147 | + [Parameter(DontShow)] |
| 148 | + [ValidateNotNull()] |
| 149 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Runtime')] |
| 150 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Runtime.SendAsyncStep[]] |
| 151 | + # SendAsync Pipeline Steps to be prepended to the front of the pipeline |
| 152 | + ${HttpPipelinePrepend}, |
| 153 | + |
| 154 | + [Parameter(DontShow)] |
| 155 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Runtime')] |
| 156 | + [System.Uri] |
| 157 | + # The URI for the proxy server to use |
| 158 | + ${Proxy}, |
| 159 | + |
| 160 | + [Parameter(DontShow)] |
| 161 | + [ValidateNotNull()] |
| 162 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Runtime')] |
| 163 | + [System.Management.Automation.PSCredential] |
| 164 | + # Credentials for a proxy server to use for the remote call |
| 165 | + ${ProxyCredential}, |
| 166 | + |
| 167 | + [Parameter(DontShow)] |
| 168 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Category('Runtime')] |
| 169 | + [System.Management.Automation.SwitchParameter] |
| 170 | + # Use the default credentials for the proxy |
| 171 | + ${ProxyUseDefaultCredentials} |
| 172 | +) |
| 173 | + |
| 174 | +begin { |
| 175 | + try { |
| 176 | + $outBuffer = $null |
| 177 | + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { |
| 178 | + $PSBoundParameters['OutBuffer'] = 1 |
| 179 | + } |
| 180 | + $parameterSet = $PSCmdlet.ParameterSetName |
| 181 | + |
| 182 | + $testPlayback = $false |
| 183 | + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } |
| 184 | + |
| 185 | + $context = Get-AzContext |
| 186 | + if (-not $context -and -not $testPlayback) { |
| 187 | + Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in." |
| 188 | + exit |
| 189 | + } |
| 190 | + |
| 191 | + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { |
| 192 | + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() |
| 193 | + } |
| 194 | + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId |
| 195 | + if ($preTelemetryId -eq '') { |
| 196 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() |
| 197 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) |
| 198 | + } else { |
| 199 | + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets |
| 200 | + if ($internalCalledCmdlets -eq '') { |
| 201 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name |
| 202 | + } else { |
| 203 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name |
| 204 | + } |
| 205 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' |
| 206 | + } |
| 207 | + |
| 208 | + $mapping = @{ |
| 209 | + Get = 'Az.NeonPostgres.private\Get-AzNeonPostgresBranch_Get'; |
| 210 | + GetViaIdentity = 'Az.NeonPostgres.private\Get-AzNeonPostgresBranch_GetViaIdentity'; |
| 211 | + GetViaIdentityOrganization = 'Az.NeonPostgres.private\Get-AzNeonPostgresBranch_GetViaIdentityOrganization'; |
| 212 | + GetViaIdentityProject = 'Az.NeonPostgres.private\Get-AzNeonPostgresBranch_GetViaIdentityProject'; |
| 213 | + List = 'Az.NeonPostgres.private\Get-AzNeonPostgresBranch_List'; |
| 214 | + } |
| 215 | + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { |
| 216 | + if ($testPlayback) { |
| 217 | + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') |
| 218 | + } else { |
| 219 | + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id |
| 220 | + } |
| 221 | + } |
| 222 | + $cmdInfo = Get-Command -Name $mapping[$parameterSet] |
| 223 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) |
| 224 | + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ |
| 225 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) |
| 226 | + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) |
| 227 | + } |
| 228 | + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) |
| 229 | + if ($wrappedCmd -eq $null) { |
| 230 | + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) |
| 231 | + } |
| 232 | + $scriptCmd = {& $wrappedCmd @PSBoundParameters} |
| 233 | + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) |
| 234 | + $steppablePipeline.Begin($PSCmdlet) |
| 235 | + } catch { |
| 236 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 237 | + throw |
| 238 | + } |
| 239 | +} |
| 240 | + |
| 241 | +process { |
| 242 | + try { |
| 243 | + $steppablePipeline.Process($_) |
| 244 | + } catch { |
| 245 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 246 | + throw |
| 247 | + } |
| 248 | + |
| 249 | + finally { |
| 250 | + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId |
| 251 | + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets |
| 252 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 253 | + } |
| 254 | + |
| 255 | +} |
| 256 | +end { |
| 257 | + try { |
| 258 | + $steppablePipeline.End() |
| 259 | + |
| 260 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId |
| 261 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets |
| 262 | + if ($preTelemetryId -eq '') { |
| 263 | + [Microsoft.Azure.PowerShell.Cmdlets.NeonPostgres.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) |
| 264 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 265 | + } |
| 266 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId |
| 267 | + |
| 268 | + } catch { |
| 269 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 270 | + throw |
| 271 | + } |
| 272 | +} |
| 273 | +} |
0 commit comments