Skip to content

Commit 90610d6

Browse files
dolauliazurepowershellwyunchi-ms
authored
Move kusto to release-2021-05-25 (#15046)
* Move Kusto to release-2021-05-25 * Add change log for kusto * Clean en-us from kusto help (#15048) * Suppress breaking change warnings for kusto (#15051) Co-authored-by: azurepowershell <[email protected]> Co-authored-by: Yunchi Wang <[email protected]>
1 parent ee8ea08 commit 90610d6

File tree

674 files changed

+37491
-19682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

674 files changed

+37491
-19682
lines changed

src/Kusto/Az.Kusto.format.ps1xml

Lines changed: 432 additions & 100 deletions
Large diffs are not rendered by default.

src/Kusto/Az.Kusto.psd1

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 12/24/2020
6+
# Generated on: 5/19/2021
77
#
88

99
@{
@@ -45,7 +45,7 @@ PowerShellVersion = '5.1'
4545
DotNetFrameworkVersion = '4.7.2'
4646

4747
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
48-
# CLRVersion = ''
48+
# ClrVersion = ''
4949

5050
# Processor architecture (None, X86, Amd64) required by this module
5151
# ProcessorArchitecture = ''
@@ -77,27 +77,29 @@ FunctionsToExport = 'Add-AzKustoClusterLanguageExtension',
7777
'Get-AzKustoClusterPrincipalAssignment', 'Get-AzKustoClusterSku',
7878
'Get-AzKustoDatabase', 'Get-AzKustoDatabasePrincipal',
7979
'Get-AzKustoDatabasePrincipalAssignment',
80-
'Get-AzKustoDataConnection',
81-
'Invoke-AzKustoDataConnectionValidation',
80+
'Get-AzKustoDataConnection', 'Get-AzKustoOperationsResult',
81+
'Get-AzKustoScript', 'Invoke-AzKustoDataConnectionValidation',
8282
'Invoke-AzKustoDetachClusterFollowerDatabase',
8383
'Invoke-AzKustoDiagnoseClusterVirtualNetwork',
8484
'New-AzKustoAttachedDatabaseConfiguration', 'New-AzKustoCluster',
8585
'New-AzKustoClusterPrincipalAssignment', 'New-AzKustoDatabase',
8686
'New-AzKustoDatabasePrincipalAssignment',
87-
'New-AzKustoDataConnection',
87+
'New-AzKustoDataConnection', 'New-AzKustoScript',
8888
'Remove-AzKustoAttachedDatabaseConfiguration',
8989
'Remove-AzKustoCluster', 'Remove-AzKustoClusterLanguageExtension',
9090
'Remove-AzKustoClusterPrincipalAssignment',
9191
'Remove-AzKustoDatabase', 'Remove-AzKustoDatabasePrincipal',
9292
'Remove-AzKustoDatabasePrincipalAssignment',
93-
'Remove-AzKustoDataConnection', 'Start-AzKustoCluster',
94-
'Stop-AzKustoCluster', 'Test-AzKustoClusterNameAvailability',
93+
'Remove-AzKustoDataConnection', 'Remove-AzKustoScript',
94+
'Start-AzKustoCluster', 'Stop-AzKustoCluster',
95+
'Test-AzKustoClusterNameAvailability',
9596
'Test-AzKustoClusterPrincipalAssignmentNameAvailability',
9697
'Test-AzKustoDatabaseNameAvailability',
9798
'Test-AzKustoDatabasePrincipalAssignmentNameAvailability',
9899
'Test-AzKustoDataConnectionNameAvailability',
99-
'Update-AzKustoCluster', 'Update-AzKustoDatabase',
100-
'Update-AzKustoDataConnection'
100+
'Test-AzKustoScriptNameAvailability', 'Update-AzKustoCluster',
101+
'Update-AzKustoDatabase', 'Update-AzKustoDataConnection',
102+
'Update-AzKustoScript'
101103

102104
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
103105
CmdletsToExport = @()
@@ -135,7 +137,7 @@ PrivateData = @{
135137
# IconUri = ''
136138

137139
# ReleaseNotes of this module
138-
ReleaseNotes = '* Updated API version to 2020-09-18.'
140+
# ReleaseNotes = ''
139141

140142
# Prerelease string of this module
141143
# Prerelease = ''

src/Kusto/Az.Kusto.psm1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
}
2525
}
2626
if(-not $accountsModule) {
27-
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'1.8.1' } | Measure-Object).Count -gt 0
27+
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.2.3' } | Measure-Object).Count -gt 0
2828
if($hasAdequateVersion) {
29-
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 1.8.1 -Scope Global -PassThru
29+
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.2.3 -Scope Global -PassThru
3030
}
3131
}
3232
}
3333

