Skip to content

Commit 774dbd5

Browse files
committed
Add HelpMessage for custom cmdlets.
1 parent 2268411 commit 774dbd5

File tree

3 files changed

+186
-254
lines changed

3 files changed

+186
-254
lines changed

src/KubernetesConfiguration/custom/New-AzKubernetesConfiguration.ps1

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,32 +36,32 @@ function New-AzKubernetesConfiguration {
3636
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Models.Api20191101Preview.ISourceControlConfiguration])]
3737
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
3838
param(
39-
[Parameter(Mandatory)]
39+
[Parameter(Mandatory, HelpMessage="The name of the kubernetes cluster.")]
4040
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')]
4141
[System.String]
4242
# The name of the kubernetes cluster.
4343
${ClusterName},
4444

45-
[Parameter()]
45+
[Parameter(HelpMessage="The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters).")]
4646
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')]
4747
[System.String]
4848
# The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters).
4949
${ClusterType},
5050

51-
[Parameter(Mandatory)]
51+
[Parameter(Mandatory, HelpMessage="Name of the Source Control Configuration.")]
5252
[Alias('SourceControlConfigurationName')]
5353
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')]
5454
[System.String]
5555
# Name of the Source Control Configuration.
5656
${Name},
5757

58-
[Parameter(Mandatory)]
58+
[Parameter(Mandatory, HelpMessage="The name of the resource group.")]
5959
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')]
6060
[System.String]
6161
# The name of the resource group.
6262
${ResourceGroupName},
6363

64-
[Parameter()]
64+
[Parameter(HelpMessage="The Azure subscription ID.")]
6565
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')]
6666
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
6767
[System.String]
@@ -70,44 +70,44 @@ function New-AzKubernetesConfiguration {
7070
# 00000000-0000-0000-0000-000000000000)
7171
${SubscriptionId},
7272

73-
[Parameter(Mandatory)]
73+
[Parameter(Mandatory, HelpMessage="Url of the SourceControl Repository.")]
7474
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
7575
[System.String]
7676
# Url of the SourceControl Repository.
7777
${RepositoryUrl},
7878

79-
[Parameter()]
79+
[Parameter(HelpMessage="Option to enable Helm Operator for this git configuration.")]
8080
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
8181
[switch]
8282
# Option to enable Helm Operator for this git configuration.
8383
${EnableHelmOperator},
8484

85-
[Parameter()]
85+
[Parameter(HelpMessage="Values override for the operator Helm chart.")]
8686
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
8787
[System.String]
8888
# Values override for the operator Helm chart.
8989
${HelmOperatorChartValues},
9090

91-
[Parameter()]
91+
[Parameter(HelpMessage="Version of the operator Helm chart.")]
9292
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
9393
[System.String]
9494
# Version of the operator Helm chart.
9595
${HelmOperatorChartVersion},
9696

97-
[Parameter()]
97+
[Parameter(HelpMessage="Instance name of the operator - identifying the specific configuration.")]
9898
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
9999
[System.String]
100100
# Instance name of the operator - identifying the specific configuration.
101101
${OperatorInstanceName},
102102

103-
[Parameter()]
103+
[Parameter(HelpMessage="The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only.")]
104104
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
105105
[System.String]
106106
# The namespace to which this operator is installed to.
107107
# Maximum of 253 lower case alphanumeric characters, hyphen and period only.
108108
${OperatorNamespace},
109109

110-
[Parameter()]
110+
[Parameter(HelpMessage="Any Parameters for the Operator instance in string format.")]
111111
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
112112
[System.String]
113113
# Any Parameters for the Operator instance in string format.
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
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

Comments
 (0)