Skip to content

Commit e18f2ba

Browse files
committed
Kusto: Onboard to auto generate
1 parent d068a1c commit e18f2ba

File tree

14 files changed

+10504
-4810
lines changed

14 files changed

+10504
-4810
lines changed

generator/autogenlist.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ScopeType, AutoGenConfig } from './models';
22
import { postProcessor as insightsApplicationPostProcessor } from './processors/Microsoft.Insights.Application';
33
import { postProcessor as resourcesPostProcessor } from './processors/Microsoft.Resources';
44
import { postProcessor as machineLearningPostProcessor } from './processors/Microsoft.MachineLearning';
5+
import { postProcessor as kustoPostProcessor } from './processors/Microsoft.Kusto';
56
import { postProcessor as machineLearningServicesPostProcessor } from './processors/Microsoft.MachineLearningServices';
67
import { postProcessor as storageProcessor } from './processors/Microsoft.Storage';
78
import { postProcessor as policyProcessor } from './processors/Microsoft.Authorization';
@@ -339,6 +340,11 @@ const autoGenList: AutoGenConfig[] = [
339340
namespace: 'Microsoft.MachineLearning',
340341
postProcessor: machineLearningPostProcessor,
341342
},
343+
{
344+
basePath: 'azure-kusto/resource-manager',
345+
namespace: 'Microsoft.Kusto',
346+
postProcessor: kustoPostProcessor,
347+
},
342348
{
343349
basePath: 'machinelearningservices/resource-manager',
344350
namespace: 'Microsoft.MachineLearningServices',

generator/cmd/generatesingle.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ executeSynchronous(async () => {
2525

2626
const schemaConfigs = [];
2727
const autoGenEntries = findAutogenEntries(basePath);
28+
console.log(autoGenEntries);
2829

2930
if (autoGenEntries.length === 0) {
3031
const localSchemaConfigs = await generateSchemas(readme);
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
import { SchemaPostProcessor } from '../models';
2+
import { apiVersionCompare } from '../utils';
3+
4+
const clusterDataConnections = (apiVersion: string) => ({
5+
type: 'object',
6+
oneOf: [
7+
{
8+
$ref: '#/definitions/GenevaDataConnection'
9+
},
10+
{
11+
$ref: '#/definitions/GenevaLegacyDataConnection'
12+
}
13+
],
14+
properties: {
15+
name: {
16+
type: 'string',
17+
description: 'The data connection name'
18+
},
19+
type: {
20+
enum: [
21+
'Microsoft.Kusto/clusters/dataConnections'
22+
]
23+
},
24+
apiVersion: {
25+
type: 'string',
26+
enum: [
27+
apiVersion
28+
]
29+
}
30+
},
31+
required: [
32+
'apiVersion',
33+
'properties',
34+
'type'
35+
],
36+
description: 'Microsoft.Kusto/clusters/dataConnections'
37+
});
38+
39+
const genevaDataConnectionProperties = () => ({
40+
type: 'object',
41+
properties: {
42+
genevaEnvironment: {
43+
type: 'string',
44+
'description': 'The Geneva environment of the geneva data connection.'
45+
}
46+
},
47+
required: [
48+
'genevaEnvironment'
49+
],
50+
description: 'Class representing the Kusto Geneva (GDS) connection properties.'
51+
});
52+
53+
const genevaDataConnection = () => ({
54+
type: 'object',
55+
properties: {
56+
properties: {
57+
oneOf: [
58+
{
59+
$ref: '#/definitions/GenevaDataConnectionProperties'
60+
},
61+
{
62+
$ref: 'https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression'
63+
}
64+
],
65+
description: 'Geneva (DGS) data connection properties'
66+
},
67+
kind: {
68+
type: 'string',
69+
enum: [
70+
'Geneva'
71+
]
72+
}
73+
},
74+
required: [
75+
'kind'
76+
],
77+
description: 'Information about the Geneva (GDS) data connection'
78+
});
79+
80+
const genevaLegacyDataConnectionProperties = () => ({
81+
type: 'object',
82+
properties: {
83+
genevaEnvironment: {
84+
type: 'string',
85+
description: 'The Geneva environment of the geneva data connection.'
86+
},
87+
mdsAccounts: {
88+
type: 'array',
89+
description: 'The list of mds accounts of the geneva data connection.'
90+
},
91+
isScrubbed: {
92+
type: 'boolean',
93+
description: 'Indicates whether the data is scrubbed.'
94+
}
95+
},
96+
required: [
97+
'genevaEnvironment',
98+
'mdsAccounts',
99+
'isScrubbed'
100+
],
101+
'description': 'Class representing the Kusto Geneva legacy connection properties.'
102+
});
103+
104+
const genevaLegacyDataConnection = () => ({
105+
type: 'object',
106+
properties: {
107+
properties: {
108+
oneOf: [
109+
{
110+
$ref: '#/definitions/GenevaLegacyDataConnectionProperties'
111+
},
112+
{
113+
$ref: 'https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression'
114+
}
115+
],
116+
description: 'Geneva legacy data connection properties.'
117+
},
118+
kind: {
119+
type: 'string',
120+
enum: [
121+
'GenevaLegacy'
122+
]
123+
}
124+
},
125+
required: [
126+
'kind'
127+
],
128+
description: 'Information about the Geneva legacy data connection.'
129+
});
130+
131+
const clusterDataConnections_childResource = () => ({
132+
$ref: '#/definitions/clusters_dataconnections_childResource'
133+
});
134+
135+
export const postProcessor: SchemaPostProcessor = (namespace: string, apiVersion: string, schema: any) => {
136+
// Handle cluster data connection
137+
if (apiVersionCompare(apiVersion, '2019-11-09') > -1){
138+
const clusterSubResources = schema.resourceDefinitions.clusters.properties.resources.items.oneOf;
139+
clusterSubResources.push(clusterDataConnections_childResource());
140+
schema.resourceDefinitions.clusters.properties.resources.items.oneOf = clusterSubResources;
141+
const clusterDataConnectionObject = clusterDataConnections(apiVersion);
142+
schema['resourceDefinitions']['clusters_dataconnections'] = clusterDataConnectionObject;
143+
clusterDataConnectionObject.properties.type.enum = ["Microsoft.Kusto/clusters/dataconnections"];
144+
schema.definitions.clusters_dataconnections_childResource = clusterDataConnectionObject;
145+
schema.definitions.GenevaDataConnectionProperties = genevaDataConnectionProperties();
146+
schema.definitions.GenevaDataConnection = genevaDataConnection();
147+
schema.definitions.GenevaLegacyDataConnectionProperties = genevaLegacyDataConnectionProperties();
148+
schema.definitions.GenevaLegacyDataConnection = genevaLegacyDataConnection();
149+
}
150+
151+
// Handle read only following database
152+
153+
}

0 commit comments

Comments
 (0)