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