Skip to content

Commit afb0993

Browse files
committed
sync
1 parent e8cde82 commit afb0993

File tree

4 files changed

+526
-0
lines changed

4 files changed

+526
-0
lines changed
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
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+
Create a new Kubernetes Source Control Configuration.
19+
.Description
20+
Create a new Kubernetes Source Control Configuration.
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+
.Outputs
31+
Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Models.Api20191101Preview.ISourceControlConfiguration
32+
.Link
33+
https://docs.microsoft.com/en-us/powershell/module/az.kubernetesconfiguration/new-azsourcecontrolconfiguration
34+
#>
35+
function New-AzKubernetesConfiguration {
36+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Models.Api20191101Preview.ISourceControlConfiguration])]
37+
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
38+
param(
39+
[Parameter(Mandatory)]
40+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')]
41+
[System.String]
42+
# The name of the kubernetes cluster.
43+
${ClusterName},
44+
45+
[Parameter(Mandatory)]
46+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')]
47+
[System.String]
48+
# The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters).
49+
${ClusterResourceName},
50+
51+
[Parameter(Mandatory)]
52+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')]
53+
[System.String]
54+
# The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters).
55+
${ClusterRp},
56+
57+
[Parameter(Mandatory)]
58+
[Alias('SourceControlConfigurationName')]
59+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')]
60+
[System.String]
61+
# Name of the Source Control Configuration.
62+
${Name},
63+
64+
[Parameter(Mandatory)]
65+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')]
66+
[System.String]
67+
# The name of the resource group.
68+
${ResourceGroupName},
69+
70+
[Parameter()]
71+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Path')]
72+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
73+
[System.String]
74+
# The Azure subscription ID.
75+
# This is a GUID-formatted string (e.g.
76+
# 00000000-0000-0000-0000-000000000000)
77+
${SubscriptionId},
78+
79+
[Parameter()]
80+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
81+
[System.DateTime]
82+
# Datetime the configuration was last applied.
83+
${ComplianceStatusLastConfigApplied},
84+
85+
[Parameter()]
86+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
87+
[System.String]
88+
# Message from when the configuration was applied.
89+
${ComplianceStatusMessage},
90+
91+
[Parameter()]
92+
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Support.MessageLevel])]
93+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
94+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Support.MessageLevel]
95+
# Level of the message.
96+
${ComplianceStatusMessageLevel},
97+
98+
[Parameter(Mandatory)]
99+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
100+
[System.String]
101+
# Url of the SourceControl Repository.
102+
${RepositoryUrl},
103+
104+
[Parameter()]
105+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
106+
[switch]
107+
# Option to enable Helm Operator for this git configuration.
108+
${EnableHelmOperator},
109+
110+
[Parameter()]
111+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
112+
[System.String]
113+
# Values override for the operator Helm chart.
114+
${HelmOperatorChartValues},
115+
116+
[Parameter()]
117+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
118+
[System.String]
119+
# Version of the operator Helm chart.
120+
${HelmOperatorChartVersion},
121+
122+
[Parameter()]
123+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
124+
[System.String]
125+
# Instance name of the operator - identifying the specific configuration.
126+
${OperatorInstanceName},
127+
128+
[Parameter()]
129+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
130+
[System.String]
131+
# The namespace to which this operator is installed to.
132+
# Maximum of 253 lower case alphanumeric characters, hyphen and period only.
133+
${OperatorNamespace},
134+
135+
[Parameter()]
136+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Body')]
137+
[System.String]
138+
# Any Parameters for the Operator instance in string format.
139+
${OperatorParameters},
140+
141+
[Parameter(HelpMessage="If passed set the scope of the Configuration to Cluster (default is nameSpace).")]
142+
[switch]
143+
${ClusterScoped},
144+
145+
[Parameter()]
146+
[Alias('AzureRMContext', 'AzureCredential')]
147+
[ValidateNotNull()]
148+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Category('Azure')]
149+
[System.Management.Automation.PSObject]
150+
# The credentials, account, tenant, and subscription used for communication with Azure.
151+
${DefaultProfile},
152+
153+
[Parameter(DontShow)]
154+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.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.KubernetesConfiguration.Category('Runtime')]
162+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.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.KubernetesConfiguration.Category('Runtime')]
169+
[Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.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.KubernetesConfiguration.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.KubernetesConfiguration.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.KubernetesConfiguration.Category('Runtime')]
188+
[System.Management.Automation.SwitchParameter]
189+
# Use the default credentials for the proxy
190+
${ProxyUseDefaultCredentials}
191+
)
192+
193+
process {
194+
195+
if ($PSBoundParameters.ContainsKey('EnableHelmOperator')) {
196+
$PSBoundParameters.EnableHelmOperator = [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Support.EnableHelmOperator]::True
197+
} else {
198+
$PSBoundParameters.EnableHelmOperator = [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Support.EnableHelmOperator]::False
199+
}
200+
201+
if ($PSBoundParameters.ContainsKey('ClusterScoped')) {
202+
$PSBoundParameters.OperatorScope = [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Support.OperatorScope]::Cluster
203+
} else {
204+
$PSBoundParameters.OperatorScope = [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Support.OperatorScope]::Namespace
205+
}
206+
207+
if ($PSBoundParameters.ContainsKey('HelmOperatorChartValues')) {
208+
$PSBoundParameters.Add('HelmOperatorPropertyChartValue', $HelmOperatorChartValues)
209+
$null = $PSBoundParameters.Remove('HelmOperatorChartValues')
210+
}
211+
212+
if ($PSBoundParameters.ContainsKey('HelmOperatorChartVersion')) {
213+
$PSBoundParameters.Add('HelmOperatorPropertyChartVersion', $HelmOperatorChartVersion)
214+
$null = $PSBoundParameters.Remove('HelmOperatorChartVersion')
215+
}
216+
217+
if ($PSBoundParameters.ContainsKey('OperatorParam')) {
218+
$PSBoundParameters.Add('OperatorParameters', $OperatorParam)
219+
$null = $PSBoundParameters.Remove('OperatorParam')
220+
}
221+
$PSBoundParameters.Add('OperatorType', [Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Support.OperatorType]::Flux)
222+
223+
224+
Az.KubernetesConfiguration.internal\New-AzKubernetesConfiguration @PSBoundParameters
225+
}
226+
}

0 commit comments

Comments
 (0)