Skip to content

Commit 8c19d90

Browse files
committed
fix(integrationRuntimes,logAnalyticsWorkspace,sqlServers): several fixes
- Removed several sensitive data fields from schemas - Removed spread operations to prevent unmapped field errors - Format fixes
1 parent 7e95105 commit 8c19d90

6 files changed

Lines changed: 339 additions & 162 deletions

File tree

src/services/integrationRuntimes/format.ts

Lines changed: 137 additions & 88 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,47 +110,11 @@ 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-
}
113+
// function useInterfaceToExtractData<ExpectedDataType>(
114+
// data: unknown
115+
// ): ExpectedDataType {
116+
// return data as ExpectedDataType
117+
// }
157118

158119
const formatProperties = (
159120
runtimeProperties?: RawAzureIntegrationRuntimeUnion
@@ -164,63 +125,151 @@ const formatProperties = (
164125

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

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-
189188
return {
190189
integrationRuntimeType: type,
191190
ssisProperties: {
192191
expressCustomSetupProperties:
193192
expressCustomSetupProperties?.map(
194-
({ targetName, userName, password, licenseKey, ...sp }) => ({
193+
({
194+
targetName,
195+
variableName,
196+
variableValue,
197+
version,
198+
type: expressCustomSetupPropertiesType,
199+
componentName,
200+
}): AzureCustomSetupBaseUnion => ({
195201
id: cuid(),
196202
targetName: Object.values(targetName ?? {}).join(''),
197-
userName: Object.values(userName ?? {}).join(''),
198-
password: formatAzureSecret(password),
199-
licenseKey: formatAzureSecret(licenseKey),
200-
...sp,
203+
variableName,
204+
variableValue,
205+
version,
206+
type: expressCustomSetupPropertiesType,
207+
componentName,
208+
})
209+
) || [],
210+
packageStores:
211+
packageStores?.map(
212+
({
213+
name,
214+
packageStoreLinkedService: {
215+
type: packageStoreLinkedServiceType,
216+
referenceName: packageStoreLinkedServiceReferenceName,
217+
},
218+
}): AzurePackageStore => ({
219+
id: cuid(),
220+
name,
221+
packageStoreLinkedServiceType,
222+
packageStoreLinkedServiceReferenceName,
201223
})
202224
) || [],
203-
packageStores: packageStores?.map(ps => ({ id: cuid(), ...ps })) || [],
204225
catalogInfo: {
205-
catalogAdminPasswordType: catalogAdminPassword?.type,
206-
catalogAdminPasswordValue: catalogAdminPassword?.value,
207-
...restCatalogInfo,
226+
catalogServerEndpoint,
227+
catalogPricingTier,
228+
dualStandbyPairName,
229+
},
230+
credentialType,
231+
credentialReferenceName,
232+
licenseType,
233+
customSetupScriptProperties: { blobContainerUri },
234+
dataProxyProperties: {
235+
connectViaType,
236+
connectViaReferenceName,
237+
stagingLinkedServiceType,
238+
stagingLinkedServiceReferenceName,
239+
path,
240+
},
241+
edition,
242+
},
243+
customerVirtualNetworkSubnetId: subnetId,
244+
managedVirtualNetwork: {
245+
id: mvId,
246+
type: mvType,
247+
referenceName: mvReferenceName,
248+
},
249+
computeProperties: {
250+
location,
251+
nodeSize,
252+
numberOfNodes,
253+
maxParallelExecutionsPerNode,
254+
dataFlowProperties: { computeType, coreCount, timeToLive, cleanup },
255+
vNetProperties: {
256+
vNetId,
257+
subnet,
258+
publicIPs,
259+
subnetId: vNetPropertiesSubnetId,
208260
},
209-
credentialType: credential?.type,
210-
credentialReferenceName: credential?.referenceName,
211-
...restSsisProperties,
212261
},
213-
customerVirtualNetworkSubnetId: customerVirtualNetwork?.subnetId,
214-
managedVirtualNetwork,
215-
computeProperties,
216262
linkedInfo: {
217-
credentialType: linkedInfoCredential?.type,
218-
credentialReferenceName: linkedInfoCredential?.referenceName,
219-
keyType: key?.type,
220-
keyValue: key?.value,
221-
...restLinkedInfo,
263+
credentialType: linkedInfoCredentialType,
264+
credentialReferenceName: linkedInfoCredentialReferenceName,
265+
keyType,
266+
keyValue,
267+
authorizationType,
268+
resourceId,
222269
},
223-
...rest,
270+
description,
271+
state,
272+
referenceName,
224273
}
225274
}
226275

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)