|
| 1 | + |
| 2 | +# ---------------------------------------------------------------------------------- |
| 3 | +# |
| 4 | +# Copyright Microsoft Corporation |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +# ---------------------------------------------------------------------------------- |
| 15 | + |
| 16 | +<# |
| 17 | +.Synopsis |
| 18 | +This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from the source repo. |
| 19 | +.Description |
| 20 | +This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from the source repo. |
| 21 | +.Example |
| 22 | +PS C:\> {{ Add code here }} |
| 23 | +
|
| 24 | +{{ Add output here }} |
| 25 | +.Example |
| 26 | +PS C:\> {{ Add code here }} |
| 27 | +
|
| 28 | +{{ Add output here }} |
| 29 | +
|
| 30 | +.Inputs |
| 31 | +Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Models.IKubernetesConfigurationIdentity |
| 32 | +.Outputs |
| 33 | +System.Boolean |
| 34 | +.Notes |
| 35 | +COMPLEX PARAMETER PROPERTIES |
| 36 | +
|
| 37 | +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. |
| 38 | +
|
| 39 | +INPUTOBJECT <IKubernetesConfigurationIdentity>: Identity Parameter |
| 40 | + [ClusterName <String>]: The name of the kubernetes cluster. |
| 41 | + [ClusterResourceName <String>]: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). |
| 42 | + [ClusterRp <String>]: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). |
| 43 | + [Id <String>]: Resource identity path |
| 44 | + [ResourceGroupName <String>]: The name of the resource group. |
| 45 | + [SourceControlConfigurationName <String>]: Name of the Source Control Configuration. |
| 46 | + [SubscriptionId <String>]: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000) |
| 47 | +.Link |
| 48 | +https://docs.microsoft.com/en-us/powershell/module/az.kubernetesconfiguration/remove-azkubernetesconfiguration |
| 49 | +#> |
| 50 | +function Remove-AzKubernetesConfiguration { |
| 51 | +[OutputType([System.Boolean])] |
| 52 | +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] |
| 53 | +param( |
| 54 | + [Parameter(ParameterSetName='Delete', Mandatory, HelpMessage="The name of the kubernetes cluster.")] |
| 55 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')] |
| 56 | + [System.String] |
| 57 | + # The name of the kubernetes cluster. |
| 58 | + ${ClusterName}, |
| 59 | + |
| 60 | + [Parameter(ParameterSetName='Delete', Mandatory, HelpMessage="The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters).")] |
| 61 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')] |
| 62 | + [System.String] |
| 63 | + # The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). |
| 64 | + ${ClusterType}, |
| 65 | + |
| 66 | + [Parameter(ParameterSetName='Delete', Mandatory, HelpMessage="Name of the Source Control Configuration.")] |
| 67 | + [Alias('SourceControlConfigurationName')] |
| 68 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')] |
| 69 | + [System.String] |
| 70 | + # Name of the Source Control Configuration. |
| 71 | + ${Name}, |
| 72 | + |
| 73 | + [Parameter(ParameterSetName='Delete', Mandatory, HelpMessage="The name of the resource group.")] |
| 74 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')] |
| 75 | + [System.String] |
| 76 | + # The name of the resource group. |
| 77 | + ${ResourceGroupName}, |
| 78 | + |
| 79 | + [Parameter(ParameterSetName='Delete', HelpMessage="The Azure subscription ID.")] |
| 80 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')] |
| 81 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] |
| 82 | + [System.String] |
| 83 | + # The Azure subscription ID. |
| 84 | + # This is a GUID-formatted string (e.g. |
| 85 | + # 00000000-0000-0000-0000-000000000000) |
| 86 | + ${SubscriptionId}, |
| 87 | + |
| 88 | + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline, HelpMessage="Identity Parameter")] |
| 89 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')] |
| 90 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Models.IKubernetesConfigurationIdentity] |
| 91 | + # Identity Parameter |
| 92 | + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. |
| 93 | + ${InputObject}, |
| 94 | + |
| 95 | + [Parameter()] |
| 96 | + [Alias('AzureRMContext', 'AzureCredential')] |
| 97 | + [ValidateNotNull()] |
| 98 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Azure')] |
| 99 | + [System.Management.Automation.PSObject] |
| 100 | + # The credentials, account, tenant, and subscription used for communication with Azure. |
| 101 | + ${DefaultProfile}, |
| 102 | + |
| 103 | + [Parameter()] |
| 104 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Runtime')] |
| 105 | + [System.Management.Automation.SwitchParameter] |
| 106 | + # Run the command as a job |
| 107 | + ${AsJob}, |
| 108 | + |
| 109 | + [Parameter(DontShow)] |
| 110 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Runtime')] |
| 111 | + [System.Management.Automation.SwitchParameter] |
| 112 | + # Wait for .NET debugger to attach |
| 113 | + ${Break}, |
| 114 | + |
| 115 | + [Parameter(DontShow)] |
| 116 | + [ValidateNotNull()] |
| 117 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Runtime')] |
| 118 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Runtime.SendAsyncStep[]] |
| 119 | + # SendAsync Pipeline Steps to be appended to the front of the pipeline |
| 120 | + ${HttpPipelineAppend}, |
| 121 | + |
| 122 | + [Parameter(DontShow)] |
| 123 | + [ValidateNotNull()] |
| 124 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Runtime')] |
| 125 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Runtime.SendAsyncStep[]] |
| 126 | + # SendAsync Pipeline Steps to be prepended to the front of the pipeline |
| 127 | + ${HttpPipelinePrepend}, |
| 128 | + |
| 129 | + [Parameter()] |
| 130 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Runtime')] |
| 131 | + [System.Management.Automation.SwitchParameter] |
| 132 | + # Run the command asynchronously |
| 133 | + ${NoWait}, |
| 134 | + |
| 135 | + [Parameter()] |
| 136 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Runtime')] |
| 137 | + [System.Management.Automation.SwitchParameter] |
| 138 | + # Returns true when the command succeeds |
| 139 | + ${PassThru}, |
| 140 | + |
| 141 | + [Parameter(DontShow)] |
| 142 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Runtime')] |
| 143 | + [System.Uri] |
| 144 | + # The URI for the proxy server to use |
| 145 | + ${Proxy}, |
| 146 | + |
| 147 | + [Parameter(DontShow)] |
| 148 | + [ValidateNotNull()] |
| 149 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Runtime')] |
| 150 | + [System.Management.Automation.PSCredential] |
| 151 | + # Credentials for a proxy server to use for the remote call |
| 152 | + ${ProxyCredential}, |
| 153 | + |
| 154 | + [Parameter(DontShow)] |
| 155 | + [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Runtime')] |
| 156 | + [System.Management.Automation.SwitchParameter] |
| 157 | + # Use the default credentials for the proxy |
| 158 | + ${ProxyUseDefaultCredentials} |
| 159 | +) |
| 160 | + |
| 161 | + |
| 162 | + process { |
| 163 | + |
| 164 | + if ($PSBoundParameters.ContainsKey('ClusterType')) { |
| 165 | + if ($ClusterType -eq 'ManagedClusters') { |
| 166 | + $PSBoundParameters.Add('ClusterRp', 'Microsoft.Kubernetes') |
| 167 | + } elseif ($ClusterType -eq 'ConnectedClusters') { |
| 168 | + $PSBoundParameters.Add('ClusterRp', 'Microsoft.ContainerService') |
| 169 | + } |
| 170 | + } |
| 171 | + |
| 172 | + Az.KubernetesConfiguration.internal\Remove-AzKubernetesConfiguration @PSBoundParameters |
| 173 | + } |
| 174 | +} |
0 commit comments