@ibm-cloud/ibm_dph_services 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dph/v1.d.ts +390 -13
- package/dph/v1.js +290 -13
- package/dph/v1.js.map +1 -1
- package/examples/dph.v1.test.js +1898 -0
- package/package.json +2 -2
|
@@ -0,0 +1,1898 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment node
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* (C) Copyright IBM Corp. 2025.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/* eslint-disable no-console */
|
|
21
|
+
/* eslint-disable no-await-in-loop */
|
|
22
|
+
|
|
23
|
+
const DphV1 = require('../dist/dph/v1');
|
|
24
|
+
// eslint-disable-next-line node/no-unpublished-require
|
|
25
|
+
const authHelper = require('../test/resources/auth-helper.js');
|
|
26
|
+
// You can use the readExternalSources method to access additional configuration values
|
|
27
|
+
// const { readExternalSources } = require('ibm-cloud-sdk-core');
|
|
28
|
+
|
|
29
|
+
//
|
|
30
|
+
// This file provides an example of how to use the DPH service.
|
|
31
|
+
//
|
|
32
|
+
// The following configuration properties are assumed to be defined:
|
|
33
|
+
// DPH_URL=<service base url>
|
|
34
|
+
// DPH_AUTH_TYPE=iam
|
|
35
|
+
// DPH_APIKEY=<IAM apikey>
|
|
36
|
+
// DPH_AUTH_URL=<IAM token service base URL - omit this if using the production environment>
|
|
37
|
+
//
|
|
38
|
+
// These configuration properties can be exported as environment variables, or stored
|
|
39
|
+
// in a configuration file and then:
|
|
40
|
+
// export IBM_CREDENTIALS_FILE=<name of configuration file>
|
|
41
|
+
//
|
|
42
|
+
const configFile = 'dph_v1.env';
|
|
43
|
+
|
|
44
|
+
const describe = authHelper.prepareTests(configFile);
|
|
45
|
+
|
|
46
|
+
// Save original console.log
|
|
47
|
+
const originalLog = console.log;
|
|
48
|
+
const originalWarn = console.warn;
|
|
49
|
+
|
|
50
|
+
// Mocks for console.log and console.warn
|
|
51
|
+
const consoleLogMock = jest.spyOn(console, 'log');
|
|
52
|
+
const consoleWarnMock = jest.spyOn(console, 'warn');
|
|
53
|
+
|
|
54
|
+
describe('DphV1', () => {
|
|
55
|
+
// Service instance
|
|
56
|
+
let dphService;
|
|
57
|
+
|
|
58
|
+
// Variables to hold link values
|
|
59
|
+
let completeADraftByContractTermsIdLink;
|
|
60
|
+
let completeADraftByDraftIdLink;
|
|
61
|
+
let completeContractTermsDocumentByDocumentIdLink;
|
|
62
|
+
let completeDraftContractTermsByDataProductIdLink;
|
|
63
|
+
let createAContractTermsDocByContractTermsIdLink;
|
|
64
|
+
let createAContractTermsDocByDraftIdLink;
|
|
65
|
+
let createDataProductByCatalogIdLink;
|
|
66
|
+
let createDraftByContainerIdLink;
|
|
67
|
+
let createNewDraftByDataProductIdLink;
|
|
68
|
+
let deleteAContractDocumentByDraftIdLink;
|
|
69
|
+
let deleteADraftByContractTermsIdLink;
|
|
70
|
+
let deleteADraftByDraftIdLink;
|
|
71
|
+
let deleteContractDocumentByDataProductIdLink;
|
|
72
|
+
let deleteContractTermsDocumentByDocumentIdLink;
|
|
73
|
+
let deleteDraftOfDataProductByDataProductIdLink;
|
|
74
|
+
let getADraftByContractTermsIdLink;
|
|
75
|
+
let getADraftContractDocumentByDraftIdLink;
|
|
76
|
+
let getADraftOfDataProductByDataProductIdLink;
|
|
77
|
+
let getAReleaseByReleaseIdLink;
|
|
78
|
+
let getAReleaseContractTermsByContractTermsIdLink;
|
|
79
|
+
let getAReleaseContractTermsByReleaseIdLink;
|
|
80
|
+
let getAReleaseOfDataProductByDataProductIdLink;
|
|
81
|
+
let getContractDocumentByDataProductIdLink;
|
|
82
|
+
let getContractTermsDocumentByIdDocumentIdLink;
|
|
83
|
+
let getDataProductByDataProductIdLink;
|
|
84
|
+
let getDraftByDraftIdLink;
|
|
85
|
+
let getListOfDataProductDraftsByDataProductIdLink;
|
|
86
|
+
let getListOfReleasesOfDataProductByDataProductIdLink;
|
|
87
|
+
let getReleaseContractDocumentByDataProductIdLink;
|
|
88
|
+
let getReleaseContractDocumentByDocumentIdLink;
|
|
89
|
+
let getStatusByCatalogIdLink;
|
|
90
|
+
let publishADraftByDraftIdLink;
|
|
91
|
+
let publishADraftOfDataProductByDataProductIdLink;
|
|
92
|
+
let retireAReleaseContractTermsByReleaseIdLink;
|
|
93
|
+
let retireAReleasesOfDataProductByDataProductIdLink;
|
|
94
|
+
let updateADraftByContractTermsIdLink;
|
|
95
|
+
let updateADraftByDraftIdLink;
|
|
96
|
+
let updateAReleaseByReleaseIdLink;
|
|
97
|
+
let updateContractDocumentByDataProductIdLink;
|
|
98
|
+
let updateContractDocumentByDraftIdLink;
|
|
99
|
+
let updateContractTermsDocumentByDocumentIdLink;
|
|
100
|
+
let updateDraftOfDataProductByDataProductIdLink;
|
|
101
|
+
let updateReleaseOfDataProductByDataProductIdLink;
|
|
102
|
+
let uploadContractTermsDocByDataProductIdLink;
|
|
103
|
+
|
|
104
|
+
// To access additional configuration values, uncomment this line and extract the values from config
|
|
105
|
+
// const config = readExternalSources(DphV1.DEFAULT_SERVICE_NAME);
|
|
106
|
+
|
|
107
|
+
test('Initialize service', async () => {
|
|
108
|
+
// begin-common
|
|
109
|
+
|
|
110
|
+
dphService = DphV1.newInstance();
|
|
111
|
+
|
|
112
|
+
// end-common
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test('initialize request example', async () => {
|
|
116
|
+
consoleLogMock.mockImplementation((output) => {
|
|
117
|
+
originalLog(output);
|
|
118
|
+
});
|
|
119
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
120
|
+
// if an error occurs, display the message and then fail the test
|
|
121
|
+
originalWarn(output);
|
|
122
|
+
expect(true).toBeFalsy();
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
originalLog('initialize() result:');
|
|
126
|
+
// begin-initialize
|
|
127
|
+
|
|
128
|
+
const params = {
|
|
129
|
+
include: [
|
|
130
|
+
'delivery_methods',
|
|
131
|
+
'domains_multi_industry',
|
|
132
|
+
'data_product_samples',
|
|
133
|
+
'workflows',
|
|
134
|
+
'project',
|
|
135
|
+
'catalog_configurations',
|
|
136
|
+
],
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
let res;
|
|
140
|
+
try {
|
|
141
|
+
res = await dphService.initialize(params);
|
|
142
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
143
|
+
} catch (err) {
|
|
144
|
+
console.warn(err);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// end-initialize
|
|
148
|
+
const responseBody = res.result;
|
|
149
|
+
createDraftByContainerIdLink = responseBody.container.id;
|
|
150
|
+
createDataProductByCatalogIdLink = responseBody.container.id;
|
|
151
|
+
getStatusByCatalogIdLink = responseBody.container.id;
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test('createDataProduct request example', async () => {
|
|
155
|
+
consoleLogMock.mockImplementation((output) => {
|
|
156
|
+
originalLog(output);
|
|
157
|
+
});
|
|
158
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
159
|
+
// if an error occurs, display the message and then fail the test
|
|
160
|
+
originalWarn(output);
|
|
161
|
+
expect(true).toBeFalsy();
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
originalLog('createDataProduct() result:');
|
|
165
|
+
// begin-create_data_product
|
|
166
|
+
|
|
167
|
+
// Request models needed by this operation.
|
|
168
|
+
|
|
169
|
+
// ContainerIdentity
|
|
170
|
+
const containerIdentityModel = {
|
|
171
|
+
id: 'd29c42eb-7100-4b7a-8257-c196dbcca1cd',
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// AssetPrototype
|
|
175
|
+
const assetPrototypeModel = {
|
|
176
|
+
container: containerIdentityModel,
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// DataProductDraftPrototype
|
|
180
|
+
const dataProductDraftPrototypeModel = {
|
|
181
|
+
name: 'My New Data Product',
|
|
182
|
+
asset: assetPrototypeModel,
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const params = {
|
|
186
|
+
drafts: [dataProductDraftPrototypeModel],
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
let res;
|
|
190
|
+
try {
|
|
191
|
+
res = await dphService.createDataProduct(params);
|
|
192
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
193
|
+
} catch (err) {
|
|
194
|
+
console.warn(err);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// end-create_data_product
|
|
198
|
+
const responseBody = res.result;
|
|
199
|
+
createNewDraftByDataProductIdLink = responseBody.id;
|
|
200
|
+
getContractDocumentByDataProductIdLink = responseBody.id;
|
|
201
|
+
retireAReleasesOfDataProductByDataProductIdLink = responseBody.id;
|
|
202
|
+
getDataProductByDataProductIdLink = responseBody.id;
|
|
203
|
+
updateDraftOfDataProductByDataProductIdLink = responseBody.id;
|
|
204
|
+
updateContractDocumentByDataProductIdLink = responseBody.id;
|
|
205
|
+
deleteDraftOfDataProductByDataProductIdLink = responseBody.id;
|
|
206
|
+
getAReleaseOfDataProductByDataProductIdLink = responseBody.id;
|
|
207
|
+
completeDraftContractTermsByDataProductIdLink = responseBody.id;
|
|
208
|
+
deleteContractDocumentByDataProductIdLink = responseBody.id;
|
|
209
|
+
getListOfDataProductDraftsByDataProductIdLink = responseBody.id;
|
|
210
|
+
getADraftOfDataProductByDataProductIdLink = responseBody.id;
|
|
211
|
+
getReleaseContractDocumentByDataProductIdLink = responseBody.id;
|
|
212
|
+
publishADraftOfDataProductByDataProductIdLink = responseBody.id;
|
|
213
|
+
getListOfReleasesOfDataProductByDataProductIdLink = responseBody.id;
|
|
214
|
+
updateReleaseOfDataProductByDataProductIdLink = responseBody.id;
|
|
215
|
+
uploadContractTermsDocByDataProductIdLink = responseBody.id;
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
test('createDataProductDraft request example', async () => {
|
|
219
|
+
consoleLogMock.mockImplementation((output) => {
|
|
220
|
+
originalLog(output);
|
|
221
|
+
});
|
|
222
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
223
|
+
// if an error occurs, display the message and then fail the test
|
|
224
|
+
originalWarn(output);
|
|
225
|
+
expect(true).toBeFalsy();
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
originalLog('createDataProductDraft() result:');
|
|
229
|
+
// begin-create_data_product_draft
|
|
230
|
+
|
|
231
|
+
// Request models needed by this operation.
|
|
232
|
+
|
|
233
|
+
// ContainerIdentity
|
|
234
|
+
const containerIdentityModel = {
|
|
235
|
+
id: 'd29c42eb-7100-4b7a-8257-c196dbcca1cd',
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
// AssetPrototype
|
|
239
|
+
const assetPrototypeModel = {
|
|
240
|
+
container: containerIdentityModel,
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
// DataProductDraftVersionRelease
|
|
244
|
+
const dataProductDraftVersionReleaseModel = {
|
|
245
|
+
id: '8bf83660-11fe-4427-a72a-8d8359af24e3',
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
// DataProductIdentity
|
|
249
|
+
const dataProductIdentityModel = {
|
|
250
|
+
id: 'b38df608-d34b-4d58-8136-ed25e6c6684e',
|
|
251
|
+
release: dataProductDraftVersionReleaseModel,
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
const params = {
|
|
255
|
+
dataProductId: createNewDraftByDataProductIdLink,
|
|
256
|
+
asset: assetPrototypeModel,
|
|
257
|
+
version: '1.2.0',
|
|
258
|
+
dataProduct: dataProductIdentityModel,
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
let res;
|
|
262
|
+
try {
|
|
263
|
+
res = await dphService.createDataProductDraft(params);
|
|
264
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
265
|
+
} catch (err) {
|
|
266
|
+
console.warn(err);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// end-create_data_product_draft
|
|
270
|
+
const responseBody = res.result;
|
|
271
|
+
getADraftContractDocumentByDraftIdLink = responseBody.id;
|
|
272
|
+
updateADraftByContractTermsIdLink = responseBody.contract_terms[0].id;
|
|
273
|
+
createAContractTermsDocByContractTermsIdLink = responseBody.contract_terms[0].id;
|
|
274
|
+
updateContractDocumentByDraftIdLink = responseBody.id;
|
|
275
|
+
getAReleaseContractTermsByContractTermsIdLink = responseBody.contract_terms[0].id;
|
|
276
|
+
completeADraftByContractTermsIdLink = responseBody.contract_terms[0].id;
|
|
277
|
+
getDraftByDraftIdLink = responseBody.id;
|
|
278
|
+
publishADraftByDraftIdLink = responseBody.id;
|
|
279
|
+
updateADraftByDraftIdLink = responseBody.id;
|
|
280
|
+
createAContractTermsDocByDraftIdLink = responseBody.id;
|
|
281
|
+
deleteAContractDocumentByDraftIdLink = responseBody.id;
|
|
282
|
+
deleteADraftByContractTermsIdLink = responseBody.contract_terms[0].id;
|
|
283
|
+
deleteADraftByDraftIdLink = responseBody.id;
|
|
284
|
+
completeADraftByDraftIdLink = responseBody.id;
|
|
285
|
+
getADraftByContractTermsIdLink = responseBody.contract_terms[0].id;
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
test('createDraftContractTermsDocument request example', async () => {
|
|
289
|
+
consoleLogMock.mockImplementation((output) => {
|
|
290
|
+
originalLog(output);
|
|
291
|
+
});
|
|
292
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
293
|
+
// if an error occurs, display the message and then fail the test
|
|
294
|
+
originalWarn(output);
|
|
295
|
+
expect(true).toBeFalsy();
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
originalLog('createDraftContractTermsDocument() result:');
|
|
299
|
+
// begin-create_draft_contract_terms_document
|
|
300
|
+
|
|
301
|
+
const params = {
|
|
302
|
+
dataProductId: uploadContractTermsDocByDataProductIdLink,
|
|
303
|
+
draftId: createAContractTermsDocByDraftIdLink,
|
|
304
|
+
contractTermsId: createAContractTermsDocByContractTermsIdLink,
|
|
305
|
+
type: 'terms_and_conditions',
|
|
306
|
+
name: 'Terms and conditions document',
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
let res;
|
|
310
|
+
try {
|
|
311
|
+
res = await dphService.createDraftContractTermsDocument(params);
|
|
312
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
313
|
+
} catch (err) {
|
|
314
|
+
console.warn(err);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// end-create_draft_contract_terms_document
|
|
318
|
+
const responseBody = res.result;
|
|
319
|
+
getReleaseContractDocumentByDocumentIdLink = responseBody.id;
|
|
320
|
+
deleteContractTermsDocumentByDocumentIdLink = responseBody.id;
|
|
321
|
+
getContractTermsDocumentByIdDocumentIdLink = responseBody.id;
|
|
322
|
+
updateContractTermsDocumentByDocumentIdLink = responseBody.id;
|
|
323
|
+
completeContractTermsDocumentByDocumentIdLink = responseBody.id;
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
test('publishDataProductDraft request example', async () => {
|
|
327
|
+
consoleLogMock.mockImplementation((output) => {
|
|
328
|
+
originalLog(output);
|
|
329
|
+
});
|
|
330
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
331
|
+
// if an error occurs, display the message and then fail the test
|
|
332
|
+
originalWarn(output);
|
|
333
|
+
expect(true).toBeFalsy();
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
originalLog('publishDataProductDraft() result:');
|
|
337
|
+
// begin-publish_data_product_draft
|
|
338
|
+
|
|
339
|
+
const params = {
|
|
340
|
+
dataProductId: publishADraftOfDataProductByDataProductIdLink,
|
|
341
|
+
draftId: publishADraftByDraftIdLink,
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
let res;
|
|
345
|
+
try {
|
|
346
|
+
res = await dphService.publishDataProductDraft(params);
|
|
347
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
348
|
+
} catch (err) {
|
|
349
|
+
console.warn(err);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// end-publish_data_product_draft
|
|
353
|
+
const responseBody = res.result;
|
|
354
|
+
updateAReleaseByReleaseIdLink = responseBody.id;
|
|
355
|
+
getAReleaseContractTermsByReleaseIdLink = responseBody.id;
|
|
356
|
+
retireAReleaseContractTermsByReleaseIdLink = responseBody.id;
|
|
357
|
+
getAReleaseByReleaseIdLink = responseBody.id;
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
test('getInitializeStatus request example', async () => {
|
|
361
|
+
consoleLogMock.mockImplementation((output) => {
|
|
362
|
+
originalLog(output);
|
|
363
|
+
});
|
|
364
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
365
|
+
// if an error occurs, display the message and then fail the test
|
|
366
|
+
originalWarn(output);
|
|
367
|
+
expect(true).toBeFalsy();
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
originalLog('getInitializeStatus() result:');
|
|
371
|
+
// begin-get_initialize_status
|
|
372
|
+
|
|
373
|
+
let res;
|
|
374
|
+
try {
|
|
375
|
+
res = await dphService.getInitializeStatus({});
|
|
376
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
377
|
+
} catch (err) {
|
|
378
|
+
console.warn(err);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// end-get_initialize_status
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
test('getServiceIdCredentials request example', async () => {
|
|
385
|
+
consoleLogMock.mockImplementation((output) => {
|
|
386
|
+
originalLog(output);
|
|
387
|
+
});
|
|
388
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
389
|
+
// if an error occurs, display the message and then fail the test
|
|
390
|
+
originalWarn(output);
|
|
391
|
+
expect(true).toBeFalsy();
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
originalLog('getServiceIdCredentials() result:');
|
|
395
|
+
// begin-get_service_id_credentials
|
|
396
|
+
|
|
397
|
+
let res;
|
|
398
|
+
try {
|
|
399
|
+
res = await dphService.getServiceIdCredentials({});
|
|
400
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
401
|
+
} catch (err) {
|
|
402
|
+
console.warn(err);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// end-get_service_id_credentials
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
test('manageApiKeys request example', async () => {
|
|
409
|
+
consoleLogMock.mockImplementation((output) => {
|
|
410
|
+
originalLog(output);
|
|
411
|
+
});
|
|
412
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
413
|
+
// if an error occurs, display the message and then fail the test
|
|
414
|
+
originalWarn(output);
|
|
415
|
+
expect(true).toBeFalsy();
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
// begin-manage_api_keys
|
|
419
|
+
|
|
420
|
+
try {
|
|
421
|
+
await dphService.manageApiKeys({});
|
|
422
|
+
} catch (err) {
|
|
423
|
+
console.warn(err);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// end-manage_api_keys
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
test('createDataAssetVisualization request example', async () => {
|
|
430
|
+
consoleLogMock.mockImplementation((output) => {
|
|
431
|
+
originalLog(output);
|
|
432
|
+
});
|
|
433
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
434
|
+
// if an error occurs, display the message and then fail the test
|
|
435
|
+
originalWarn(output);
|
|
436
|
+
expect(true).toBeFalsy();
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
originalLog('createDataAssetVisualization() result:');
|
|
440
|
+
// begin-create_data_asset_visualization
|
|
441
|
+
|
|
442
|
+
// Request models needed by this operation.
|
|
443
|
+
|
|
444
|
+
// ContainerReference
|
|
445
|
+
const containerReferenceModel = {
|
|
446
|
+
id: '2be8f727-c5d2-4cb0-9216-f9888f428048',
|
|
447
|
+
type: 'catalog',
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
// AssetReference
|
|
451
|
+
const assetReferenceModel = {
|
|
452
|
+
id: 'caeee3f3-756e-47d5-846d-da4600809e22',
|
|
453
|
+
container: containerReferenceModel,
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
// DataAssetRelationship
|
|
457
|
+
const dataAssetRelationshipModel = {
|
|
458
|
+
asset: assetReferenceModel,
|
|
459
|
+
related_asset: assetReferenceModel,
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
const params = {
|
|
463
|
+
assets: [dataAssetRelationshipModel],
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
let res;
|
|
467
|
+
try {
|
|
468
|
+
res = await dphService.createDataAssetVisualization(params);
|
|
469
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
470
|
+
} catch (err) {
|
|
471
|
+
console.warn(err);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// end-create_data_asset_visualization
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
test('reinitiateDataAssetVisualization request example', async () => {
|
|
478
|
+
consoleLogMock.mockImplementation((output) => {
|
|
479
|
+
originalLog(output);
|
|
480
|
+
});
|
|
481
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
482
|
+
// if an error occurs, display the message and then fail the test
|
|
483
|
+
originalWarn(output);
|
|
484
|
+
expect(true).toBeFalsy();
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
originalLog('reinitiateDataAssetVisualization() result:');
|
|
488
|
+
// begin-reinitiate_data_asset_visualization
|
|
489
|
+
|
|
490
|
+
// Request models needed by this operation.
|
|
491
|
+
|
|
492
|
+
// ContainerReference
|
|
493
|
+
const containerReferenceModel = {
|
|
494
|
+
id: '2be8f727-c5d2-4cb0-9216-f9888f428048',
|
|
495
|
+
type: 'catalog',
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
// AssetReference
|
|
499
|
+
const assetReferenceModel = {
|
|
500
|
+
id: 'caeee3f3-756e-47d5-846d-da4600809e22',
|
|
501
|
+
container: containerReferenceModel,
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
// DataAssetRelationship
|
|
505
|
+
const dataAssetRelationshipModel = {
|
|
506
|
+
asset: assetReferenceModel,
|
|
507
|
+
related_asset: assetReferenceModel,
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
const params = {
|
|
511
|
+
assets: [dataAssetRelationshipModel],
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
let res;
|
|
515
|
+
try {
|
|
516
|
+
res = await dphService.reinitiateDataAssetVisualization(params);
|
|
517
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
518
|
+
} catch (err) {
|
|
519
|
+
console.warn(err);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// end-reinitiate_data_asset_visualization
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
test('listDataProducts request example', async () => {
|
|
526
|
+
consoleLogMock.mockImplementation((output) => {
|
|
527
|
+
originalLog(output);
|
|
528
|
+
});
|
|
529
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
530
|
+
// if an error occurs, display the message and then fail the test
|
|
531
|
+
originalWarn(output);
|
|
532
|
+
expect(true).toBeFalsy();
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
originalLog('listDataProducts() result:');
|
|
536
|
+
// begin-list_data_products
|
|
537
|
+
|
|
538
|
+
const params = {
|
|
539
|
+
limit: 10,
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
const allResults = [];
|
|
543
|
+
try {
|
|
544
|
+
const pager = new DphV1.DataProductsPager(dphService, params);
|
|
545
|
+
while (pager.hasNext()) {
|
|
546
|
+
const nextPage = await pager.getNext();
|
|
547
|
+
expect(nextPage).not.toBeNull();
|
|
548
|
+
allResults.push(...nextPage);
|
|
549
|
+
}
|
|
550
|
+
console.log(JSON.stringify(allResults, null, 2));
|
|
551
|
+
} catch (err) {
|
|
552
|
+
console.warn(err);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
// end-list_data_products
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
test('getDataProduct request example', async () => {
|
|
559
|
+
consoleLogMock.mockImplementation((output) => {
|
|
560
|
+
originalLog(output);
|
|
561
|
+
});
|
|
562
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
563
|
+
// if an error occurs, display the message and then fail the test
|
|
564
|
+
originalWarn(output);
|
|
565
|
+
expect(true).toBeFalsy();
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
originalLog('getDataProduct() result:');
|
|
569
|
+
// begin-get_data_product
|
|
570
|
+
|
|
571
|
+
const params = {
|
|
572
|
+
dataProductId: getDataProductByDataProductIdLink,
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
let res;
|
|
576
|
+
try {
|
|
577
|
+
res = await dphService.getDataProduct(params);
|
|
578
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
579
|
+
} catch (err) {
|
|
580
|
+
console.warn(err);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// end-get_data_product
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
test('completeDraftContractTermsDocument request example', async () => {
|
|
587
|
+
consoleLogMock.mockImplementation((output) => {
|
|
588
|
+
originalLog(output);
|
|
589
|
+
});
|
|
590
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
591
|
+
// if an error occurs, display the message and then fail the test
|
|
592
|
+
originalWarn(output);
|
|
593
|
+
expect(true).toBeFalsy();
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
originalLog('completeDraftContractTermsDocument() result:');
|
|
597
|
+
// begin-complete_draft_contract_terms_document
|
|
598
|
+
|
|
599
|
+
const params = {
|
|
600
|
+
dataProductId: completeDraftContractTermsByDataProductIdLink,
|
|
601
|
+
draftId: completeADraftByDraftIdLink,
|
|
602
|
+
contractTermsId: completeADraftByContractTermsIdLink,
|
|
603
|
+
documentId: completeContractTermsDocumentByDocumentIdLink,
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
let res;
|
|
607
|
+
try {
|
|
608
|
+
res = await dphService.completeDraftContractTermsDocument(params);
|
|
609
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
610
|
+
} catch (err) {
|
|
611
|
+
console.warn(err);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// end-complete_draft_contract_terms_document
|
|
615
|
+
});
|
|
616
|
+
|
|
617
|
+
test('listDataProductDrafts request example', async () => {
|
|
618
|
+
consoleLogMock.mockImplementation((output) => {
|
|
619
|
+
originalLog(output);
|
|
620
|
+
});
|
|
621
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
622
|
+
// if an error occurs, display the message and then fail the test
|
|
623
|
+
originalWarn(output);
|
|
624
|
+
expect(true).toBeFalsy();
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
originalLog('listDataProductDrafts() result:');
|
|
628
|
+
// begin-list_data_product_drafts
|
|
629
|
+
|
|
630
|
+
const params = {
|
|
631
|
+
dataProductId: getListOfDataProductDraftsByDataProductIdLink,
|
|
632
|
+
assetContainerId: 'testString',
|
|
633
|
+
version: 'testString',
|
|
634
|
+
limit: 10,
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
const allResults = [];
|
|
638
|
+
try {
|
|
639
|
+
const pager = new DphV1.DataProductDraftsPager(dphService, params);
|
|
640
|
+
while (pager.hasNext()) {
|
|
641
|
+
const nextPage = await pager.getNext();
|
|
642
|
+
expect(nextPage).not.toBeNull();
|
|
643
|
+
allResults.push(...nextPage);
|
|
644
|
+
}
|
|
645
|
+
console.log(JSON.stringify(allResults, null, 2));
|
|
646
|
+
} catch (err) {
|
|
647
|
+
console.warn(err);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// end-list_data_product_drafts
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
test('getDataProductDraft request example', async () => {
|
|
654
|
+
consoleLogMock.mockImplementation((output) => {
|
|
655
|
+
originalLog(output);
|
|
656
|
+
});
|
|
657
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
658
|
+
// if an error occurs, display the message and then fail the test
|
|
659
|
+
originalWarn(output);
|
|
660
|
+
expect(true).toBeFalsy();
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
originalLog('getDataProductDraft() result:');
|
|
664
|
+
// begin-get_data_product_draft
|
|
665
|
+
|
|
666
|
+
const params = {
|
|
667
|
+
dataProductId: getADraftOfDataProductByDataProductIdLink,
|
|
668
|
+
draftId: getDraftByDraftIdLink,
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
let res;
|
|
672
|
+
try {
|
|
673
|
+
res = await dphService.getDataProductDraft(params);
|
|
674
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
675
|
+
} catch (err) {
|
|
676
|
+
console.warn(err);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// end-get_data_product_draft
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
test('updateDataProductDraft request example', async () => {
|
|
683
|
+
consoleLogMock.mockImplementation((output) => {
|
|
684
|
+
originalLog(output);
|
|
685
|
+
});
|
|
686
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
687
|
+
// if an error occurs, display the message and then fail the test
|
|
688
|
+
originalWarn(output);
|
|
689
|
+
expect(true).toBeFalsy();
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
originalLog('updateDataProductDraft() result:');
|
|
693
|
+
// begin-update_data_product_draft
|
|
694
|
+
|
|
695
|
+
// Request models needed by this operation.
|
|
696
|
+
|
|
697
|
+
// JsonPatchOperation
|
|
698
|
+
const jsonPatchOperationModel = {
|
|
699
|
+
op: 'add',
|
|
700
|
+
path: 'testString',
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
const params = {
|
|
704
|
+
dataProductId: updateDraftOfDataProductByDataProductIdLink,
|
|
705
|
+
draftId: updateADraftByDraftIdLink,
|
|
706
|
+
jsonPatchInstructions: [jsonPatchOperationModel],
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
let res;
|
|
710
|
+
try {
|
|
711
|
+
res = await dphService.updateDataProductDraft(params);
|
|
712
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
713
|
+
} catch (err) {
|
|
714
|
+
console.warn(err);
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// end-update_data_product_draft
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
test('getDraftContractTermsDocument request example', async () => {
|
|
721
|
+
consoleLogMock.mockImplementation((output) => {
|
|
722
|
+
originalLog(output);
|
|
723
|
+
});
|
|
724
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
725
|
+
// if an error occurs, display the message and then fail the test
|
|
726
|
+
originalWarn(output);
|
|
727
|
+
expect(true).toBeFalsy();
|
|
728
|
+
});
|
|
729
|
+
|
|
730
|
+
originalLog('getDraftContractTermsDocument() result:');
|
|
731
|
+
// begin-get_draft_contract_terms_document
|
|
732
|
+
|
|
733
|
+
const params = {
|
|
734
|
+
dataProductId: getContractDocumentByDataProductIdLink,
|
|
735
|
+
draftId: getADraftContractDocumentByDraftIdLink,
|
|
736
|
+
contractTermsId: getADraftByContractTermsIdLink,
|
|
737
|
+
documentId: getContractTermsDocumentByIdDocumentIdLink,
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
let res;
|
|
741
|
+
try {
|
|
742
|
+
res = await dphService.getDraftContractTermsDocument(params);
|
|
743
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
744
|
+
} catch (err) {
|
|
745
|
+
console.warn(err);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
// end-get_draft_contract_terms_document
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
test('updateDraftContractTermsDocument request example', async () => {
|
|
752
|
+
consoleLogMock.mockImplementation((output) => {
|
|
753
|
+
originalLog(output);
|
|
754
|
+
});
|
|
755
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
756
|
+
// if an error occurs, display the message and then fail the test
|
|
757
|
+
originalWarn(output);
|
|
758
|
+
expect(true).toBeFalsy();
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
originalLog('updateDraftContractTermsDocument() result:');
|
|
762
|
+
// begin-update_draft_contract_terms_document
|
|
763
|
+
|
|
764
|
+
// Request models needed by this operation.
|
|
765
|
+
|
|
766
|
+
// JsonPatchOperation
|
|
767
|
+
const jsonPatchOperationModel = {
|
|
768
|
+
op: 'add',
|
|
769
|
+
path: 'testString',
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
const params = {
|
|
773
|
+
dataProductId: updateContractDocumentByDataProductIdLink,
|
|
774
|
+
draftId: updateContractDocumentByDraftIdLink,
|
|
775
|
+
contractTermsId: updateADraftByContractTermsIdLink,
|
|
776
|
+
documentId: updateContractTermsDocumentByDocumentIdLink,
|
|
777
|
+
jsonPatchInstructions: [jsonPatchOperationModel],
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
let res;
|
|
781
|
+
try {
|
|
782
|
+
res = await dphService.updateDraftContractTermsDocument(params);
|
|
783
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
784
|
+
} catch (err) {
|
|
785
|
+
console.warn(err);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// end-update_draft_contract_terms_document
|
|
789
|
+
});
|
|
790
|
+
|
|
791
|
+
test('getDataProductDraftContractTerms request example', async () => {
|
|
792
|
+
consoleLogMock.mockImplementation((output) => {
|
|
793
|
+
originalLog(output);
|
|
794
|
+
});
|
|
795
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
796
|
+
// if an error occurs, display the message and then fail the test
|
|
797
|
+
originalWarn(output);
|
|
798
|
+
expect(true).toBeFalsy();
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
originalLog('getDataProductDraftContractTerms() result:');
|
|
802
|
+
// begin-get_data_product_draft_contract_terms
|
|
803
|
+
|
|
804
|
+
const params = {
|
|
805
|
+
dataProductId: 'testString',
|
|
806
|
+
draftId: 'testString',
|
|
807
|
+
contractTermsId: 'testString',
|
|
808
|
+
};
|
|
809
|
+
|
|
810
|
+
let res;
|
|
811
|
+
try {
|
|
812
|
+
res = await dphService.getDataProductDraftContractTerms(params);
|
|
813
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
814
|
+
} catch (err) {
|
|
815
|
+
console.warn(err);
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
// end-get_data_product_draft_contract_terms
|
|
819
|
+
});
|
|
820
|
+
|
|
821
|
+
test('replaceDataProductDraftContractTerms request example', async () => {
|
|
822
|
+
consoleLogMock.mockImplementation((output) => {
|
|
823
|
+
originalLog(output);
|
|
824
|
+
});
|
|
825
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
826
|
+
// if an error occurs, display the message and then fail the test
|
|
827
|
+
originalWarn(output);
|
|
828
|
+
expect(true).toBeFalsy();
|
|
829
|
+
});
|
|
830
|
+
|
|
831
|
+
originalLog('replaceDataProductDraftContractTerms() result:');
|
|
832
|
+
// begin-replace_data_product_draft_contract_terms
|
|
833
|
+
|
|
834
|
+
// Request models needed by this operation.
|
|
835
|
+
|
|
836
|
+
// ContractTermsDocument
|
|
837
|
+
const contractTermsDocumentModel = {
|
|
838
|
+
url: 'https://ibm.com/document',
|
|
839
|
+
type: 'terms_and_conditions',
|
|
840
|
+
name: 'Terms and Conditions',
|
|
841
|
+
id: 'b38df608-d34b-4d58-8136-ed25e6c6684e',
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
// Domain
|
|
845
|
+
const domainModel = {
|
|
846
|
+
id: 'b38df608-d34b-4d58-8136-ed25e6c6684e',
|
|
847
|
+
name: 'domain_name',
|
|
848
|
+
};
|
|
849
|
+
|
|
850
|
+
// Overview
|
|
851
|
+
const overviewModel = {
|
|
852
|
+
api_version: 'v3.0.1',
|
|
853
|
+
kind: 'DataContract',
|
|
854
|
+
name: 'Sample Data Contract',
|
|
855
|
+
version: 'v0.0',
|
|
856
|
+
domain: domainModel,
|
|
857
|
+
more_info: 'List of links to sources that provide more details on the data contract.',
|
|
858
|
+
};
|
|
859
|
+
|
|
860
|
+
// ContractTermsMoreInfo
|
|
861
|
+
const contractTermsMoreInfoModel = {
|
|
862
|
+
type: 'privacy-statement',
|
|
863
|
+
url: 'https://www.moreinfo.example.coms',
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
// Description
|
|
867
|
+
const descriptionModel = {
|
|
868
|
+
purpose: 'Intended purpose for the provided data.',
|
|
869
|
+
limitations: 'Technical, compliance, and legal limitations for data use.',
|
|
870
|
+
usage: 'Recommended usage of the data.',
|
|
871
|
+
more_info: [contractTermsMoreInfoModel],
|
|
872
|
+
custom_properties: 'Custom properties that are not part of the standard.',
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
// ContractTemplateOrganization
|
|
876
|
+
const contractTemplateOrganizationModel = {
|
|
877
|
+
user_id: 'IBMid-691000IN4G',
|
|
878
|
+
role: 'owner',
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
// Roles
|
|
882
|
+
const rolesModel = {
|
|
883
|
+
role: 'IAM Role',
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
// Pricing
|
|
887
|
+
const pricingModel = {
|
|
888
|
+
amount: 'Amount',
|
|
889
|
+
currency: 'Currency',
|
|
890
|
+
unit: 'Unit',
|
|
891
|
+
};
|
|
892
|
+
|
|
893
|
+
// ContractTemplateSLAProperty
|
|
894
|
+
const contractTemplateSlaPropertyModel = {
|
|
895
|
+
property: 'slaproperty',
|
|
896
|
+
value: 'slavalue',
|
|
897
|
+
};
|
|
898
|
+
|
|
899
|
+
// ContractTemplateSLA
|
|
900
|
+
const contractTemplateSlaModel = {
|
|
901
|
+
default_element: 'sladefaultelement',
|
|
902
|
+
properties: [contractTemplateSlaPropertyModel],
|
|
903
|
+
};
|
|
904
|
+
|
|
905
|
+
// ContractTemplateSupportAndCommunication
|
|
906
|
+
const contractTemplateSupportAndCommunicationModel = {
|
|
907
|
+
channel: 'channel',
|
|
908
|
+
url: 'https://www.example.coms',
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
// ContractTemplateCustomProperty
|
|
912
|
+
const contractTemplateCustomPropertyModel = {
|
|
913
|
+
key: 'The name of the key.',
|
|
914
|
+
value: 'The value of the key.',
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
// ContractAsset
|
|
918
|
+
const contractAssetModel = {
|
|
919
|
+
id: '684d6aa0-9f93-4564-8a20-e354bc469857',
|
|
920
|
+
name: 'PAYMENT_TRANSACTIONS1',
|
|
921
|
+
};
|
|
922
|
+
|
|
923
|
+
// ContractServer
|
|
924
|
+
const contractServerModel = {
|
|
925
|
+
server: 'snowflake-server-01',
|
|
926
|
+
asset: contractAssetModel,
|
|
927
|
+
connection_id: '8d7701be-709a-49c0-ae4e-a7daeaae6def',
|
|
928
|
+
type: 'snowflake',
|
|
929
|
+
description: 'Snowflake analytics server',
|
|
930
|
+
environment: 'dev',
|
|
931
|
+
account: 'acc-456',
|
|
932
|
+
catalog: 'analytics_cat',
|
|
933
|
+
database: 'analytics_db',
|
|
934
|
+
dataset: 'customer_data',
|
|
935
|
+
delimiter: ',',
|
|
936
|
+
endpoint_url: 'https://xy12345.snowflakecomputing.com',
|
|
937
|
+
format: 'parquet',
|
|
938
|
+
host: 'xy12345.snowflakecomputing.com',
|
|
939
|
+
location: 'Mumbai',
|
|
940
|
+
path: '/analytics/data',
|
|
941
|
+
port: '443',
|
|
942
|
+
project: 'projectY',
|
|
943
|
+
region: 'ap-south-1',
|
|
944
|
+
region_name: 'Asia South 1',
|
|
945
|
+
schema: 'PAYMENT_TRANSACTIONS1',
|
|
946
|
+
service_name: 'snowflake',
|
|
947
|
+
staging_dir: '/snowflake/staging',
|
|
948
|
+
stream: 'stream_analytics',
|
|
949
|
+
warehouse: 'wh_xlarge',
|
|
950
|
+
custom_properties: [contractTemplateCustomPropertyModel],
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
// ContractSchemaPropertyType
|
|
954
|
+
const contractSchemaPropertyTypeModel = {
|
|
955
|
+
type: 'varchar',
|
|
956
|
+
length: '1024',
|
|
957
|
+
scale: '0',
|
|
958
|
+
nullable: 'true',
|
|
959
|
+
signed: 'false',
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
// ContractSchemaProperty
|
|
963
|
+
const contractSchemaPropertyModel = {
|
|
964
|
+
name: 'product_brand_code',
|
|
965
|
+
type: contractSchemaPropertyTypeModel,
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
// ContractSchema
|
|
969
|
+
const contractSchemaModel = {
|
|
970
|
+
asset_id: '09ca6b40-7c89-412a-8951-ad820da709d1',
|
|
971
|
+
connection_id: '6cc57d4d-2229-438f-91a0-2c455556422b',
|
|
972
|
+
name: '000000_0-2025-06-20-20-28-52.csv',
|
|
973
|
+
connection_path: '/dpx-test-bucket/000000_0-2025-06-20-20-28-52.csv',
|
|
974
|
+
physical_type: 'text/csv',
|
|
975
|
+
properties: [contractSchemaPropertyModel],
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
const params = {
|
|
979
|
+
dataProductId: 'testString',
|
|
980
|
+
draftId: 'testString',
|
|
981
|
+
contractTermsId: 'testString',
|
|
982
|
+
documents: [contractTermsDocumentModel],
|
|
983
|
+
overview: overviewModel,
|
|
984
|
+
description: descriptionModel,
|
|
985
|
+
organization: [contractTemplateOrganizationModel],
|
|
986
|
+
roles: [rolesModel],
|
|
987
|
+
price: pricingModel,
|
|
988
|
+
sla: [contractTemplateSlaModel],
|
|
989
|
+
supportAndCommunication: [contractTemplateSupportAndCommunicationModel],
|
|
990
|
+
customProperties: [contractTemplateCustomPropertyModel],
|
|
991
|
+
servers: [contractServerModel],
|
|
992
|
+
schema: [contractSchemaModel],
|
|
993
|
+
};
|
|
994
|
+
|
|
995
|
+
let res;
|
|
996
|
+
try {
|
|
997
|
+
res = await dphService.replaceDataProductDraftContractTerms(params);
|
|
998
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
999
|
+
} catch (err) {
|
|
1000
|
+
console.warn(err);
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
// end-replace_data_product_draft_contract_terms
|
|
1004
|
+
});
|
|
1005
|
+
|
|
1006
|
+
test('updateDataProductDraftContractTerms request example', async () => {
|
|
1007
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1008
|
+
originalLog(output);
|
|
1009
|
+
});
|
|
1010
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1011
|
+
// if an error occurs, display the message and then fail the test
|
|
1012
|
+
originalWarn(output);
|
|
1013
|
+
expect(true).toBeFalsy();
|
|
1014
|
+
});
|
|
1015
|
+
|
|
1016
|
+
originalLog('updateDataProductDraftContractTerms() result:');
|
|
1017
|
+
// begin-update_data_product_draft_contract_terms
|
|
1018
|
+
|
|
1019
|
+
// Request models needed by this operation.
|
|
1020
|
+
|
|
1021
|
+
// JsonPatchOperation
|
|
1022
|
+
const jsonPatchOperationModel = {
|
|
1023
|
+
op: 'add',
|
|
1024
|
+
path: 'testString',
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1027
|
+
const params = {
|
|
1028
|
+
dataProductId: 'testString',
|
|
1029
|
+
draftId: 'testString',
|
|
1030
|
+
contractTermsId: 'testString',
|
|
1031
|
+
jsonPatchInstructions: [jsonPatchOperationModel],
|
|
1032
|
+
};
|
|
1033
|
+
|
|
1034
|
+
let res;
|
|
1035
|
+
try {
|
|
1036
|
+
res = await dphService.updateDataProductDraftContractTerms(params);
|
|
1037
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1038
|
+
} catch (err) {
|
|
1039
|
+
console.warn(err);
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
// end-update_data_product_draft_contract_terms
|
|
1043
|
+
});
|
|
1044
|
+
|
|
1045
|
+
test('getContractTermsInSpecifiedFormat request example', async () => {
|
|
1046
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1047
|
+
originalLog(output);
|
|
1048
|
+
});
|
|
1049
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1050
|
+
// if an error occurs, display the message and then fail the test
|
|
1051
|
+
originalWarn(output);
|
|
1052
|
+
expect(true).toBeFalsy();
|
|
1053
|
+
});
|
|
1054
|
+
|
|
1055
|
+
originalLog('getContractTermsInSpecifiedFormat() result:');
|
|
1056
|
+
// begin-get_contract_terms_in_specified_format
|
|
1057
|
+
|
|
1058
|
+
const params = {
|
|
1059
|
+
dataProductId: 'testString',
|
|
1060
|
+
draftId: 'testString',
|
|
1061
|
+
contractTermsId: 'testString',
|
|
1062
|
+
format: 'testString',
|
|
1063
|
+
formatVersion: 'testString',
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
let res;
|
|
1067
|
+
try {
|
|
1068
|
+
res = await dphService.getContractTermsInSpecifiedFormat(params);
|
|
1069
|
+
// response is binary
|
|
1070
|
+
// fs.writeFileSync('result.out', res.result);
|
|
1071
|
+
} catch (err) {
|
|
1072
|
+
console.warn(err);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
// end-get_contract_terms_in_specified_format
|
|
1076
|
+
});
|
|
1077
|
+
|
|
1078
|
+
test('getDataProductRelease request example', async () => {
|
|
1079
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1080
|
+
originalLog(output);
|
|
1081
|
+
});
|
|
1082
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1083
|
+
// if an error occurs, display the message and then fail the test
|
|
1084
|
+
originalWarn(output);
|
|
1085
|
+
expect(true).toBeFalsy();
|
|
1086
|
+
});
|
|
1087
|
+
|
|
1088
|
+
originalLog('getDataProductRelease() result:');
|
|
1089
|
+
// begin-get_data_product_release
|
|
1090
|
+
|
|
1091
|
+
const params = {
|
|
1092
|
+
dataProductId: getAReleaseOfDataProductByDataProductIdLink,
|
|
1093
|
+
releaseId: getAReleaseByReleaseIdLink,
|
|
1094
|
+
};
|
|
1095
|
+
|
|
1096
|
+
let res;
|
|
1097
|
+
try {
|
|
1098
|
+
res = await dphService.getDataProductRelease(params);
|
|
1099
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1100
|
+
} catch (err) {
|
|
1101
|
+
console.warn(err);
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
// end-get_data_product_release
|
|
1105
|
+
});
|
|
1106
|
+
|
|
1107
|
+
test('updateDataProductRelease request example', async () => {
|
|
1108
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1109
|
+
originalLog(output);
|
|
1110
|
+
});
|
|
1111
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1112
|
+
// if an error occurs, display the message and then fail the test
|
|
1113
|
+
originalWarn(output);
|
|
1114
|
+
expect(true).toBeFalsy();
|
|
1115
|
+
});
|
|
1116
|
+
|
|
1117
|
+
originalLog('updateDataProductRelease() result:');
|
|
1118
|
+
// begin-update_data_product_release
|
|
1119
|
+
|
|
1120
|
+
// Request models needed by this operation.
|
|
1121
|
+
|
|
1122
|
+
// JsonPatchOperation
|
|
1123
|
+
const jsonPatchOperationModel = {
|
|
1124
|
+
op: 'add',
|
|
1125
|
+
path: 'testString',
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
const params = {
|
|
1129
|
+
dataProductId: updateReleaseOfDataProductByDataProductIdLink,
|
|
1130
|
+
releaseId: 'testString',
|
|
1131
|
+
jsonPatchInstructions: [jsonPatchOperationModel],
|
|
1132
|
+
};
|
|
1133
|
+
|
|
1134
|
+
let res;
|
|
1135
|
+
try {
|
|
1136
|
+
res = await dphService.updateDataProductRelease(params);
|
|
1137
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1138
|
+
} catch (err) {
|
|
1139
|
+
console.warn(err);
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
// end-update_data_product_release
|
|
1143
|
+
});
|
|
1144
|
+
|
|
1145
|
+
test('getReleaseContractTermsDocument request example', async () => {
|
|
1146
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1147
|
+
originalLog(output);
|
|
1148
|
+
});
|
|
1149
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1150
|
+
// if an error occurs, display the message and then fail the test
|
|
1151
|
+
originalWarn(output);
|
|
1152
|
+
expect(true).toBeFalsy();
|
|
1153
|
+
});
|
|
1154
|
+
|
|
1155
|
+
originalLog('getReleaseContractTermsDocument() result:');
|
|
1156
|
+
// begin-get_release_contract_terms_document
|
|
1157
|
+
|
|
1158
|
+
const params = {
|
|
1159
|
+
dataProductId: getReleaseContractDocumentByDataProductIdLink,
|
|
1160
|
+
releaseId: getAReleaseContractTermsByReleaseIdLink,
|
|
1161
|
+
contractTermsId: getAReleaseContractTermsByContractTermsIdLink,
|
|
1162
|
+
documentId: getReleaseContractDocumentByDocumentIdLink,
|
|
1163
|
+
};
|
|
1164
|
+
|
|
1165
|
+
let res;
|
|
1166
|
+
try {
|
|
1167
|
+
res = await dphService.getReleaseContractTermsDocument(params);
|
|
1168
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1169
|
+
} catch (err) {
|
|
1170
|
+
console.warn(err);
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
// end-get_release_contract_terms_document
|
|
1174
|
+
});
|
|
1175
|
+
|
|
1176
|
+
test('getPublishedDataProductDraftContractTerms request example', async () => {
|
|
1177
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1178
|
+
originalLog(output);
|
|
1179
|
+
});
|
|
1180
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1181
|
+
// if an error occurs, display the message and then fail the test
|
|
1182
|
+
originalWarn(output);
|
|
1183
|
+
expect(true).toBeFalsy();
|
|
1184
|
+
});
|
|
1185
|
+
|
|
1186
|
+
originalLog('getPublishedDataProductDraftContractTerms() result:');
|
|
1187
|
+
// begin-get_published_data_product_draft_contract_terms
|
|
1188
|
+
|
|
1189
|
+
const params = {
|
|
1190
|
+
dataProductId: 'testString',
|
|
1191
|
+
releaseId: 'testString',
|
|
1192
|
+
contractTermsId: 'testString',
|
|
1193
|
+
};
|
|
1194
|
+
|
|
1195
|
+
let res;
|
|
1196
|
+
try {
|
|
1197
|
+
res = await dphService.getPublishedDataProductDraftContractTerms(params);
|
|
1198
|
+
// response is binary
|
|
1199
|
+
// fs.writeFileSync('result.out', res.result);
|
|
1200
|
+
} catch (err) {
|
|
1201
|
+
console.warn(err);
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
// end-get_published_data_product_draft_contract_terms
|
|
1205
|
+
});
|
|
1206
|
+
|
|
1207
|
+
test('listDataProductReleases request example', async () => {
|
|
1208
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1209
|
+
originalLog(output);
|
|
1210
|
+
});
|
|
1211
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1212
|
+
// if an error occurs, display the message and then fail the test
|
|
1213
|
+
originalWarn(output);
|
|
1214
|
+
expect(true).toBeFalsy();
|
|
1215
|
+
});
|
|
1216
|
+
|
|
1217
|
+
originalLog('listDataProductReleases() result:');
|
|
1218
|
+
// begin-list_data_product_releases
|
|
1219
|
+
|
|
1220
|
+
const params = {
|
|
1221
|
+
dataProductId: getListOfReleasesOfDataProductByDataProductIdLink,
|
|
1222
|
+
assetContainerId: 'testString',
|
|
1223
|
+
state: ['available'],
|
|
1224
|
+
version: 'testString',
|
|
1225
|
+
limit: 10,
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1228
|
+
const allResults = [];
|
|
1229
|
+
try {
|
|
1230
|
+
const pager = new DphV1.DataProductReleasesPager(dphService, params);
|
|
1231
|
+
while (pager.hasNext()) {
|
|
1232
|
+
const nextPage = await pager.getNext();
|
|
1233
|
+
expect(nextPage).not.toBeNull();
|
|
1234
|
+
allResults.push(...nextPage);
|
|
1235
|
+
}
|
|
1236
|
+
console.log(JSON.stringify(allResults, null, 2));
|
|
1237
|
+
} catch (err) {
|
|
1238
|
+
console.warn(err);
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
// end-list_data_product_releases
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1244
|
+
test('retireDataProductRelease request example', async () => {
|
|
1245
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1246
|
+
originalLog(output);
|
|
1247
|
+
});
|
|
1248
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1249
|
+
// if an error occurs, display the message and then fail the test
|
|
1250
|
+
originalWarn(output);
|
|
1251
|
+
expect(true).toBeFalsy();
|
|
1252
|
+
});
|
|
1253
|
+
|
|
1254
|
+
originalLog('retireDataProductRelease() result:');
|
|
1255
|
+
// begin-retire_data_product_release
|
|
1256
|
+
|
|
1257
|
+
const params = {
|
|
1258
|
+
dataProductId: retireAReleasesOfDataProductByDataProductIdLink,
|
|
1259
|
+
releaseId: retireAReleaseContractTermsByReleaseIdLink,
|
|
1260
|
+
};
|
|
1261
|
+
|
|
1262
|
+
let res;
|
|
1263
|
+
try {
|
|
1264
|
+
res = await dphService.retireDataProductRelease(params);
|
|
1265
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1266
|
+
} catch (err) {
|
|
1267
|
+
console.warn(err);
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
// end-retire_data_product_release
|
|
1271
|
+
});
|
|
1272
|
+
|
|
1273
|
+
test('createRevokeAccessProcess request example', async () => {
|
|
1274
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1275
|
+
originalLog(output);
|
|
1276
|
+
});
|
|
1277
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1278
|
+
// if an error occurs, display the message and then fail the test
|
|
1279
|
+
originalWarn(output);
|
|
1280
|
+
expect(true).toBeFalsy();
|
|
1281
|
+
});
|
|
1282
|
+
|
|
1283
|
+
originalLog('createRevokeAccessProcess() result:');
|
|
1284
|
+
// begin-create_revoke_access_process
|
|
1285
|
+
|
|
1286
|
+
const params = {
|
|
1287
|
+
dataProductId: 'testString',
|
|
1288
|
+
releaseId: 'testString',
|
|
1289
|
+
body: Buffer.from('This is a mock file.'),
|
|
1290
|
+
};
|
|
1291
|
+
|
|
1292
|
+
let res;
|
|
1293
|
+
try {
|
|
1294
|
+
res = await dphService.createRevokeAccessProcess(params);
|
|
1295
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1296
|
+
} catch (err) {
|
|
1297
|
+
console.warn(err);
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
// end-create_revoke_access_process
|
|
1301
|
+
});
|
|
1302
|
+
|
|
1303
|
+
test('listDataProductContractTemplate request example', async () => {
|
|
1304
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1305
|
+
originalLog(output);
|
|
1306
|
+
});
|
|
1307
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1308
|
+
// if an error occurs, display the message and then fail the test
|
|
1309
|
+
originalWarn(output);
|
|
1310
|
+
expect(true).toBeFalsy();
|
|
1311
|
+
});
|
|
1312
|
+
|
|
1313
|
+
originalLog('listDataProductContractTemplate() result:');
|
|
1314
|
+
// begin-list_data_product_contract_template
|
|
1315
|
+
|
|
1316
|
+
let res;
|
|
1317
|
+
try {
|
|
1318
|
+
res = await dphService.listDataProductContractTemplate({});
|
|
1319
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1320
|
+
} catch (err) {
|
|
1321
|
+
console.warn(err);
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
// end-list_data_product_contract_template
|
|
1325
|
+
});
|
|
1326
|
+
|
|
1327
|
+
test('createContractTemplate request example', async () => {
|
|
1328
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1329
|
+
originalLog(output);
|
|
1330
|
+
});
|
|
1331
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1332
|
+
// if an error occurs, display the message and then fail the test
|
|
1333
|
+
originalWarn(output);
|
|
1334
|
+
expect(true).toBeFalsy();
|
|
1335
|
+
});
|
|
1336
|
+
|
|
1337
|
+
originalLog('createContractTemplate() result:');
|
|
1338
|
+
// begin-create_contract_template
|
|
1339
|
+
|
|
1340
|
+
// Request models needed by this operation.
|
|
1341
|
+
|
|
1342
|
+
// ContainerReference
|
|
1343
|
+
const containerReferenceModel = {
|
|
1344
|
+
id: '531f74a-01c8-4e91-8e29-b018db683c86',
|
|
1345
|
+
type: 'catalog',
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1348
|
+
// Domain
|
|
1349
|
+
const domainModel = {
|
|
1350
|
+
id: '0094ebe9-abc3-473b-80ea-c777ede095ea',
|
|
1351
|
+
name: 'Test Domain New',
|
|
1352
|
+
};
|
|
1353
|
+
|
|
1354
|
+
// Overview
|
|
1355
|
+
const overviewModel = {
|
|
1356
|
+
name: 'Sample Data Contract',
|
|
1357
|
+
version: '0.0.0',
|
|
1358
|
+
domain: domainModel,
|
|
1359
|
+
more_info: 'List of links to sources that provide more details on the data contract.',
|
|
1360
|
+
};
|
|
1361
|
+
|
|
1362
|
+
// ContractTermsMoreInfo
|
|
1363
|
+
const contractTermsMoreInfoModel = {
|
|
1364
|
+
type: 'privacy-statement',
|
|
1365
|
+
url: 'https://www.moreinfo.example.coms',
|
|
1366
|
+
};
|
|
1367
|
+
|
|
1368
|
+
// Description
|
|
1369
|
+
const descriptionModel = {
|
|
1370
|
+
purpose: 'Intended purpose for the provided data.',
|
|
1371
|
+
limitations: 'Technical, compliance, and legal limitations for data use.',
|
|
1372
|
+
usage: 'Recommended usage of the data.',
|
|
1373
|
+
more_info: [contractTermsMoreInfoModel],
|
|
1374
|
+
custom_properties: 'Custom properties that are not part of the standard.',
|
|
1375
|
+
};
|
|
1376
|
+
|
|
1377
|
+
// ContractTemplateOrganization
|
|
1378
|
+
const contractTemplateOrganizationModel = {
|
|
1379
|
+
user_id: 'IBMid-691000IN4G',
|
|
1380
|
+
role: 'owner',
|
|
1381
|
+
};
|
|
1382
|
+
|
|
1383
|
+
// Roles
|
|
1384
|
+
const rolesModel = {
|
|
1385
|
+
role: 'IAM Role',
|
|
1386
|
+
};
|
|
1387
|
+
|
|
1388
|
+
// Pricing
|
|
1389
|
+
const pricingModel = {
|
|
1390
|
+
amount: '100.00',
|
|
1391
|
+
currency: 'USD',
|
|
1392
|
+
unit: 'megabyte',
|
|
1393
|
+
};
|
|
1394
|
+
|
|
1395
|
+
// ContractTemplateSLAProperty
|
|
1396
|
+
const contractTemplateSlaPropertyModel = {
|
|
1397
|
+
property: 'slaproperty',
|
|
1398
|
+
value: 'slavalue',
|
|
1399
|
+
};
|
|
1400
|
+
|
|
1401
|
+
// ContractTemplateSLA
|
|
1402
|
+
const contractTemplateSlaModel = {
|
|
1403
|
+
default_element: 'sladefaultelement',
|
|
1404
|
+
properties: [contractTemplateSlaPropertyModel],
|
|
1405
|
+
};
|
|
1406
|
+
|
|
1407
|
+
// ContractTemplateSupportAndCommunication
|
|
1408
|
+
const contractTemplateSupportAndCommunicationModel = {
|
|
1409
|
+
channel: 'channel',
|
|
1410
|
+
url: 'https://www.example.coms',
|
|
1411
|
+
};
|
|
1412
|
+
|
|
1413
|
+
// ContractTemplateCustomProperty
|
|
1414
|
+
const contractTemplateCustomPropertyModel = {
|
|
1415
|
+
key: 'propertykey',
|
|
1416
|
+
value: 'propertyvalue',
|
|
1417
|
+
};
|
|
1418
|
+
|
|
1419
|
+
// ContractTerms
|
|
1420
|
+
const contractTermsModel = {
|
|
1421
|
+
overview: overviewModel,
|
|
1422
|
+
description: descriptionModel,
|
|
1423
|
+
organization: [contractTemplateOrganizationModel],
|
|
1424
|
+
roles: [rolesModel],
|
|
1425
|
+
price: pricingModel,
|
|
1426
|
+
sla: [contractTemplateSlaModel],
|
|
1427
|
+
support_and_communication: [contractTemplateSupportAndCommunicationModel],
|
|
1428
|
+
custom_properties: [contractTemplateCustomPropertyModel],
|
|
1429
|
+
};
|
|
1430
|
+
|
|
1431
|
+
const params = {
|
|
1432
|
+
container: containerReferenceModel,
|
|
1433
|
+
name: 'Sample Data Contract Template',
|
|
1434
|
+
contractTerms: contractTermsModel,
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1437
|
+
let res;
|
|
1438
|
+
try {
|
|
1439
|
+
res = await dphService.createContractTemplate(params);
|
|
1440
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1441
|
+
} catch (err) {
|
|
1442
|
+
console.warn(err);
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
// end-create_contract_template
|
|
1446
|
+
});
|
|
1447
|
+
|
|
1448
|
+
test('getContractTemplate request example', async () => {
|
|
1449
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1450
|
+
originalLog(output);
|
|
1451
|
+
});
|
|
1452
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1453
|
+
// if an error occurs, display the message and then fail the test
|
|
1454
|
+
originalWarn(output);
|
|
1455
|
+
expect(true).toBeFalsy();
|
|
1456
|
+
});
|
|
1457
|
+
|
|
1458
|
+
originalLog('getContractTemplate() result:');
|
|
1459
|
+
// begin-get_contract_template
|
|
1460
|
+
|
|
1461
|
+
const params = {
|
|
1462
|
+
contractTemplateId: 'testString',
|
|
1463
|
+
containerId: 'testString',
|
|
1464
|
+
};
|
|
1465
|
+
|
|
1466
|
+
let res;
|
|
1467
|
+
try {
|
|
1468
|
+
res = await dphService.getContractTemplate(params);
|
|
1469
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1470
|
+
} catch (err) {
|
|
1471
|
+
console.warn(err);
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
// end-get_contract_template
|
|
1475
|
+
});
|
|
1476
|
+
|
|
1477
|
+
test('updateDataProductContractTemplate request example', async () => {
|
|
1478
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1479
|
+
originalLog(output);
|
|
1480
|
+
});
|
|
1481
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1482
|
+
// if an error occurs, display the message and then fail the test
|
|
1483
|
+
originalWarn(output);
|
|
1484
|
+
expect(true).toBeFalsy();
|
|
1485
|
+
});
|
|
1486
|
+
|
|
1487
|
+
originalLog('updateDataProductContractTemplate() result:');
|
|
1488
|
+
// begin-update_data_product_contract_template
|
|
1489
|
+
|
|
1490
|
+
// Request models needed by this operation.
|
|
1491
|
+
|
|
1492
|
+
// JsonPatchOperation
|
|
1493
|
+
const jsonPatchOperationModel = {
|
|
1494
|
+
op: 'add',
|
|
1495
|
+
path: 'testString',
|
|
1496
|
+
};
|
|
1497
|
+
|
|
1498
|
+
const params = {
|
|
1499
|
+
contractTemplateId: 'testString',
|
|
1500
|
+
containerId: 'testString',
|
|
1501
|
+
jsonPatchInstructions: [jsonPatchOperationModel],
|
|
1502
|
+
};
|
|
1503
|
+
|
|
1504
|
+
let res;
|
|
1505
|
+
try {
|
|
1506
|
+
res = await dphService.updateDataProductContractTemplate(params);
|
|
1507
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1508
|
+
} catch (err) {
|
|
1509
|
+
console.warn(err);
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
// end-update_data_product_contract_template
|
|
1513
|
+
});
|
|
1514
|
+
|
|
1515
|
+
test('listDataProductDomains request example', async () => {
|
|
1516
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1517
|
+
originalLog(output);
|
|
1518
|
+
});
|
|
1519
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1520
|
+
// if an error occurs, display the message and then fail the test
|
|
1521
|
+
originalWarn(output);
|
|
1522
|
+
expect(true).toBeFalsy();
|
|
1523
|
+
});
|
|
1524
|
+
|
|
1525
|
+
originalLog('listDataProductDomains() result:');
|
|
1526
|
+
// begin-list_data_product_domains
|
|
1527
|
+
|
|
1528
|
+
let res;
|
|
1529
|
+
try {
|
|
1530
|
+
res = await dphService.listDataProductDomains({});
|
|
1531
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1532
|
+
} catch (err) {
|
|
1533
|
+
console.warn(err);
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
// end-list_data_product_domains
|
|
1537
|
+
});
|
|
1538
|
+
|
|
1539
|
+
test('createDataProductDomain request example', async () => {
|
|
1540
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1541
|
+
originalLog(output);
|
|
1542
|
+
});
|
|
1543
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1544
|
+
// if an error occurs, display the message and then fail the test
|
|
1545
|
+
originalWarn(output);
|
|
1546
|
+
expect(true).toBeFalsy();
|
|
1547
|
+
});
|
|
1548
|
+
|
|
1549
|
+
originalLog('createDataProductDomain() result:');
|
|
1550
|
+
// begin-create_data_product_domain
|
|
1551
|
+
|
|
1552
|
+
// Request models needed by this operation.
|
|
1553
|
+
|
|
1554
|
+
// ContainerReference
|
|
1555
|
+
const containerReferenceModel = {
|
|
1556
|
+
id: 'ed580171-a6e4-4b93-973f-ae2f2f62991b',
|
|
1557
|
+
type: 'catalog',
|
|
1558
|
+
};
|
|
1559
|
+
|
|
1560
|
+
// InitializeSubDomain
|
|
1561
|
+
const initializeSubDomainModel = {
|
|
1562
|
+
name: 'Sub domain 1',
|
|
1563
|
+
description: 'New sub domain 1',
|
|
1564
|
+
};
|
|
1565
|
+
|
|
1566
|
+
const params = {
|
|
1567
|
+
container: containerReferenceModel,
|
|
1568
|
+
name: 'Test domain',
|
|
1569
|
+
description: 'The sample description for new domain',
|
|
1570
|
+
subDomains: [initializeSubDomainModel],
|
|
1571
|
+
};
|
|
1572
|
+
|
|
1573
|
+
let res;
|
|
1574
|
+
try {
|
|
1575
|
+
res = await dphService.createDataProductDomain(params);
|
|
1576
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1577
|
+
} catch (err) {
|
|
1578
|
+
console.warn(err);
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
// end-create_data_product_domain
|
|
1582
|
+
});
|
|
1583
|
+
|
|
1584
|
+
test('createDataProductSubdomain request example', async () => {
|
|
1585
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1586
|
+
originalLog(output);
|
|
1587
|
+
});
|
|
1588
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1589
|
+
// if an error occurs, display the message and then fail the test
|
|
1590
|
+
originalWarn(output);
|
|
1591
|
+
expect(true).toBeFalsy();
|
|
1592
|
+
});
|
|
1593
|
+
|
|
1594
|
+
originalLog('createDataProductSubdomain() result:');
|
|
1595
|
+
// begin-create_data_product_subdomain
|
|
1596
|
+
|
|
1597
|
+
const params = {
|
|
1598
|
+
domainId: 'testString',
|
|
1599
|
+
containerId: 'testString',
|
|
1600
|
+
name: 'Sub domain 1',
|
|
1601
|
+
description: 'New sub domain 1',
|
|
1602
|
+
};
|
|
1603
|
+
|
|
1604
|
+
let res;
|
|
1605
|
+
try {
|
|
1606
|
+
res = await dphService.createDataProductSubdomain(params);
|
|
1607
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1608
|
+
} catch (err) {
|
|
1609
|
+
console.warn(err);
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
// end-create_data_product_subdomain
|
|
1613
|
+
});
|
|
1614
|
+
|
|
1615
|
+
test('getDomain request example', async () => {
|
|
1616
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1617
|
+
originalLog(output);
|
|
1618
|
+
});
|
|
1619
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1620
|
+
// if an error occurs, display the message and then fail the test
|
|
1621
|
+
originalWarn(output);
|
|
1622
|
+
expect(true).toBeFalsy();
|
|
1623
|
+
});
|
|
1624
|
+
|
|
1625
|
+
originalLog('getDomain() result:');
|
|
1626
|
+
// begin-get_domain
|
|
1627
|
+
|
|
1628
|
+
const params = {
|
|
1629
|
+
domainId: 'testString',
|
|
1630
|
+
};
|
|
1631
|
+
|
|
1632
|
+
let res;
|
|
1633
|
+
try {
|
|
1634
|
+
res = await dphService.getDomain(params);
|
|
1635
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1636
|
+
} catch (err) {
|
|
1637
|
+
console.warn(err);
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
// end-get_domain
|
|
1641
|
+
});
|
|
1642
|
+
|
|
1643
|
+
test('updateDataProductDomain request example', async () => {
|
|
1644
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1645
|
+
originalLog(output);
|
|
1646
|
+
});
|
|
1647
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1648
|
+
// if an error occurs, display the message and then fail the test
|
|
1649
|
+
originalWarn(output);
|
|
1650
|
+
expect(true).toBeFalsy();
|
|
1651
|
+
});
|
|
1652
|
+
|
|
1653
|
+
originalLog('updateDataProductDomain() result:');
|
|
1654
|
+
// begin-update_data_product_domain
|
|
1655
|
+
|
|
1656
|
+
// Request models needed by this operation.
|
|
1657
|
+
|
|
1658
|
+
// JsonPatchOperation
|
|
1659
|
+
const jsonPatchOperationModel = {
|
|
1660
|
+
op: 'add',
|
|
1661
|
+
path: 'testString',
|
|
1662
|
+
};
|
|
1663
|
+
|
|
1664
|
+
const params = {
|
|
1665
|
+
domainId: 'testString',
|
|
1666
|
+
containerId: 'testString',
|
|
1667
|
+
jsonPatchInstructions: [jsonPatchOperationModel],
|
|
1668
|
+
};
|
|
1669
|
+
|
|
1670
|
+
let res;
|
|
1671
|
+
try {
|
|
1672
|
+
res = await dphService.updateDataProductDomain(params);
|
|
1673
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1674
|
+
} catch (err) {
|
|
1675
|
+
console.warn(err);
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
// end-update_data_product_domain
|
|
1679
|
+
});
|
|
1680
|
+
|
|
1681
|
+
test('getDataProductByDomain request example', async () => {
|
|
1682
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1683
|
+
originalLog(output);
|
|
1684
|
+
});
|
|
1685
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1686
|
+
// if an error occurs, display the message and then fail the test
|
|
1687
|
+
originalWarn(output);
|
|
1688
|
+
expect(true).toBeFalsy();
|
|
1689
|
+
});
|
|
1690
|
+
|
|
1691
|
+
originalLog('getDataProductByDomain() result:');
|
|
1692
|
+
// begin-get_data_product_by_domain
|
|
1693
|
+
|
|
1694
|
+
const params = {
|
|
1695
|
+
domainId: 'testString',
|
|
1696
|
+
containerId: 'testString',
|
|
1697
|
+
};
|
|
1698
|
+
|
|
1699
|
+
let res;
|
|
1700
|
+
try {
|
|
1701
|
+
res = await dphService.getDataProductByDomain(params);
|
|
1702
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1703
|
+
} catch (err) {
|
|
1704
|
+
console.warn(err);
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
// end-get_data_product_by_domain
|
|
1708
|
+
});
|
|
1709
|
+
|
|
1710
|
+
test('createS3Bucket request example', async () => {
|
|
1711
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1712
|
+
originalLog(output);
|
|
1713
|
+
});
|
|
1714
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1715
|
+
// if an error occurs, display the message and then fail the test
|
|
1716
|
+
originalWarn(output);
|
|
1717
|
+
expect(true).toBeFalsy();
|
|
1718
|
+
});
|
|
1719
|
+
|
|
1720
|
+
originalLog('createS3Bucket() result:');
|
|
1721
|
+
// begin-create_s3_bucket
|
|
1722
|
+
|
|
1723
|
+
const params = {
|
|
1724
|
+
isShared: true,
|
|
1725
|
+
};
|
|
1726
|
+
|
|
1727
|
+
let res;
|
|
1728
|
+
try {
|
|
1729
|
+
res = await dphService.createS3Bucket(params);
|
|
1730
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1731
|
+
} catch (err) {
|
|
1732
|
+
console.warn(err);
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
// end-create_s3_bucket
|
|
1736
|
+
});
|
|
1737
|
+
|
|
1738
|
+
test('getS3BucketValidation request example', async () => {
|
|
1739
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1740
|
+
originalLog(output);
|
|
1741
|
+
});
|
|
1742
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1743
|
+
// if an error occurs, display the message and then fail the test
|
|
1744
|
+
originalWarn(output);
|
|
1745
|
+
expect(true).toBeFalsy();
|
|
1746
|
+
});
|
|
1747
|
+
|
|
1748
|
+
originalLog('getS3BucketValidation() result:');
|
|
1749
|
+
// begin-get_s3_bucket_validation
|
|
1750
|
+
|
|
1751
|
+
const params = {
|
|
1752
|
+
bucketName: 'testString',
|
|
1753
|
+
};
|
|
1754
|
+
|
|
1755
|
+
let res;
|
|
1756
|
+
try {
|
|
1757
|
+
res = await dphService.getS3BucketValidation(params);
|
|
1758
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1759
|
+
} catch (err) {
|
|
1760
|
+
console.warn(err);
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
// end-get_s3_bucket_validation
|
|
1764
|
+
});
|
|
1765
|
+
|
|
1766
|
+
test('getRevokeAccessProcessState request example', async () => {
|
|
1767
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1768
|
+
originalLog(output);
|
|
1769
|
+
});
|
|
1770
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1771
|
+
// if an error occurs, display the message and then fail the test
|
|
1772
|
+
originalWarn(output);
|
|
1773
|
+
expect(true).toBeFalsy();
|
|
1774
|
+
});
|
|
1775
|
+
|
|
1776
|
+
originalLog('getRevokeAccessProcessState() result:');
|
|
1777
|
+
// begin-get_revoke_access_process_state
|
|
1778
|
+
|
|
1779
|
+
const params = {
|
|
1780
|
+
releaseId: 'testString',
|
|
1781
|
+
};
|
|
1782
|
+
|
|
1783
|
+
let res;
|
|
1784
|
+
try {
|
|
1785
|
+
res = await dphService.getRevokeAccessProcessState(params);
|
|
1786
|
+
console.log(JSON.stringify(res.result, null, 2));
|
|
1787
|
+
} catch (err) {
|
|
1788
|
+
console.warn(err);
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
// end-get_revoke_access_process_state
|
|
1792
|
+
});
|
|
1793
|
+
|
|
1794
|
+
test('deleteDraftContractTermsDocument request example', async () => {
|
|
1795
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1796
|
+
originalLog(output);
|
|
1797
|
+
});
|
|
1798
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1799
|
+
// if an error occurs, display the message and then fail the test
|
|
1800
|
+
originalWarn(output);
|
|
1801
|
+
expect(true).toBeFalsy();
|
|
1802
|
+
});
|
|
1803
|
+
|
|
1804
|
+
// begin-delete_draft_contract_terms_document
|
|
1805
|
+
|
|
1806
|
+
const params = {
|
|
1807
|
+
dataProductId: deleteContractDocumentByDataProductIdLink,
|
|
1808
|
+
draftId: deleteAContractDocumentByDraftIdLink,
|
|
1809
|
+
contractTermsId: deleteADraftByContractTermsIdLink,
|
|
1810
|
+
documentId: deleteContractTermsDocumentByDocumentIdLink,
|
|
1811
|
+
};
|
|
1812
|
+
|
|
1813
|
+
try {
|
|
1814
|
+
await dphService.deleteDraftContractTermsDocument(params);
|
|
1815
|
+
} catch (err) {
|
|
1816
|
+
console.warn(err);
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
// end-delete_draft_contract_terms_document
|
|
1820
|
+
});
|
|
1821
|
+
|
|
1822
|
+
test('deleteDataProductDraft request example', async () => {
|
|
1823
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1824
|
+
originalLog(output);
|
|
1825
|
+
});
|
|
1826
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1827
|
+
// if an error occurs, display the message and then fail the test
|
|
1828
|
+
originalWarn(output);
|
|
1829
|
+
expect(true).toBeFalsy();
|
|
1830
|
+
});
|
|
1831
|
+
|
|
1832
|
+
// begin-delete_data_product_draft
|
|
1833
|
+
|
|
1834
|
+
const params = {
|
|
1835
|
+
dataProductId: deleteDraftOfDataProductByDataProductIdLink,
|
|
1836
|
+
draftId: deleteADraftByDraftIdLink,
|
|
1837
|
+
};
|
|
1838
|
+
|
|
1839
|
+
try {
|
|
1840
|
+
await dphService.deleteDataProductDraft(params);
|
|
1841
|
+
} catch (err) {
|
|
1842
|
+
console.warn(err);
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
// end-delete_data_product_draft
|
|
1846
|
+
});
|
|
1847
|
+
|
|
1848
|
+
test('deleteDataProductContractTemplate request example', async () => {
|
|
1849
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1850
|
+
originalLog(output);
|
|
1851
|
+
});
|
|
1852
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1853
|
+
// if an error occurs, display the message and then fail the test
|
|
1854
|
+
originalWarn(output);
|
|
1855
|
+
expect(true).toBeFalsy();
|
|
1856
|
+
});
|
|
1857
|
+
|
|
1858
|
+
// begin-delete_data_product_contract_template
|
|
1859
|
+
|
|
1860
|
+
const params = {
|
|
1861
|
+
contractTemplateId: 'testString',
|
|
1862
|
+
containerId: 'testString',
|
|
1863
|
+
};
|
|
1864
|
+
|
|
1865
|
+
try {
|
|
1866
|
+
await dphService.deleteDataProductContractTemplate(params);
|
|
1867
|
+
} catch (err) {
|
|
1868
|
+
console.warn(err);
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
// end-delete_data_product_contract_template
|
|
1872
|
+
});
|
|
1873
|
+
|
|
1874
|
+
test('deleteDomain request example', async () => {
|
|
1875
|
+
consoleLogMock.mockImplementation((output) => {
|
|
1876
|
+
originalLog(output);
|
|
1877
|
+
});
|
|
1878
|
+
consoleWarnMock.mockImplementation((output) => {
|
|
1879
|
+
// if an error occurs, display the message and then fail the test
|
|
1880
|
+
originalWarn(output);
|
|
1881
|
+
expect(true).toBeFalsy();
|
|
1882
|
+
});
|
|
1883
|
+
|
|
1884
|
+
// begin-delete_domain
|
|
1885
|
+
|
|
1886
|
+
const params = {
|
|
1887
|
+
domainId: 'testString',
|
|
1888
|
+
};
|
|
1889
|
+
|
|
1890
|
+
try {
|
|
1891
|
+
await dphService.deleteDomain(params);
|
|
1892
|
+
} catch (err) {
|
|
1893
|
+
console.warn(err);
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
// end-delete_domain
|
|
1897
|
+
});
|
|
1898
|
+
});
|