Skip to content

Commit 43cea0f

Browse files
authored
Merge pull request #44 from cloudgraphdev/fix/bugfix-patch-4
fix(integrationRuntimes,logAnalyticsWorkspace,sqlServers): several fixes
2 parents 96114c5 + b635fe4 commit 43cea0f

6 files changed

Lines changed: 334 additions & 163 deletions

File tree

src/services/integrationRuntimes/format.ts

Lines changed: 132 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import {
88
IntegrationRuntimeEdition,
99
PackageStore,
1010
} from '@azure/arm-datafactory'
11-
import { isArray, isEmpty, isObject, isString } from 'lodash'
11+
import { isEmpty } from 'lodash'
1212
import {
1313
AzureIntegrationRuntime,
1414
AzureIntegrationRuntimeProperties,
15-
AzureSecretBaseUnion,
16-
AzureLinkedServiceReferencePatameters,
15+
AzureCustomSetupBaseUnion,
16+
AzurePackageStore,
1717
} from '../../types/generated'
1818
import { RawAzureIntegrationRuntimeResource } from './data'
1919

@@ -44,12 +44,9 @@ export interface RawAzureSecretBaseUnion {
4444

4545
export interface RawAzureCustomSetupBaseUnion extends CustomSetupBase {
4646
targetName?: Record<string, unknown>
47-
userName?: Record<string, unknown>
48-
password?: RawAzureSecretBaseUnion
4947
variableName?: string
5048
variableValue?: string
5149
componentName?: string
52-
licenseKey?: RawAzureSecretBaseUnion
5350
version?: string
5451
}
5552

@@ -113,48 +110,6 @@ export interface RawAzureIntegrationRuntimeUnion {
113110
referenceName?: string
114111
}
115112

116-
const formatParameters = (
117-
params: { [propertyName: string]: Record<string, unknown> }
118-
): AzureLinkedServiceReferencePatameters[] => {
119-
if (isEmpty(params)) {
120-
return []
121-
}
122-
return Object.entries(params).map(([k, v]) => ({
123-
id: cuid(),
124-
key: k,
125-
value: Object.entries(v.value).map(([k2, v2]) => ({
126-
id: isObject(v) ? cuid() : `${k2}:${v2}`,
127-
key: k,
128-
value:
129-
(isString(v2) && v2) ||
130-
(isArray(v2) &&
131-
(v2 as Array<any>)
132-
.map(i => (isString(i) && i) || JSON.stringify(i))
133-
.join(',')) ||
134-
JSON.stringify(v2),
135-
})),
136-
})) || []
137-
}
138-
139-
const formatAzureSecret = (
140-
secret: RawAzureSecretBaseUnion
141-
): AzureSecretBaseUnion => {
142-
if (isEmpty(secret)) {
143-
return {}
144-
}
145-
return {
146-
type: secret?.type,
147-
value: secret?.value,
148-
store: {
149-
type: secret?.store?.type,
150-
referenceName: secret?.store?.referenceName,
151-
parameters: formatParameters(secret?.store?.parameters),
152-
},
153-
secretName: Object.values(secret?.secretName ?? {}).join(''),
154-
secretVersion: Object.values(secret?.secretVersion ?? {}).join(''),
155-
}
156-
}
157-
158113
const formatProperties = (
159114
runtimeProperties?: RawAzureIntegrationRuntimeUnion
160115
): AzureIntegrationRuntimeProperties => {
@@ -164,63 +119,151 @@ const formatProperties = (
164119

165120
const {
166121
type,
167-
ssisProperties = {},
168-
customerVirtualNetwork = {},
169-
managedVirtualNetwork = {},
170-
computeProperties = {},
171-
linkedInfo = {},
172-
...rest
122+
ssisProperties: {
123+
expressCustomSetupProperties = [],
124+
packageStores = [],
125+
catalogInfo: {
126+
catalogServerEndpoint,
127+
catalogPricingTier,
128+
dualStandbyPairName,
129+
} = {},
130+
credential: {
131+
type: credentialType,
132+
referenceName: credentialReferenceName,
133+
} = {},
134+
licenseType,
135+
customSetupScriptProperties: { blobContainerUri } = {},
136+
dataProxyProperties: {
137+
connectVia: {
138+
type: connectViaType,
139+
referenceName: connectViaReferenceName,
140+
} = {},
141+
stagingLinkedService: {
142+
type: stagingLinkedServiceType,
143+
referenceName: stagingLinkedServiceReferenceName,
144+
} = {},
145+
path,
146+
} = {},
147+
edition,
148+
} = {},
149+
customerVirtualNetwork: { subnetId } = {},
150+
managedVirtualNetwork: {
151+
id: mvId,
152+
type: mvType,
153+
referenceName: mvReferenceName,
154+
} = {},
155+
computeProperties: {
156+
location,
157+
nodeSize,
158+
numberOfNodes,
159+
maxParallelExecutionsPerNode,
160+
dataFlowProperties: { computeType, coreCount, timeToLive, cleanup } = {},
161+
vNetProperties: {
162+
vNetId,
163+
subnet,
164+
publicIPs = [],
165+
subnetId: vNetPropertiesSubnetId,
166+
} = {},
167+
} = {},
168+
linkedInfo: {
169+
key: { type: keyType, value: keyValue } = {},
170+
credential: {
171+
type: linkedInfoCredentialType,
172+
referenceName: linkedInfoCredentialReferenceName,
173+
} = {},
174+
authorizationType,
175+
resourceId,
176+
} = {},
177+
description,
178+
state,
179+
referenceName,
173180
} = runtimeProperties
174181

175-
const {
176-
expressCustomSetupProperties = [],
177-
packageStores = [],
178-
catalogInfo = {},
179-
credential = {},
180-
...restSsisProperties
181-
} = ssisProperties
182-
const { catalogAdminPassword = {}, ...restCatalogInfo } = catalogInfo
183-
const {
184-
key = {},
185-
credential: linkedInfoCredential = {},
186-
...restLinkedInfo
187-
} = linkedInfo
188-
189182
return {
190183
integrationRuntimeType: type,
191184
ssisProperties: {
192185
expressCustomSetupProperties:
193186
expressCustomSetupProperties?.map(
194-
({ targetName, userName, password, licenseKey, ...sp }) => ({
187+
({
188+
targetName,
189+
variableName,
190+
variableValue,
191+
version,
192+
type: expressCustomSetupPropertiesType,
193+
componentName,
194+
}): AzureCustomSetupBaseUnion => ({
195195
id: cuid(),
196196
targetName: Object.values(targetName ?? {}).join(''),
197-
userName: Object.values(userName ?? {}).join(''),
198-
password: formatAzureSecret(password),
199-
licenseKey: formatAzureSecret(licenseKey),
200-
...sp,
197+
variableName,
198+
variableValue,
199+
version,
200+
type: expressCustomSetupPropertiesType,
201+
componentName,
202+
})
203+
) || [],
204+
packageStores:
205+
packageStores?.map(
206+
({
207+
name,
208+
packageStoreLinkedService: {
209+
type: packageStoreLinkedServiceType,
210+
referenceName: packageStoreLinkedServiceReferenceName,
211+
},
212+
}): AzurePackageStore => ({
213+
id: cuid(),
214+
name,
215+
packageStoreLinkedServiceType,
216+
packageStoreLinkedServiceReferenceName,
201217
})
202218
) || [],
203-
packageStores: packageStores?.map(ps => ({ id: cuid(), ...ps })) || [],
204219
catalogInfo: {
205-
catalogAdminPasswordType: catalogAdminPassword?.type,
206-
catalogAdminPasswordValue: catalogAdminPassword?.value,
207-
...restCatalogInfo,
220+
catalogServerEndpoint,
221+
catalogPricingTier,
222+
dualStandbyPairName,
223+
},
224+
credentialType,
225+
credentialReferenceName,
226+
licenseType,
227+
customSetupScriptProperties: { blobContainerUri },
228+
dataProxyProperties: {
229+
connectViaType,
230+
connectViaReferenceName,
231+
stagingLinkedServiceType,
232+
stagingLinkedServiceReferenceName,
233+
path,
234+
},
235+
edition,
236+
},
237+
customerVirtualNetworkSubnetId: subnetId,
238+
managedVirtualNetwork: {
239+
id: mvId,
240+
type: mvType,
241+
referenceName: mvReferenceName,
242+
},
243+
computeProperties: {
244+
location,
245+
nodeSize,
246+
numberOfNodes,
247+
maxParallelExecutionsPerNode,
248+
dataFlowProperties: { computeType, coreCount, timeToLive, cleanup },
249+
vNetProperties: {
250+
vNetId,
251+
subnet,
252+
publicIPs,
253+
subnetId: vNetPropertiesSubnetId,
208254
},
209-
credentialType: credential?.type,
210-
credentialReferenceName: credential?.referenceName,
211-
...restSsisProperties,
212255
},
213-
customerVirtualNetworkSubnetId: customerVirtualNetwork?.subnetId,
214-
managedVirtualNetwork,
215-
computeProperties,
216256
linkedInfo: {
217-
credentialType: linkedInfoCredential?.type,
218-
credentialReferenceName: linkedInfoCredential?.referenceName,
219-
keyType: key?.type,
220-
keyValue: key?.value,
221-
...restLinkedInfo,
257+
credentialType: linkedInfoCredentialType,
258+
credentialReferenceName: linkedInfoCredentialReferenceName,
259+
keyType,
260+
keyValue,
261+
authorizationType,
262+
resourceId,
222263
},
223-
...rest,
264+
description,
265+
state,
266+
referenceName,
224267
}
225268
}
226269

src/services/integrationRuntimes/schema.graphql

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ type azureIntegrationRuntimeSsisCatalogInfo
6666
subscription: false
6767
) {
6868
catalogServerEndpoint: String @search(by: [hash, regexp])
69-
catalogAdminUserName: String @search(by: [hash, regexp])
70-
catalogAdminPasswordType: String @search(by: [hash, regexp])
71-
catalogAdminPasswordValue: String @search(by: [hash, regexp])
7269
catalogPricingTier: String @search(by: [hash, regexp])
7370
dualStandbyPairName: String @search(by: [hash, regexp])
7471
}
@@ -80,8 +77,6 @@ type azureIntegrationRuntimeCustomSetupScriptProperties
8077
subscription: false
8178
) {
8279
blobContainerUri: String @search(by: [hash, regexp])
83-
sasTokenType: String @search(by: [hash, regexp])
84-
sasTokenValue: String @search(by: [hash, regexp])
8580
}
8681

8782
type azureIntegrationRuntimeDataProxyProperties
@@ -155,12 +150,9 @@ type azureCustomSetupBaseUnion
155150
id: String! @id @search(by: [hash])
156151
type: String @search(by: [hash, regexp])
157152
targetName: String @search(by: [hash, regexp])
158-
userName: String @search(by: [hash, regexp])
159-
password: azureSecretBaseUnion
160153
variableName: String @search(by: [hash, regexp])
161154
variableValue: String @search(by: [hash, regexp])
162155
componentName: String @search(by: [hash, regexp])
163-
licenseKey: azureSecretBaseUnion
164156
version: String @search(by: [hash, regexp])
165157
}
166158

src/services/logAnalyticsWorkspace/format.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ export default ({
1818
resourceGroupId,
1919
provisioningState,
2020
customerId,
21-
sku,
22-
features,
23-
workspaceCapping,
21+
sku: { name, lastSkuUpdate },
22+
features: {
23+
enableLogAccessUsingOnlyResourcePermissions,
24+
legacy,
25+
searchVersion,
26+
},
27+
workspaceCapping: { dailyQuotaGb, quotaNextResetTime, dataIngestionStatus },
2428
retentionInDays,
2529
createdDate,
2630
modifiedDate,
@@ -38,9 +42,13 @@ export default ({
3842
region,
3943
provisioningState,
4044
customerId,
41-
sku,
42-
features,
43-
workspaceCapping,
45+
sku: { name, lastSkuUpdate },
46+
features: {
47+
enableLogAccessUsingOnlyResourcePermissions,
48+
legacy,
49+
searchVersion,
50+
},
51+
workspaceCapping: { dailyQuotaGb, quotaNextResetTime, dataIngestionStatus },
4452
retentionInDays,
4553
createdDate,
4654
modifiedDate,

0 commit comments

Comments
 (0)