@@ -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,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
158119const 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
0 commit comments