Skip to content

Commit 48321bf

Browse files
committed
Migrate Kusto to autorest v4
1 parent 3f0e324 commit 48321bf

File tree

164 files changed

+6875
-4051
lines changed

Some content is hidden

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

164 files changed

+6875
-4051
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0 (the ""License"");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an ""AS IS"" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
12+
// is regenerated.
13+
14+
using System;
15+
using System.Reflection;
16+
using System.Runtime.CompilerServices;
17+
using System.Runtime.InteropServices;
18+
19+
[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
20+
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
21+
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
22+
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - Kusto")]
23+
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.0.0")]
24+
[assembly: System.Reflection.AssemblyVersionAttribute("0.1.0.0")]
25+
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
26+
[assembly: System.CLSCompliantAttribute(false)]

src/Kusto/Kusto.Autorest/README.md

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,9 @@ subject-prefix: $(service-name)
6767
clear-output-folder: true
6868
output-folder: .
6969
```
70-
70+
<!--
7171
> Directives
7272
``` yaml
73-
identity-correction-for-post: true
74-
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
75-
use-extension:
76-
"@autorest/powershell": "3.x"
77-
7873
directive:
7974
# Fix the error in swagger, RP actually returns 200 when deletion succeeds
8075
- from: swagger-document
@@ -97,58 +92,84 @@ directive:
9792
- from: swagger-document
9893
where: $
9994
transform: return $.replace(/\/principalAssignments\//g, "/PrincipalAssignments/")
100-
# Remove the unexpanded parameter set
95+
96+
# Remove the non-expanded parameter set
97+
- where:
98+
variant: ^(Add|Check|Detach)(?!.*?(Expanded|JsonFilePath|JsonString))
99+
remove: true
100+
101101
- where:
102-
variant: ^Add$|^AddViaIdentity$|^Check$|^CheckViaIdentity$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Detach$|^DetachViaIdentity$
102+
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$
103103
remove: true
104+
104105
# Remove the unexpanded parameter set for specific commands
105106
- where:
106107
subject: ^AttachedDatabaseConfiguration$|^Cluster$|^ClusterPrincipalAssignment$|^DatabasePrincipalAssignment$
107-
variant: ^Create$|^Update$|^UpdateViaIdentity$
108+
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
108109
remove: true
110+
109111
- where:
110112
verb: Remove
111113
subject: DatabasePrincipal|ClusterLanguageExtension
112-
variant: ^Remove$|^RemoveViaIdentity$
114+
variant: ^(Remove)(?!.*?(Expanded|JsonFilePath|JsonString))
113115
remove: true
116+
114117
# Custom commands
115118
- where:
116119
subject: ^DataConnectionValidation$
117120
hide: true
121+
118122
- where:
119123
subject: ^Database$|^DataConnection$
120124
variant: ^Create$|^CreateExpanded$|^Update$|^UpdateExpanded$|^UpdateViaIdentity$|^UpdateViaIdentityExpanded$
121125
hide: true
126+
127+
# Autorest V4 generated variants, but need customise, can be added back upon service team request
128+
- where:
129+
subject: ^Database$|^DataConnection$
130+
variant: ^CreateViaIdentityCluster$|^CreateViaIdentityClusterExpanded$|^CreateViaIdentityDatabase$|^CreateViaIdentityDatabaseExpanded$|^UpdateViaIdentityCluster$|^UpdateViaIdentityClusterExpanded$|^UpdateViaIdentityDatabase$|^UpdateViaIdentityDatabaseExpanded$
131+
remove: true
132+
122133
# Hide the operation API
123134
- where:
124135
subject: Operation
125136
hide: true
137+
126138
# Remove the set-* cmdlet
127139
- where:
128140
verb: Set
129141
remove: true
142+
130143
# Rename cmdlet from Get-AzKustoOperationsResultsLocation to Get-AzKustoOperationsResultLocation so it's consistent with Get-AzKustoOperationsResult
131144
- where:
132145
verb: Get
133146
subject: OperationsResultsLocation
134-
variant: ^Get$|^GetViaIdentity$
135147
set:
136148
subject: OperationsResultLocation
149+
137150
# For Get-AzKustoOperationResult no particular need for -PassThru parameter
138151
- where:
139152
verb: Get
140153
subject: OperationsResultLocation
141154
parameter-name: ^PassThru$
142155
hide: true
143-
# Rename Move-AzKustoCluster -> Invoke-AzKustoClusterMigration
156+
157+
# Rename Move-AzKustoCluster -> Invoke-AzKustoClusterMigration
144158
- where:
145159
verb: Move
146160
subject: Cluster
147161
set:
148162
verb: Invoke
149163
subject: ClusterMigration
164+
165+
# Autorest V4 generated GET+PUT api Update cmdlets, can be added upon service team request
166+
- where:
167+
verb: Update
168+
subject: DatabasePrincipalAssignment|ClusterPrincipalAssignment|AttachedDatabaseConfiguration
169+
remove: true
170+
150171
# Correct some generated code
151172
- from: source-file-csharp
152173
where: $
153-
transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20240413.IDataConnection Property', 'public Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.Api20240413.IDataConnection Property');
154-
```
174+
transform: $ = $.replace('internal Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.IDataConnection Property', 'public Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.IDataConnection Property');
175+
``` -->

src/Kusto/Kusto.Autorest/UX/Microsoft.Kusto/Clusters-Databases.json

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -48,49 +48,6 @@
4848
}
4949
]
5050
},
51-
{
52-
"name": "Invoke-AzKustoInviteDatabaseFollower",
53-
"description": "Generates an invitation token that allows attaching a follower database to this database.",
54-
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/Clusters/{clusterName}/Databases/{databaseName}/inviteFollower",
55-
"help": {
56-
"learnMore": {
57-
"url": "https://learn.microsoft.com/powershell/module/az.kusto/invoke-azkustoinvitedatabasefollower"
58-
},
59-
"parameterSets": [
60-
{
61-
"parameters": [
62-
"-ClusterName <String>",
63-
"-DatabaseName <String>",
64-
"-ResourceGroupName <String>",
65-
"[-SubscriptionId <String>]"
66-
]
67-
}
68-
]
69-
},
70-
"examples": [
71-
{
72-
"description": "Generates an invitation token that allows attaching a follower database to this database.",
73-
"parameters": [
74-
{
75-
"name": "-ClusterName",
76-
"value": "[Path.clusterName]"
77-
},
78-
{
79-
"name": "-DatabaseName",
80-
"value": "[Path.databaseName]"
81-
},
82-
{
83-
"name": "-ResourceGroupName",
84-
"value": "[Path.resourceGroupName]"
85-
},
86-
{
87-
"name": "-SubscriptionId",
88-
"value": "[Path.subscriptionId]"
89-
}
90-
]
91-
}
92-
]
93-
},
9451
{
9552
"name": "Remove-AzKustoDatabase",
9653
"description": "Deletes the database with the given name.",

src/Kusto/Kusto.Autorest/UX/Microsoft.Kusto/Clusters-privateEndpointConnections.json

Lines changed: 0 additions & 95 deletions
This file was deleted.

src/Kusto/Kusto.Autorest/UX/Microsoft.Kusto/Clusters-privateLinkResources.json

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)