@@ -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'
1212import {
1313 AzureIntegrationRuntime ,
1414 AzureIntegrationRuntimeProperties ,
15- AzureSecretBaseUnion ,
16- AzureLinkedServiceReferencePatameters ,
15+ AzureCustomSetupBaseUnion ,
16+ AzurePackageStore ,
1717} from '../../types/generated'
1818import { RawAzureIntegrationRuntimeResource } from './data'
1919
@@ -44,12 +44,9 @@ export interface RawAzureSecretBaseUnion {
4444
4545export 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-
158113const 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
0 commit comments