Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
221 changes: 132 additions & 89 deletions src/services/integrationRuntimes/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import {
IntegrationRuntimeEdition,
PackageStore,
} from '@azure/arm-datafactory'
import { isArray, isEmpty, isObject, isString } from 'lodash'
import { isEmpty } from 'lodash'
import {
AzureIntegrationRuntime,
AzureIntegrationRuntimeProperties,
AzureSecretBaseUnion,
AzureLinkedServiceReferencePatameters,
AzureCustomSetupBaseUnion,
AzurePackageStore,
} from '../../types/generated'
import { RawAzureIntegrationRuntimeResource } from './data'

Expand Down Expand Up @@ -44,12 +44,9 @@ export interface RawAzureSecretBaseUnion {

export interface RawAzureCustomSetupBaseUnion extends CustomSetupBase {
targetName?: Record<string, unknown>
userName?: Record<string, unknown>
password?: RawAzureSecretBaseUnion
variableName?: string
variableValue?: string
componentName?: string
licenseKey?: RawAzureSecretBaseUnion
version?: string
}

Expand Down Expand Up @@ -113,48 +110,6 @@ export interface RawAzureIntegrationRuntimeUnion {
referenceName?: string
}

const formatParameters = (
params: { [propertyName: string]: Record<string, unknown> }
): AzureLinkedServiceReferencePatameters[] => {
if (isEmpty(params)) {
return []
}
return Object.entries(params).map(([k, v]) => ({
id: cuid(),
key: k,
value: Object.entries(v.value).map(([k2, v2]) => ({
id: isObject(v) ? cuid() : `${k2}:${v2}`,
key: k,
value:
(isString(v2) && v2) ||
(isArray(v2) &&
(v2 as Array<any>)
.map(i => (isString(i) && i) || JSON.stringify(i))
.join(',')) ||
JSON.stringify(v2),
})),
})) || []
}

const formatAzureSecret = (
secret: RawAzureSecretBaseUnion
): AzureSecretBaseUnion => {
if (isEmpty(secret)) {
return {}
}
return {
type: secret?.type,
value: secret?.value,
store: {
type: secret?.store?.type,
referenceName: secret?.store?.referenceName,
parameters: formatParameters(secret?.store?.parameters),
},
secretName: Object.values(secret?.secretName ?? {}).join(''),
secretVersion: Object.values(secret?.secretVersion ?? {}).join(''),
}
}

const formatProperties = (
runtimeProperties?: RawAzureIntegrationRuntimeUnion
): AzureIntegrationRuntimeProperties => {
Expand All @@ -164,63 +119,151 @@ const formatProperties = (

const {
type,
ssisProperties = {},
customerVirtualNetwork = {},
managedVirtualNetwork = {},
computeProperties = {},
linkedInfo = {},
...rest
ssisProperties: {
expressCustomSetupProperties = [],
packageStores = [],
catalogInfo: {
catalogServerEndpoint,
catalogPricingTier,
dualStandbyPairName,
} = {},
credential: {
type: credentialType,
referenceName: credentialReferenceName,
} = {},
licenseType,
customSetupScriptProperties: { blobContainerUri } = {},
dataProxyProperties: {
connectVia: {
type: connectViaType,
referenceName: connectViaReferenceName,
} = {},
stagingLinkedService: {
type: stagingLinkedServiceType,
referenceName: stagingLinkedServiceReferenceName,
} = {},
path,
} = {},
edition,
} = {},
customerVirtualNetwork: { subnetId } = {},
managedVirtualNetwork: {
id: mvId,
type: mvType,
referenceName: mvReferenceName,
} = {},
computeProperties: {
location,
nodeSize,
numberOfNodes,
maxParallelExecutionsPerNode,
dataFlowProperties: { computeType, coreCount, timeToLive, cleanup } = {},
vNetProperties: {
vNetId,
subnet,
publicIPs = [],
subnetId: vNetPropertiesSubnetId,
} = {},
} = {},
linkedInfo: {
key: { type: keyType, value: keyValue } = {},
credential: {
type: linkedInfoCredentialType,
referenceName: linkedInfoCredentialReferenceName,
} = {},
authorizationType,
resourceId,
} = {},
description,
state,
referenceName,
} = runtimeProperties

const {
expressCustomSetupProperties = [],
packageStores = [],
catalogInfo = {},
credential = {},
...restSsisProperties
} = ssisProperties
const { catalogAdminPassword = {}, ...restCatalogInfo } = catalogInfo
const {
key = {},
credential: linkedInfoCredential = {},
...restLinkedInfo
} = linkedInfo

return {
integrationRuntimeType: type,
ssisProperties: {
expressCustomSetupProperties:
expressCustomSetupProperties?.map(
({ targetName, userName, password, licenseKey, ...sp }) => ({
({
targetName,
variableName,
variableValue,
version,
type: expressCustomSetupPropertiesType,
componentName,
}): AzureCustomSetupBaseUnion => ({
id: cuid(),
targetName: Object.values(targetName ?? {}).join(''),
userName: Object.values(userName ?? {}).join(''),
password: formatAzureSecret(password),
licenseKey: formatAzureSecret(licenseKey),
...sp,
variableName,
variableValue,
version,
type: expressCustomSetupPropertiesType,
componentName,
})
) || [],
packageStores:
packageStores?.map(
({
name,
packageStoreLinkedService: {
type: packageStoreLinkedServiceType,
referenceName: packageStoreLinkedServiceReferenceName,
},
}): AzurePackageStore => ({
id: cuid(),
name,
packageStoreLinkedServiceType,
packageStoreLinkedServiceReferenceName,
})
) || [],
packageStores: packageStores?.map(ps => ({ id: cuid(), ...ps })) || [],
catalogInfo: {
catalogAdminPasswordType: catalogAdminPassword?.type,
catalogAdminPasswordValue: catalogAdminPassword?.value,
...restCatalogInfo,
catalogServerEndpoint,
catalogPricingTier,
dualStandbyPairName,
},
credentialType,
credentialReferenceName,
licenseType,
customSetupScriptProperties: { blobContainerUri },
dataProxyProperties: {
connectViaType,
connectViaReferenceName,
stagingLinkedServiceType,
stagingLinkedServiceReferenceName,
path,
},
edition,
},
customerVirtualNetworkSubnetId: subnetId,
managedVirtualNetwork: {
id: mvId,
type: mvType,
referenceName: mvReferenceName,
},
computeProperties: {
location,
nodeSize,
numberOfNodes,
maxParallelExecutionsPerNode,
dataFlowProperties: { computeType, coreCount, timeToLive, cleanup },
vNetProperties: {
vNetId,
subnet,
publicIPs,
subnetId: vNetPropertiesSubnetId,
},
credentialType: credential?.type,
credentialReferenceName: credential?.referenceName,
...restSsisProperties,
},
customerVirtualNetworkSubnetId: customerVirtualNetwork?.subnetId,
managedVirtualNetwork,
computeProperties,
linkedInfo: {
credentialType: linkedInfoCredential?.type,
credentialReferenceName: linkedInfoCredential?.referenceName,
keyType: key?.type,
keyValue: key?.value,
...restLinkedInfo,
credentialType: linkedInfoCredentialType,
credentialReferenceName: linkedInfoCredentialReferenceName,
keyType,
keyValue,
authorizationType,
resourceId,
},
...rest,
description,
state,
referenceName,
}
}

Expand Down
8 changes: 0 additions & 8 deletions src/services/integrationRuntimes/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ type azureIntegrationRuntimeSsisCatalogInfo
subscription: false
) {
catalogServerEndpoint: String @search(by: [hash, regexp])
catalogAdminUserName: String @search(by: [hash, regexp])
catalogAdminPasswordType: String @search(by: [hash, regexp])
catalogAdminPasswordValue: String @search(by: [hash, regexp])
catalogPricingTier: String @search(by: [hash, regexp])
dualStandbyPairName: String @search(by: [hash, regexp])
}
Expand All @@ -80,8 +77,6 @@ type azureIntegrationRuntimeCustomSetupScriptProperties
subscription: false
) {
blobContainerUri: String @search(by: [hash, regexp])
sasTokenType: String @search(by: [hash, regexp])
sasTokenValue: String @search(by: [hash, regexp])
}

type azureIntegrationRuntimeDataProxyProperties
Expand Down Expand Up @@ -155,12 +150,9 @@ type azureCustomSetupBaseUnion
id: String! @id @search(by: [hash])
type: String @search(by: [hash, regexp])
targetName: String @search(by: [hash, regexp])
userName: String @search(by: [hash, regexp])
password: azureSecretBaseUnion
variableName: String @search(by: [hash, regexp])
variableValue: String @search(by: [hash, regexp])
componentName: String @search(by: [hash, regexp])
licenseKey: azureSecretBaseUnion
version: String @search(by: [hash, regexp])
}

Expand Down
20 changes: 14 additions & 6 deletions src/services/logAnalyticsWorkspace/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ export default ({
resourceGroupId,
provisioningState,
customerId,
sku,
features,
workspaceCapping,
sku: { name, lastSkuUpdate },
Comment thread
hjaraujof marked this conversation as resolved.
features: {
enableLogAccessUsingOnlyResourcePermissions,
legacy,
searchVersion,
},
workspaceCapping: { dailyQuotaGb, quotaNextResetTime, dataIngestionStatus },
retentionInDays,
createdDate,
modifiedDate,
Expand All @@ -38,9 +42,13 @@ export default ({
region,
provisioningState,
customerId,
sku,
features,
workspaceCapping,
sku: { name, lastSkuUpdate },
features: {
enableLogAccessUsingOnlyResourcePermissions,
legacy,
searchVersion,
},
workspaceCapping: { dailyQuotaGb, quotaNextResetTime, dataIngestionStatus },
retentionInDays,
createdDate,
modifiedDate,
Expand Down
Loading