3434
if(-not $accountsModule) {
35-
Write-Error "`nThis module requires $accountsName version 1.8.1 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop
36-
} elseif (($accountsModule.Version -lt [System.Version]'1.8.1') -and (-not $localAccounts)) {
37-
Write-Error "`nThis module requires $accountsName version 1.8.1 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to remove '.PSSharedModules' in your home directory. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
35+
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop
36+
} elseif (($accountsModule.Version -lt [System.Version]'2.2.3') -and (-not $localAccounts)) {
37+
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
3838
}
3939
Write-Information "Loaded Module '$($accountsModule.Name)'"
4040

src/Kusto/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Bumped API version to 2021-01-01
2122

2223
## Version 1.0.1
2324
* Updated API version to 2020-09-18.

src/Kusto/build-module.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,13 @@ $moduleName = 'Az.Kusto'
120120
$examplesFolder = Join-Path $PSScriptRoot 'examples'
121121
$null = New-Item -ItemType Directory -Force -Path $examplesFolder
122122

123+
Write-Host -ForegroundColor Green 'Creating cmdlets for specified models...'
124+
$modelCmdlets = @()
125+
. (Join-Path $PSScriptRoot 'create-model-cmdlets.ps1') -Models $modelCmdlets
126+
123127
if($NoDocs) {
124128
Write-Host -ForegroundColor Green 'Creating exports...'
125-
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ExcludeDocs
129+
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ExcludeDocs -ExamplesFolder $examplesFolder
126130
} else {
127131
Write-Host -ForegroundColor Green 'Creating exports and docs...'
128132
$moduleDescription = 'Microsoft Azure PowerShell: Kusto cmdlets'

src/Kusto/check-dependencies.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,17 @@ if(Test-Path -Path $localModulesPath) {
4646
$env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath"
4747
}
4848

49-
DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '1.8.1'
49+
DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '2.2.3'
5050
DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -requiredVersion '4.10.1'
5151

5252
$tools = Join-Path $PSScriptRoot 'tools'
5353
$resourceDir = Join-Path $tools 'Resources'
5454
$resourceModule = Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psm1'
5555

56-
if ($Resources.IsPresent -and (-not (Test-Path -Path $resourceModule))) {
56+
if ($Resources.IsPresent -and ((-not (Test-Path -Path $resourceModule)) -or $RegenerateSupportModule.IsPresent)) {
5757
Write-Host -ForegroundColor Green "Building local Resource module used for test..."
5858
Set-Location $resourceDir
59-
$null = autorest-beta .\readme.md --output-folder=$HOME/.PSSharedModules/Resources
59+
$null = autorest .\readme.md --use:@autorest/powershell@3.0.414 --output-folder=$HOME/.PSSharedModules/Resources
6060
$null = Copy-Item custom/* $HOME/.PSSharedModules/Resources/custom/
6161
Set-Location $HOME/.PSSharedModules/Resources
6262
$null = .\build-module.ps1

src/Kusto/create-model-cmdlets.ps1

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
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+
# ----------------------------------------------------------------------------------
14+
15+
param([string[]]$Models)
16+
17+
if ($Models.Count -eq 0)
18+
{
19+
return
20+
}
21+
22+
$ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models'
23+
$ModuleName = 'Az.Kusto'.Split(".")[1]
24+
$OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets'
25+
$null = New-Item -ItemType Directory -Force -Path $OutputDir
26+
27+
$CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs
28+
$Content = ''
29+
$null = $CsFiles | ForEach-Object -Process { if ($_.Name.Split('.').count -eq 2 )
30+
{ $Content += get-content $_.fullname -raw
31+
} }
32+
33+
$Tree = [Microsoft.CodeAnalysis.CSharp.SyntaxFactory]::ParseCompilationUnit($Content)
34+
$Nodes = $Tree.ChildNodes().ChildNodes()
35+
foreach ($Model in $Models)
36+
{
37+
$InterfaceNode = $Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq "I$Model") }
38+
if ($InterfaceNode.count -eq 0) {
39+
continue
40+
}
41+
# through a queue, we iterate all the parent models.
42+
$Queue = @($InterfaceNode)
43+
$visited = @("I$Model")
44+
$AllInterfaceNodes = @()
45+
while ($Queue.count -ne 0)
46+
{
47+
$AllInterfaceNodes += $Queue[0]
48+
# Baselist contains the direct parent models.
49+
foreach ($parent in $Queue[0].BaseList.Types)
50+
{
51+
if (($parent.Type.Right.Identifier.Value -ne 'IJsonSerializable') -and (-not $visited.Contains($parent.Type.Right.Identifier.Value)))
52+
{
53+
$Queue = [Array]$Queue + ($Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq $parent.Type.Right.Identifier.Value) })
54+
$visited = [Array]$visited + $parent.Type.Right.Identifier.Value
55+
}
56+
}
57+
$first, $Queue = $Queue
58+
}
59+
60+
$Namespace = $InterfaceNode.Parent.Name
61+
$ObjectType = $Model
62+
$ObjectTypeWithNamespace = "${Namespace}.${ObjectType}"
63+
# remove duplicated module name
64+
if ($ObjectType.StartsWith($ModuleName)) {
65+
$ModulePrefix = ''
66+
} else {
67+
$ModulePrefix = $ModuleName
68+
}
69+
$OutputPath = Join-Path -ChildPath "New-Az${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir
70+
71+
$ParameterDefineScriptList = New-Object System.Collections.Generic.List[string]
72+
$ParameterAssignScriptList = New-Object System.Collections.Generic.List[string]
73+
foreach ($Node in $AllInterfaceNodes)
74+
{
75+
foreach ($Member in $Node.Members)
76+
{
77+
$Arguments = $Member.AttributeLists.Attributes.ArgumentList.Arguments
78+
$Required = $false
79+
$Description = ""
80+
$Readonly = $False
81+
foreach ($Argument in $Arguments)
82+
{
83+
if ($Argument.NameEquals.Name.Identifier.Value -eq "Required")
84+
{
85+
$Required = $Argument.Expression.Token.Value
86+
}
87+
if ($Argument.NameEquals.Name.Identifier.Value -eq "Description")
88+
{
89+
$Description = $Argument.Expression.Token.Value.Trim('.').replace('"', '`"')
90+
}
91+
if ($Argument.NameEquals.Name.Identifier.Value -eq "Readonly")
92+
{
93+
$Readonly = $Argument.Expression.Token.Value
94+
}
95+
}
96+
if ($Readonly)
97+
{
98+
continue
99+
}
100+
$Identifier = $Member.Identifier.Value
101+
$Type = $Member.Type.ToString().replace('?', '').Split("::")[-1]
102+
$ParameterDefinePropertyList = New-Object System.Collections.Generic.List[string]
103+
if ($Required)
104+
{
105+
$ParameterDefinePropertyList.Add("Mandatory")
106+
}
107+
if ($Description -ne "")
108+
{
109+
$ParameterDefinePropertyList.Add("HelpMessage=`"${Description}.`"")
110+
}
111+
$ParameterDefineProperty = [System.String]::Join(", ", $ParameterDefinePropertyList)
112+
$ParameterDefineScript = "
113+
[Parameter($ParameterDefineProperty)]
114+
[${Type}]
115+
`$${Identifier}"
116+
$ParameterDefineScriptList.Add($ParameterDefineScript)
117+
$ParameterAssignScriptList.Add("
118+
`$Object.${Identifier} = `$${Identifier}")
119+
}
120+
}
121+
$ParameterDefineScript = $ParameterDefineScriptList | Join-String -Separator ","
122+
$ParameterAssignScript = $ParameterAssignScriptList | Join-String -Separator ""
123+
124+
$Script = "
125+
# ----------------------------------------------------------------------------------
126+
#
127+
# Copyright Microsoft Corporation
128+
# Licensed under the Apache License, Version 2.0 (the \`"License\`");
129+
# you may not use this file except in compliance with the License.
130+
# You may obtain a copy of the License at
131+
# http://www.apache.org/licenses/LICENSE-2.0
132+
# Unless required by applicable law or agreed to in writing, software
133+
# distributed under the License is distributed on an \`"AS IS\`" BASIS,
134+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135+
# See the License for the specific language governing permissions and
136+
# limitations under the License.
137+
# ----------------------------------------------------------------------------------
138+
139+
<#
140+
.Synopsis
141+
Create a in-memory object for ${ObjectType}
142+
.Description
143+
Create a in-memory object for ${ObjectType}
144+
145+
.Outputs
146+
${ObjectTypeWithNamespace}
147+
.Link
148+
https://docs.microsoft.com/powershell/module/az.${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object
149+
#>
150+
function New-Az${ModulePrefix}${ObjectType}Object {
151+
[OutputType('${ObjectTypeWithNamespace}')]
152+
[CmdletBinding(PositionalBinding=`$false)]
153+
Param(
154+
${ParameterDefineScript}
155+
)
156+
157+
process {
158+
`$Object = [${ObjectTypeWithNamespace}]::New()
159+
${ParameterAssignScript}
160+
return `$Object
161+
}
162+
}
163+
"
164+
Set-Content -Path $OutputPath -Value $Script
165+
}

src/Kusto/custom/Invoke-AzKustoDataConnectionValidation.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ Checks that the data connection parameters are valid.
1919
.Description
2020
Checks that the data connection parameters are valid.
2121
.Example
22-
PS C:\> $dataConnectionProperties = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200918.EventHubDataConnection -Property @{Location=$location; Kind=$kind; EventHubResourceId=$eventHubResourceId; DataFormat=$dataFormat; ConsumerGroup='$Default'; Compression= "None"; TableName = $tableName; MappingRuleName = $tableMappingName}
23-
PS C:\> $dataConnectionValidation = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200918.DataConnectionValidation -Property @{DataConnectionName=$dataConnectionName; Property=$dataConnectionProperties}
22+
PS C:\> $dataConnectionProperties = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api202101.EventHubDataConnection -Property @{Location=$location; Kind=$kind; EventHubResourceId=$eventHubResourceId; DataFormat=$dataFormat; ConsumerGroup='$Default'; Compression= "None"; TableName = $tableName; MappingRuleName = $tableMappingName}
23+
PS C:\> $dataConnectionValidation = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api202101.DataConnectionValidation -Property @{DataConnectionName=$dataConnectionName; Property=$dataConnectionProperties}
2424
PS C:\> Invoke-AzKustoDataConnectionValidation -ResourceGroupName $resourceGroupName -ClusterName $clusterName -DatabaseName $databaseName -Parameter $dataConnectionValidation
2525
2626
ErrorMessage
2727
------------
2828
event hub resource id and consumer group tuple provided are already used
2929
3030
.Link
31-
https://docs.microsoft.com/en-us/powershell/module/az.kusto/invoke-azkustodataconnectionvalidation
31+
https://docs.microsoft.com/powershell/module/az.kusto/invoke-azkustodataconnectionvalidation
3232
#>
3333
function Invoke-AzKustoDataConnectionValidation {
34-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200918.IDataConnectionValidationResult])]
34+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api202101.IDataConnectionValidationResult])]
3535
[CmdletBinding(DefaultParameterSetName = 'DataExpandedEventHub', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
3636
param(
3737
[Parameter(ParameterSetName = 'DataExpandedEventHub', Mandatory)]
@@ -230,13 +230,13 @@ function Invoke-AzKustoDataConnectionValidation {
230230

231231
process {
232232
try {
233-
$Parameter = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200918.DataConnectionValidation]::new()
233+
$Parameter = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api202101.DataConnectionValidation]::new()
234234

235235
$Parameter.DataConnectionName = $PSBoundParameters['DataConnectionName']
236236
$null = $PSBoundParameters.Remove('DataConnectionName')
237237

238238
if ($PSBoundParameters['Kind'] -eq 'EventHub') {
239-
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200918.EventHubDataConnection]::new()
239+
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api202101.EventHubDataConnection]::new()
240240

241241
$Parameter.Property.EventHubResourceId = $PSBoundParameters['EventHubResourceId']
242242
$null = $PSBoundParameters.Remove('EventHubResourceId')
@@ -252,7 +252,7 @@ function Invoke-AzKustoDataConnectionValidation {
252252
}
253253
}
254254
elseif ($PSBoundParameters['Kind'] -eq 'EventGrid') {
255-
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200918.EventGridDataConnection]::new()
255+
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api202101.EventGridDataConnection]::new()
256256

257257
$Parameter.Property.EventHubResourceId = $PSBoundParameters['EventHubResourceId']
258258
$null = $PSBoundParameters.Remove('EventHubResourceId')
@@ -271,7 +271,7 @@ function Invoke-AzKustoDataConnectionValidation {
271271
}
272272
}
273273
else {
274-
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20200918.IotHubDataConnection]::new()
274+
$Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api202101.IotHubDataConnection]::new()
275275

276276
$Parameter.Property.IotHubResourceId = $PSBoundParameters['IotHubResourceId']
277277
$null = $PSBoundParameters.Remove('IotHubResourceId')

0 commit comments

Comments
 (0)