@itentialopensource/adapter-infoblox 1.12.0 → 1.12.1
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 +8 -0
- package/adapter.js +167 -3
- package/entities/FileOps/action.json +48 -0
- package/entities/FileOps/requestSchema.json +31 -0
- package/entities/FileOps/schema.json +20 -0
- package/entities/Records/action.json +1 -1
- package/package.json +1 -1
- package/pronghorn.json +78 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +7 -7
- package/test/integration/adapterTestIntegration.js +55 -0
- package/test/unit/adapterTestUnit.js +75 -0
package/CHANGELOG.md
CHANGED
package/adapter.js
CHANGED
|
@@ -4930,8 +4930,8 @@ class Infoblox extends AdapterBaseCl {
|
|
|
4930
4930
|
}
|
|
4931
4931
|
|
|
4932
4932
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
4933
|
-
const queryParamsAvailable = { hostName };
|
|
4934
|
-
const queryParams = {};
|
|
4933
|
+
const queryParamsAvailable = { name: hostName };
|
|
4934
|
+
const queryParams = { _return_fields: 'extattrs,ipv4addrs,name,view' };
|
|
4935
4935
|
const pathVars = [];
|
|
4936
4936
|
const bodyVars = {};
|
|
4937
4937
|
if (query) {
|
|
@@ -5014,7 +5014,7 @@ class Infoblox extends AdapterBaseCl {
|
|
|
5014
5014
|
|
|
5015
5015
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
5016
5016
|
const queryParamsAvailable = { name };
|
|
5017
|
-
const queryParams = {};
|
|
5017
|
+
const queryParams = { _return_fields: 'extattrs,ipv4addr,name,view' };
|
|
5018
5018
|
const pathVars = [];
|
|
5019
5019
|
const bodyVars = {};
|
|
5020
5020
|
if (query) {
|
|
@@ -10247,6 +10247,170 @@ class Infoblox extends AdapterBaseCl {
|
|
|
10247
10247
|
}
|
|
10248
10248
|
}
|
|
10249
10249
|
|
|
10250
|
+
/**
|
|
10251
|
+
* @summary Update a plain text file
|
|
10252
|
+
*
|
|
10253
|
+
* @function uploadFile
|
|
10254
|
+
* @param {string} urlFromUploadInitiation - The URI path of the file to upload. E.g. https://1.1.1.1/http_direct_file_io/req_id-UPLOAD-123/import_records
|
|
10255
|
+
* @param {string} filedata - The plain text file data to upload. Usually the CSV text.
|
|
10256
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
10257
|
+
*/
|
|
10258
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
10259
|
+
uploadFile(urlFromUploadInitiation, filedata, callback) {
|
|
10260
|
+
const meth = 'adapter-uploadFile';
|
|
10261
|
+
const origin = `${this.id}-${meth}`;
|
|
10262
|
+
log.trace(origin);
|
|
10263
|
+
|
|
10264
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
10265
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
10266
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
10267
|
+
return callback(null, errorObj);
|
|
10268
|
+
}
|
|
10269
|
+
|
|
10270
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
10271
|
+
if (!urlFromUploadInitiation) {
|
|
10272
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['urlFromUploadInitiation'], null, null, null);
|
|
10273
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
10274
|
+
return callback(null, errorObj);
|
|
10275
|
+
}
|
|
10276
|
+
|
|
10277
|
+
if (!filedata) {
|
|
10278
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['filedata'], null, null, null);
|
|
10279
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
10280
|
+
return callback(null, errorObj);
|
|
10281
|
+
}
|
|
10282
|
+
|
|
10283
|
+
// Grabs the URL Id from the urlFromUploadInitiation variable
|
|
10284
|
+
// The URL Id can then be templated into the URL path in the action.json file using a pathVar
|
|
10285
|
+
// Example urlFromUploadInitiation -- https://1.1.1.1/http_direct_file_io/req_id-UPLOAD-1111111111111111/import_records
|
|
10286
|
+
let uploadId;
|
|
10287
|
+
try {
|
|
10288
|
+
[uploadId] = urlFromUploadInitiation.match(/req_id-UPLOAD-[0-9]{16}/);
|
|
10289
|
+
} catch (ex) {
|
|
10290
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Unable to parse urlFromUploadInitiation', ['urlFromUploadInitiation'], null, null, null);
|
|
10291
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
10292
|
+
return callback(null, errorObj);
|
|
10293
|
+
}
|
|
10294
|
+
|
|
10295
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
10296
|
+
const queryParams = {};
|
|
10297
|
+
const pathVars = [uploadId];
|
|
10298
|
+
const bodyVars = { filedata };
|
|
10299
|
+
|
|
10300
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
10301
|
+
const reqObj = {
|
|
10302
|
+
payload: bodyVars,
|
|
10303
|
+
uriPathVars: pathVars,
|
|
10304
|
+
uriQuery: queryParams
|
|
10305
|
+
};
|
|
10306
|
+
|
|
10307
|
+
try {
|
|
10308
|
+
// Make the call -
|
|
10309
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
10310
|
+
return this.requestHandlerInst.identifyRequest('FileOps', 'uploadFile', reqObj, true, (irReturnData, irReturnError) => {
|
|
10311
|
+
// if we received an error or their is no response on the results
|
|
10312
|
+
// return an error
|
|
10313
|
+
if (irReturnError) {
|
|
10314
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
10315
|
+
return callback(null, irReturnError);
|
|
10316
|
+
}
|
|
10317
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
10318
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['uploadFile'], null, null, null);
|
|
10319
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
10320
|
+
return callback(null, errorObj);
|
|
10321
|
+
}
|
|
10322
|
+
|
|
10323
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
10324
|
+
// return the response
|
|
10325
|
+
return callback(irReturnData, null);
|
|
10326
|
+
});
|
|
10327
|
+
} catch (ex) {
|
|
10328
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
10329
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
10330
|
+
return callback(null, errorObj);
|
|
10331
|
+
}
|
|
10332
|
+
}
|
|
10333
|
+
|
|
10334
|
+
/**
|
|
10335
|
+
* @summary Update a plain text file
|
|
10336
|
+
*
|
|
10337
|
+
* @function downloadFile
|
|
10338
|
+
* @param {string} urlFromDownloadInitiation - The URI path of the file to upload. E.g. https://1.1.1.1/http_direct_file_io/req_id-DOWNLOAD-111/csv-error.1.csv
|
|
10339
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
10340
|
+
*/
|
|
10341
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
10342
|
+
downloadFile(urlFromDownloadInitiation, callback) {
|
|
10343
|
+
const meth = 'adapter-downloadFile';
|
|
10344
|
+
const origin = `${this.id}-${meth}`;
|
|
10345
|
+
log.trace(origin);
|
|
10346
|
+
|
|
10347
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
10348
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
10349
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
10350
|
+
return callback(null, errorObj);
|
|
10351
|
+
}
|
|
10352
|
+
|
|
10353
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
10354
|
+
if (!urlFromDownloadInitiation) {
|
|
10355
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['urlFromDownloadInitiation'], null, null, null);
|
|
10356
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
10357
|
+
return callback(null, errorObj);
|
|
10358
|
+
}
|
|
10359
|
+
|
|
10360
|
+
// Grabs the URL Id from the urlFromDownloadInitiation variable
|
|
10361
|
+
// The URL Id can then be templated into the URL path in the action.json file using a pathVar
|
|
10362
|
+
// Example urlFromDownloadInitiation -- https://1.1.1.1/http_direct_file_io/req_id-UPLOAD-1111111111111111/import_records
|
|
10363
|
+
let downloadId;
|
|
10364
|
+
let fileName;
|
|
10365
|
+
try {
|
|
10366
|
+
[downloadId] = urlFromDownloadInitiation.match(/req_id-DOWNLOAD-\d+/);
|
|
10367
|
+
[fileName] = urlFromDownloadInitiation.match(/csv-error\.\d+\.csv/);
|
|
10368
|
+
} catch (ex) {
|
|
10369
|
+
log.info(ex);
|
|
10370
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Unable to parse urlFromDownloadInitiation', ['urlFromDownloadInitiation'], null, null, null);
|
|
10371
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
10372
|
+
return callback(null, errorObj);
|
|
10373
|
+
}
|
|
10374
|
+
|
|
10375
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
10376
|
+
const queryParams = {};
|
|
10377
|
+
const pathVars = [downloadId, fileName];
|
|
10378
|
+
const bodyVars = {};
|
|
10379
|
+
|
|
10380
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
10381
|
+
const reqObj = {
|
|
10382
|
+
payload: bodyVars,
|
|
10383
|
+
uriPathVars: pathVars,
|
|
10384
|
+
uriQuery: queryParams
|
|
10385
|
+
};
|
|
10386
|
+
|
|
10387
|
+
try {
|
|
10388
|
+
// Make the call -
|
|
10389
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
10390
|
+
return this.requestHandlerInst.identifyRequest('FileOps', 'downloadFile', reqObj, true, (irReturnData, irReturnError) => {
|
|
10391
|
+
// if we received an error or their is no response on the results
|
|
10392
|
+
// return an error
|
|
10393
|
+
if (irReturnError) {
|
|
10394
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
10395
|
+
return callback(null, irReturnError);
|
|
10396
|
+
}
|
|
10397
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
10398
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['downloadFile'], null, null, null);
|
|
10399
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
10400
|
+
return callback(null, errorObj);
|
|
10401
|
+
}
|
|
10402
|
+
|
|
10403
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
10404
|
+
// return the response
|
|
10405
|
+
return callback(irReturnData, null);
|
|
10406
|
+
});
|
|
10407
|
+
} catch (ex) {
|
|
10408
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
10409
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
10410
|
+
return callback(null, errorObj);
|
|
10411
|
+
}
|
|
10412
|
+
}
|
|
10413
|
+
|
|
10250
10414
|
/**
|
|
10251
10415
|
* @summary Delete Extensible Attribute definition
|
|
10252
10416
|
*
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"actions": [
|
|
3
|
+
{
|
|
4
|
+
"name": "uploadFile",
|
|
5
|
+
"protocol": "REST",
|
|
6
|
+
"method": "POST",
|
|
7
|
+
"entitypath": "/http_direct_file_io/{pathv1}/import_records",
|
|
8
|
+
"requestSchema": "requestSchema.json",
|
|
9
|
+
"responseSchema": "schema.json",
|
|
10
|
+
"timeout": 0,
|
|
11
|
+
"sendEmpty": false,
|
|
12
|
+
"sendGetBody": false,
|
|
13
|
+
"requestDatatype": "FORM",
|
|
14
|
+
"responseDatatype": "PLAIN",
|
|
15
|
+
"headers": {},
|
|
16
|
+
"responseObjects": [
|
|
17
|
+
{
|
|
18
|
+
"type": "default",
|
|
19
|
+
"key": "",
|
|
20
|
+
"mockFile": ""
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "downloadFile",
|
|
26
|
+
"protocol": "REST",
|
|
27
|
+
"method": "GET",
|
|
28
|
+
"entitypath": "/http_direct_file_io/{pathv1}/{pathv2}",
|
|
29
|
+
"requestSchema": "schema.json",
|
|
30
|
+
"responseSchema": "schema.json",
|
|
31
|
+
"timeout": 0,
|
|
32
|
+
"sendEmpty": false,
|
|
33
|
+
"sendGetBody": false,
|
|
34
|
+
"requestDatatype": "",
|
|
35
|
+
"responseDatatype": "PLAIN",
|
|
36
|
+
"headers": {
|
|
37
|
+
"Content-Type": "application/force-download"
|
|
38
|
+
},
|
|
39
|
+
"responseObjects": [
|
|
40
|
+
{
|
|
41
|
+
"type": "default",
|
|
42
|
+
"key": "",
|
|
43
|
+
"mockFile": ""
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "fileOps",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5
|
+
"translate": true,
|
|
6
|
+
"dynamicfields": true,
|
|
7
|
+
"properties": {
|
|
8
|
+
"ph_request_type": {
|
|
9
|
+
"$id": "/properties/ph_request_type",
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "type of request (internal to adapter)",
|
|
12
|
+
"default": "uploadFile",
|
|
13
|
+
"enum": [
|
|
14
|
+
"uploadFile"
|
|
15
|
+
],
|
|
16
|
+
"external_name": "ph_request_type"
|
|
17
|
+
},
|
|
18
|
+
"filedata": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "",
|
|
21
|
+
"parse": false,
|
|
22
|
+
"encode": false,
|
|
23
|
+
"encrypt": {
|
|
24
|
+
"type": "AES",
|
|
25
|
+
"key": ""
|
|
26
|
+
},
|
|
27
|
+
"external_name": "filedata"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"definitions": {}
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "schema.json",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"schema": "http://json-schema.org/draft-07/schema#",
|
|
5
|
+
"translate": false,
|
|
6
|
+
"dynamicfields": true,
|
|
7
|
+
"properties": {
|
|
8
|
+
"ph_request_type": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "type of request (internal to adapter)",
|
|
11
|
+
"default": "uploadFile",
|
|
12
|
+
"enum": [
|
|
13
|
+
"uploadFile",
|
|
14
|
+
"downloadFile"
|
|
15
|
+
],
|
|
16
|
+
"external_name": "ph_request_type"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"definitions": {}
|
|
20
|
+
}
|
package/package.json
CHANGED
package/pronghorn.json
CHANGED
|
@@ -6657,6 +6657,84 @@
|
|
|
6657
6657
|
},
|
|
6658
6658
|
"task": true
|
|
6659
6659
|
},
|
|
6660
|
+
{
|
|
6661
|
+
"name": "uploadFile",
|
|
6662
|
+
"summary": "Uploads a file to infoblox",
|
|
6663
|
+
"description": "Uploads a file to infoblox given a url destination",
|
|
6664
|
+
"input": [
|
|
6665
|
+
{
|
|
6666
|
+
"name": "urlFromUploadInitiation",
|
|
6667
|
+
"type": "string",
|
|
6668
|
+
"info": "The URI path of the file to upload. E.g. https://1.1.1.1/http_direct_file_io/req_id-UPLOAD-123/import_records",
|
|
6669
|
+
"required": true,
|
|
6670
|
+
"schema": {
|
|
6671
|
+
"title": "urlFromUploadInitiation",
|
|
6672
|
+
"type": "string"
|
|
6673
|
+
}
|
|
6674
|
+
},
|
|
6675
|
+
{
|
|
6676
|
+
"name": "filedata",
|
|
6677
|
+
"type": "string",
|
|
6678
|
+
"info": "The plain text file data to upload. Usually the CSV text.",
|
|
6679
|
+
"required": true,
|
|
6680
|
+
"schema": {
|
|
6681
|
+
"title": "filedata",
|
|
6682
|
+
"type": "string"
|
|
6683
|
+
}
|
|
6684
|
+
}
|
|
6685
|
+
],
|
|
6686
|
+
"output": {
|
|
6687
|
+
"name": "result",
|
|
6688
|
+
"type": "object",
|
|
6689
|
+
"description": "A JSON Object containing status, code and the result",
|
|
6690
|
+
"schema": {
|
|
6691
|
+
"title": "result",
|
|
6692
|
+
"type": "object"
|
|
6693
|
+
}
|
|
6694
|
+
},
|
|
6695
|
+
"roles": [
|
|
6696
|
+
"admin"
|
|
6697
|
+
],
|
|
6698
|
+
"route": {
|
|
6699
|
+
"verb": "POST",
|
|
6700
|
+
"path": "/uploadFile"
|
|
6701
|
+
},
|
|
6702
|
+
"task": true
|
|
6703
|
+
},
|
|
6704
|
+
{
|
|
6705
|
+
"name": "downloadFile",
|
|
6706
|
+
"summary": "Downloads a file from infoblox",
|
|
6707
|
+
"description": "Downloads a file from infoblox given a url destination",
|
|
6708
|
+
"input": [
|
|
6709
|
+
{
|
|
6710
|
+
"name": "urlFromDownloadInitiation",
|
|
6711
|
+
"type": "string",
|
|
6712
|
+
"info": "The URI path of the file to upload. E.g. https://1.1.1.1/http_direct_file_io/req_id-UPLOAD-123/import_records",
|
|
6713
|
+
"required": true,
|
|
6714
|
+
"schema": {
|
|
6715
|
+
"title": "urlFromDownloadInitiation",
|
|
6716
|
+
"type": "string"
|
|
6717
|
+
}
|
|
6718
|
+
}
|
|
6719
|
+
],
|
|
6720
|
+
"output": {
|
|
6721
|
+
"name": "result",
|
|
6722
|
+
"type": "object",
|
|
6723
|
+
"description": "The resulting file specified in the urlFromDownloadInitiation",
|
|
6724
|
+
"schema": {
|
|
6725
|
+
"title": "result",
|
|
6726
|
+
"type": "object"
|
|
6727
|
+
}
|
|
6728
|
+
},
|
|
6729
|
+
"roles": [
|
|
6730
|
+
"admin"
|
|
6731
|
+
],
|
|
6732
|
+
"route": {
|
|
6733
|
+
"verb": "POST",
|
|
6734
|
+
"path": "/uploadFile"
|
|
6735
|
+
},
|
|
6736
|
+
"task": true
|
|
6737
|
+
},
|
|
6660
6738
|
{
|
|
6661
6739
|
"name": "deleteExtensibleAttributeDefinition",
|
|
6662
6740
|
"summary": "Delete Extensible Attribute definition",
|
|
Binary file
|
package/report/adapterInfo.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
3
|
-
"configLines":
|
|
2
|
+
"version": "1.12.0",
|
|
3
|
+
"configLines": 22469,
|
|
4
4
|
"scriptLines": 1707,
|
|
5
|
-
"codeLines":
|
|
6
|
-
"testLines":
|
|
7
|
-
"testCases":
|
|
8
|
-
"totalCodeLines":
|
|
9
|
-
"wfTasks":
|
|
5
|
+
"codeLines": 30363,
|
|
6
|
+
"testLines": 22420,
|
|
7
|
+
"testCases": 1109,
|
|
8
|
+
"totalCodeLines": 54490,
|
|
9
|
+
"wfTasks": 398
|
|
10
10
|
}
|
|
@@ -3340,6 +3340,61 @@ describe('[integration] Infoblox Adapter Test', () => {
|
|
|
3340
3340
|
}).timeout(attemptTimeout);
|
|
3341
3341
|
});
|
|
3342
3342
|
|
|
3343
|
+
const urlFromUploadInitiation = 'https://1.1.1.1/http_direct_file_io/req_id-UPLOAD-1111111111111111/import_records';
|
|
3344
|
+
const fileData = 'filedata';
|
|
3345
|
+
|
|
3346
|
+
describe('#uploadFile - errors', () => {
|
|
3347
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
3348
|
+
try {
|
|
3349
|
+
a.uploadFile(urlFromUploadInitiation, fileData, (data, error) => {
|
|
3350
|
+
try {
|
|
3351
|
+
if (stub) {
|
|
3352
|
+
const displayE = 'Error 400 received on request';
|
|
3353
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-infoblox-connectorRest-handleEndResponse', displayE);
|
|
3354
|
+
} else {
|
|
3355
|
+
runCommonAsserts(data, error);
|
|
3356
|
+
}
|
|
3357
|
+
saveMockData('FileOps', 'uploadFile', 'default', data);
|
|
3358
|
+
done();
|
|
3359
|
+
} catch (err) {
|
|
3360
|
+
log.error(`Test Failure: ${err}`);
|
|
3361
|
+
done(err);
|
|
3362
|
+
}
|
|
3363
|
+
});
|
|
3364
|
+
} catch (error) {
|
|
3365
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3366
|
+
done(error);
|
|
3367
|
+
}
|
|
3368
|
+
}).timeout(attemptTimeout);
|
|
3369
|
+
});
|
|
3370
|
+
|
|
3371
|
+
const urlFromDownloadInitiation = 'https://1.1.1.1/http_direct_file_io/req_id-DOWNLOAD-111/csv-error.1.csv';
|
|
3372
|
+
|
|
3373
|
+
describe('#downloadFile - errors', () => {
|
|
3374
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
3375
|
+
try {
|
|
3376
|
+
a.downloadFile(urlFromDownloadInitiation, (data, error) => {
|
|
3377
|
+
try {
|
|
3378
|
+
if (stub) {
|
|
3379
|
+
const displayE = 'Error 400 received on request';
|
|
3380
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-infoblox-connectorRest-handleEndResponse', displayE);
|
|
3381
|
+
} else {
|
|
3382
|
+
runCommonAsserts(data, error);
|
|
3383
|
+
}
|
|
3384
|
+
saveMockData('FileOps', 'downloadFile', 'default', data);
|
|
3385
|
+
done();
|
|
3386
|
+
} catch (err) {
|
|
3387
|
+
log.error(`Test Failure: ${err}`);
|
|
3388
|
+
done(err);
|
|
3389
|
+
}
|
|
3390
|
+
});
|
|
3391
|
+
} catch (error) {
|
|
3392
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3393
|
+
done(error);
|
|
3394
|
+
}
|
|
3395
|
+
}).timeout(attemptTimeout);
|
|
3396
|
+
});
|
|
3397
|
+
|
|
3343
3398
|
const zonesZoneRef = 'fakedata';
|
|
3344
3399
|
|
|
3345
3400
|
describe('#deleteAuthZoneByRef - errors', () => {
|
|
@@ -4309,6 +4309,81 @@ describe('[unit] Infoblox Adapter Test', () => {
|
|
|
4309
4309
|
}).timeout(attemptTimeout);
|
|
4310
4310
|
});
|
|
4311
4311
|
|
|
4312
|
+
describe('#uploadFile - errors', () => {
|
|
4313
|
+
it('should have a uploadFile function', (done) => {
|
|
4314
|
+
try {
|
|
4315
|
+
assert.equal(true, typeof a.uploadFile === 'function');
|
|
4316
|
+
done();
|
|
4317
|
+
} catch (error) {
|
|
4318
|
+
log.error(`Test Failure: ${error}`);
|
|
4319
|
+
done(error);
|
|
4320
|
+
}
|
|
4321
|
+
}).timeout(attemptTimeout);
|
|
4322
|
+
it('should error if - missing urlFromUploadInitiation', (done) => {
|
|
4323
|
+
try {
|
|
4324
|
+
a.uploadFile(null, 'filedata', (data, error) => {
|
|
4325
|
+
try {
|
|
4326
|
+
const displayE = 'urlFromUploadInitiation is required';
|
|
4327
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-infoblox-adapter-uploadFile', displayE);
|
|
4328
|
+
done();
|
|
4329
|
+
} catch (err) {
|
|
4330
|
+
log.error(`Test Failure: ${err}`);
|
|
4331
|
+
done(err);
|
|
4332
|
+
}
|
|
4333
|
+
});
|
|
4334
|
+
} catch (error) {
|
|
4335
|
+
log.error(`Adapter Exception: ${error}`);
|
|
4336
|
+
done(error);
|
|
4337
|
+
}
|
|
4338
|
+
}).timeout(attemptTimeout);
|
|
4339
|
+
it('should error if - missing filedata', (done) => {
|
|
4340
|
+
try {
|
|
4341
|
+
a.uploadFile('https://1.1.1.1/http_direct_file_io/req_id-UPLOAD-1111111111111111/import_records', null, (data, error) => {
|
|
4342
|
+
try {
|
|
4343
|
+
const displayE = 'filedata is required';
|
|
4344
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-infoblox-adapter-uploadFile', displayE);
|
|
4345
|
+
done();
|
|
4346
|
+
} catch (err) {
|
|
4347
|
+
log.error(`Test Failure: ${err}`);
|
|
4348
|
+
done(err);
|
|
4349
|
+
}
|
|
4350
|
+
});
|
|
4351
|
+
} catch (error) {
|
|
4352
|
+
log.error(`Adapter Exception: ${error}`);
|
|
4353
|
+
done(error);
|
|
4354
|
+
}
|
|
4355
|
+
}).timeout(attemptTimeout);
|
|
4356
|
+
});
|
|
4357
|
+
|
|
4358
|
+
describe('#downloadFile - errors', () => {
|
|
4359
|
+
it('should have a downloadFile function', (done) => {
|
|
4360
|
+
try {
|
|
4361
|
+
assert.equal(true, typeof a.downloadFile === 'function');
|
|
4362
|
+
done();
|
|
4363
|
+
} catch (error) {
|
|
4364
|
+
log.error(`Test Failure: ${error}`);
|
|
4365
|
+
done(error);
|
|
4366
|
+
}
|
|
4367
|
+
}).timeout(attemptTimeout);
|
|
4368
|
+
it('should error if - missing urlFromDownloadInitiation', (done) => {
|
|
4369
|
+
try {
|
|
4370
|
+
a.downloadFile(null, (data, error) => {
|
|
4371
|
+
try {
|
|
4372
|
+
const displayE = 'urlFromDownloadInitiation is required';
|
|
4373
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-infoblox-adapter-downloadFile', displayE);
|
|
4374
|
+
done();
|
|
4375
|
+
} catch (err) {
|
|
4376
|
+
log.error(`Test Failure: ${err}`);
|
|
4377
|
+
done(err);
|
|
4378
|
+
}
|
|
4379
|
+
});
|
|
4380
|
+
} catch (error) {
|
|
4381
|
+
log.error(`Adapter Exception: ${error}`);
|
|
4382
|
+
done(error);
|
|
4383
|
+
}
|
|
4384
|
+
}).timeout(attemptTimeout);
|
|
4385
|
+
});
|
|
4386
|
+
|
|
4312
4387
|
describe('#deleteExtensibleAttributeDefinition - errors', () => {
|
|
4313
4388
|
it('should have a deleteExtensibleAttributeDefinition function', (done) => {
|
|
4314
4389
|
try {
|