@itentialopensource/adapter-meraki 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/AUTH.md +14 -18
  2. package/CALLS.md +4264 -0
  3. package/CHANGELOG.md +16 -0
  4. package/CONTRIBUTING.md +1 -160
  5. package/ENHANCE.md +2 -2
  6. package/README.md +23 -18
  7. package/SYSTEMINFO.md +15 -2
  8. package/adapter.js +164 -335
  9. package/adapterBase.js +411 -920
  10. package/changelogs/changelog.md +198 -0
  11. package/metadata.json +61 -0
  12. package/package.json +24 -24
  13. package/pronghorn.json +470 -138
  14. package/propertiesSchema.json +358 -31
  15. package/refs?service=git-upload-pack +0 -0
  16. package/report/adapterInfo.json +8 -8
  17. package/report/updateReport1690417926405.json +119 -0
  18. package/sampleProperties.json +74 -27
  19. package/test/integration/adapterTestBasicGet.js +2 -4
  20. package/test/integration/adapterTestConnectivity.js +91 -42
  21. package/test/integration/adapterTestIntegration.js +130 -2
  22. package/test/unit/adapterBaseTestUnit.js +388 -313
  23. package/test/unit/adapterTestUnit.js +332 -112
  24. package/utils/adapterInfo.js +1 -1
  25. package/utils/addAuth.js +1 -1
  26. package/utils/artifactize.js +1 -1
  27. package/utils/checkMigrate.js +1 -1
  28. package/utils/entitiesToDB.js +2 -2
  29. package/utils/findPath.js +1 -1
  30. package/utils/methodDocumentor.js +225 -0
  31. package/utils/modify.js +13 -15
  32. package/utils/packModificationScript.js +1 -1
  33. package/utils/pre-commit.sh +2 -0
  34. package/utils/taskMover.js +309 -0
  35. package/utils/tbScript.js +89 -34
  36. package/utils/tbUtils.js +41 -21
  37. package/utils/testRunner.js +1 -1
  38. package/utils/troubleshootingAdapter.js +9 -6
  39. package/versions.json +0 -542
  40. package/workflows/README.md +0 -3
@@ -18,6 +18,11 @@
18
18
  "minimum": 1,
19
19
  "maximum": 65535
20
20
  },
21
+ "choosepath": {
22
+ "type": "string",
23
+ "description": "choose the path to use -- requires entityPath choices",
24
+ "default": ""
25
+ },
21
26
  "base_path": {
22
27
  "type": "string",
23
28
  "description": "a base path that is consistent across api calls",
@@ -101,6 +106,9 @@
101
106
  },
102
107
  "devicebroker": {
103
108
  "$ref": "#/definitions/devicebroker"
109
+ },
110
+ "cache": {
111
+ "$ref": "#/definitions/cache"
104
112
  }
105
113
  },
106
114
  "required": [
@@ -122,7 +130,8 @@
122
130
  "static_token",
123
131
  "jwt_token",
124
132
  "request_token",
125
- "no_authentication"
133
+ "no_authentication",
134
+ "multi_step_authentication"
126
135
  ]
127
136
  },
128
137
  "username": {
@@ -255,6 +264,74 @@
255
264
  "type": "string",
256
265
  "description": "The grant type for OAuth requests - can also provide in schema",
257
266
  "default": ""
267
+ },
268
+ "sensitive": {
269
+ "type": "array",
270
+ "description": "List of sensitive keys to search and hide values from being logged",
271
+ "default": [],
272
+ "items": {
273
+ "type": "string"
274
+ }
275
+ },
276
+ "sso": {
277
+ "type": "object",
278
+ "properties": {
279
+ "protocol": {
280
+ "type": "string",
281
+ "description": "the protocol to request token from system",
282
+ "default": "",
283
+ "enum": [
284
+ "http",
285
+ "https",
286
+ ""
287
+ ]
288
+ },
289
+ "host": {
290
+ "type": "string",
291
+ "description": "hostname of the authentication system",
292
+ "default": "",
293
+ "examples": [
294
+ "systemx.customer.com"
295
+ ]
296
+ },
297
+ "port": {
298
+ "type": "integer",
299
+ "description": "port on which to connect to the authentication system",
300
+ "default": 0,
301
+ "minimum": 0,
302
+ "maximum": 65535
303
+ }
304
+ }
305
+ },
306
+ "multiStepAuthCalls": {
307
+ "type": "array",
308
+ "items": {
309
+ "type": "object",
310
+ "properties": {
311
+ "name": {
312
+ "type": "string",
313
+ "description": "Id of the step call",
314
+ "examples": [
315
+ "getAccessToken"
316
+ ]
317
+ },
318
+ "requestFields": {
319
+ "type": "object",
320
+ "description": "The fields set in step request"
321
+ },
322
+ "responseFields": {
323
+ "type": "object",
324
+ "description": "The fields from the step result"
325
+ },
326
+ "successfullResponseCode": {
327
+ "type": "integer",
328
+ "description": "Expected response code for given step, if not set any successfull http response is accepted",
329
+ "examples": [
330
+ 200
331
+ ]
332
+ }
333
+ }
334
+ }
258
335
  }
259
336
  },
260
337
  "required": [
@@ -357,7 +434,13 @@
357
434
  },
358
435
  "query_object": {
359
436
  "type": "object",
360
- "description": "Query object { device: xxxxx } to be placed into the healthcheck, will be converted to query string by the adapter"
437
+ "description": "Query object { device: xxxxx } to be placed into the healthcheck, will be converted to query string by the adapter",
438
+ "default": {}
439
+ },
440
+ "addlHeaders": {
441
+ "type": "object",
442
+ "description": "headers that will be appended to the headers for the call",
443
+ "default": {}
361
444
  }
362
445
  },
363
446
  "required": [
@@ -437,6 +520,7 @@
437
520
  "priorities": {
438
521
  "type": "array",
439
522
  "description": "define your priorities here",
523
+ "default": [],
440
524
  "items": {
441
525
  "type": "object",
442
526
  "properties": {
@@ -507,6 +591,7 @@
507
591
  "failover_codes": {
508
592
  "type": "array",
509
593
  "description": "An array of codes where it is ok to try another method",
594
+ "default": [],
510
595
  "items": {
511
596
  "type": "integer"
512
597
  }
@@ -524,19 +609,23 @@
524
609
  "properties": {
525
610
  "payload": {
526
611
  "type": "object",
527
- "description": "payload fields that will be appended to the provided payload (excluding GET calls)"
612
+ "description": "payload fields that will be appended to the provided payload (excluding GET calls)",
613
+ "default": {}
528
614
  },
529
615
  "uriOptions": {
530
616
  "type": "object",
531
- "description": "options that will be appended to all GET calls"
617
+ "description": "options that will be appended to all GET calls",
618
+ "default": {}
532
619
  },
533
620
  "addlHeaders": {
534
621
  "type": "object",
535
- "description": "headers that will be appended to the headers for the call"
622
+ "description": "headers that will be appended to the headers for the call",
623
+ "default": {}
536
624
  },
537
625
  "authData": {
538
626
  "type": "object",
539
- "description": "authentication data that will be appended to the payload for authentication calls"
627
+ "description": "authentication data that will be appended to the payload for authentication calls",
628
+ "default": {}
540
629
  }
541
630
  }
542
631
  },
@@ -851,6 +940,7 @@
851
940
  "type": "array",
852
941
  "description": "Broker call(s) to getDevice",
853
942
  "items": {
943
+ "type": "object",
854
944
  "properties": {
855
945
  "path": {
856
946
  "type": "string",
@@ -866,21 +956,30 @@
866
956
  "type": "object",
867
957
  "description": "The json object with query parameters of the call to getDevice",
868
958
  "additionalProperties": {
869
- "type": "string"
959
+ "type": [
960
+ "string",
961
+ "number"
962
+ ]
870
963
  }
871
964
  },
872
965
  "body": {
873
966
  "type": "object",
874
967
  "description": "The json object with body of the call to getDevice",
875
968
  "additionalProperties": {
876
- "type": "string"
969
+ "type": [
970
+ "string",
971
+ "number"
972
+ ]
877
973
  }
878
974
  },
879
975
  "headers": {
880
976
  "type": "object",
881
977
  "description": "The json object with headers of the call to getDevice",
882
978
  "additionalProperties": {
883
- "type": "string"
979
+ "type": [
980
+ "string",
981
+ "number"
982
+ ]
884
983
  }
885
984
  },
886
985
  "handleFailure": {
@@ -896,7 +995,10 @@
896
995
  "type": "object",
897
996
  "description": "The json object with response fields of the call to getDevice",
898
997
  "additionalProperties": {
899
- "type": "string"
998
+ "type": [
999
+ "string",
1000
+ "number"
1001
+ ]
900
1002
  },
901
1003
  "properties": {}
902
1004
  },
@@ -909,7 +1011,10 @@
909
1011
  "type": "object",
910
1012
  "description": "The json object with response fields of the call to getDevice",
911
1013
  "additionalProperties": {
912
- "type": "string"
1014
+ "type": [
1015
+ "string",
1016
+ "number"
1017
+ ]
913
1018
  },
914
1019
  "properties": {
915
1020
  "name": {
@@ -946,6 +1051,7 @@
946
1051
  "type": "array",
947
1052
  "description": "Broker call(s) to getDevicesFiltered",
948
1053
  "items": {
1054
+ "type": "object",
949
1055
  "properties": {
950
1056
  "path": {
951
1057
  "type": "string",
@@ -961,21 +1067,30 @@
961
1067
  "type": "object",
962
1068
  "description": "The json object with query parameters of the call to getDevicesFiltered",
963
1069
  "additionalProperties": {
964
- "type": "string"
1070
+ "type": [
1071
+ "string",
1072
+ "number"
1073
+ ]
965
1074
  }
966
1075
  },
967
1076
  "body": {
968
1077
  "type": "object",
969
1078
  "description": "The json object with body of the call to getDevicesFiltered",
970
1079
  "additionalProperties": {
971
- "type": "string"
1080
+ "type": [
1081
+ "string",
1082
+ "number"
1083
+ ]
972
1084
  }
973
1085
  },
974
1086
  "headers": {
975
1087
  "type": "object",
976
1088
  "description": "The json object with headers of the call to getDevicesFiltered",
977
1089
  "additionalProperties": {
978
- "type": "string"
1090
+ "type": [
1091
+ "string",
1092
+ "number"
1093
+ ]
979
1094
  }
980
1095
  },
981
1096
  "handleFailure": {
@@ -991,7 +1106,10 @@
991
1106
  "type": "object",
992
1107
  "description": "The json object with response fields of the call to getDevice",
993
1108
  "additionalProperties": {
994
- "type": "string"
1109
+ "type": [
1110
+ "string",
1111
+ "number"
1112
+ ]
995
1113
  },
996
1114
  "properties": {}
997
1115
  },
@@ -1004,7 +1122,10 @@
1004
1122
  "type": "object",
1005
1123
  "description": "The json object with response fields of the call to getDevicesFiltered",
1006
1124
  "additionalProperties": {
1007
- "type": "string"
1125
+ "type": [
1126
+ "string",
1127
+ "number"
1128
+ ]
1008
1129
  },
1009
1130
  "properties": {
1010
1131
  "name": {
@@ -1041,6 +1162,7 @@
1041
1162
  "type": "array",
1042
1163
  "description": "Broker call(s) to determine if the device isAlive",
1043
1164
  "items": {
1165
+ "type": "object",
1044
1166
  "properties": {
1045
1167
  "path": {
1046
1168
  "type": "string",
@@ -1056,21 +1178,30 @@
1056
1178
  "type": "object",
1057
1179
  "description": "The json object with query parameters of the call to isAlive",
1058
1180
  "additionalProperties": {
1059
- "type": "string"
1181
+ "type": [
1182
+ "string",
1183
+ "number"
1184
+ ]
1060
1185
  }
1061
1186
  },
1062
1187
  "body": {
1063
1188
  "type": "object",
1064
1189
  "description": "The json object with body of the call to isAlive",
1065
1190
  "additionalProperties": {
1066
- "type": "string"
1191
+ "type": [
1192
+ "string",
1193
+ "number"
1194
+ ]
1067
1195
  }
1068
1196
  },
1069
1197
  "headers": {
1070
1198
  "type": "object",
1071
1199
  "description": "The json object with headers of the call to isAlive",
1072
1200
  "additionalProperties": {
1073
- "type": "string"
1201
+ "type": [
1202
+ "string",
1203
+ "number"
1204
+ ]
1074
1205
  }
1075
1206
  },
1076
1207
  "handleFailure": {
@@ -1086,7 +1217,10 @@
1086
1217
  "type": "object",
1087
1218
  "description": "The json object with response fields of the call to getDevice",
1088
1219
  "additionalProperties": {
1089
- "type": "string"
1220
+ "type": [
1221
+ "string",
1222
+ "number"
1223
+ ]
1090
1224
  },
1091
1225
  "properties": {}
1092
1226
  },
@@ -1099,7 +1233,10 @@
1099
1233
  "type": "object",
1100
1234
  "description": "The json object with response fields of the call to isAlive",
1101
1235
  "additionalProperties": {
1102
- "type": "string"
1236
+ "type": [
1237
+ "string",
1238
+ "number"
1239
+ ]
1103
1240
  },
1104
1241
  "properties": {
1105
1242
  "status": {
@@ -1121,6 +1258,7 @@
1121
1258
  "type": "array",
1122
1259
  "description": "Broker call(s) to getConfig",
1123
1260
  "items": {
1261
+ "type": "object",
1124
1262
  "properties": {
1125
1263
  "path": {
1126
1264
  "type": "string",
@@ -1136,21 +1274,30 @@
1136
1274
  "type": "object",
1137
1275
  "description": "The json object with query parameters of the call to getConfig",
1138
1276
  "additionalProperties": {
1139
- "type": "string"
1277
+ "type": [
1278
+ "string",
1279
+ "number"
1280
+ ]
1140
1281
  }
1141
1282
  },
1142
1283
  "body": {
1143
1284
  "type": "object",
1144
1285
  "description": "The json object with body of the call to getConfig",
1145
1286
  "additionalProperties": {
1146
- "type": "string"
1287
+ "type": [
1288
+ "string",
1289
+ "number"
1290
+ ]
1147
1291
  }
1148
1292
  },
1149
1293
  "headers": {
1150
1294
  "type": "object",
1151
1295
  "description": "The json object with headers of the call to getConfig",
1152
1296
  "additionalProperties": {
1153
- "type": "string"
1297
+ "type": [
1298
+ "string",
1299
+ "number"
1300
+ ]
1154
1301
  }
1155
1302
  },
1156
1303
  "handleFailure": {
@@ -1166,7 +1313,10 @@
1166
1313
  "type": "object",
1167
1314
  "description": "The json object with response fields of the call to getDevice",
1168
1315
  "additionalProperties": {
1169
- "type": "string"
1316
+ "type": [
1317
+ "string",
1318
+ "number"
1319
+ ]
1170
1320
  },
1171
1321
  "properties": {}
1172
1322
  },
@@ -1179,7 +1329,10 @@
1179
1329
  "type": "object",
1180
1330
  "description": "The json object with response fields of the call to getConfig",
1181
1331
  "additionalProperties": {
1182
- "type": "string"
1332
+ "type": [
1333
+ "string",
1334
+ "number"
1335
+ ]
1183
1336
  },
1184
1337
  "properties": {}
1185
1338
  }
@@ -1190,6 +1343,7 @@
1190
1343
  "type": "array",
1191
1344
  "description": "Broker call(s) to getCount",
1192
1345
  "items": {
1346
+ "type": "object",
1193
1347
  "properties": {
1194
1348
  "path": {
1195
1349
  "type": "string",
@@ -1205,21 +1359,30 @@
1205
1359
  "type": "object",
1206
1360
  "description": "The json object with query parameters of the call to getCount",
1207
1361
  "additionalProperties": {
1208
- "type": "string"
1362
+ "type": [
1363
+ "string",
1364
+ "number"
1365
+ ]
1209
1366
  }
1210
1367
  },
1211
1368
  "body": {
1212
1369
  "type": "object",
1213
1370
  "description": "The json object with body of the call to getCount",
1214
1371
  "additionalProperties": {
1215
- "type": "string"
1372
+ "type": [
1373
+ "string",
1374
+ "number"
1375
+ ]
1216
1376
  }
1217
1377
  },
1218
1378
  "headers": {
1219
1379
  "type": "object",
1220
1380
  "description": "The json object with headers of the call to getCount",
1221
1381
  "additionalProperties": {
1222
- "type": "string"
1382
+ "type": [
1383
+ "string",
1384
+ "number"
1385
+ ]
1223
1386
  }
1224
1387
  },
1225
1388
  "handleFailure": {
@@ -1235,7 +1398,10 @@
1235
1398
  "type": "object",
1236
1399
  "description": "The json object with response fields of the call to getDevice",
1237
1400
  "additionalProperties": {
1238
- "type": "string"
1401
+ "type": [
1402
+ "string",
1403
+ "number"
1404
+ ]
1239
1405
  },
1240
1406
  "properties": {}
1241
1407
  },
@@ -1248,7 +1414,10 @@
1248
1414
  "type": "object",
1249
1415
  "description": "The json object with response fields of the call to getConfig",
1250
1416
  "additionalProperties": {
1251
- "type": "string"
1417
+ "type": [
1418
+ "string",
1419
+ "number"
1420
+ ]
1252
1421
  },
1253
1422
  "properties": {}
1254
1423
  }
@@ -1256,6 +1425,164 @@
1256
1425
  }
1257
1426
  }
1258
1427
  }
1428
+ },
1429
+ "cache": {
1430
+ "type": "object",
1431
+ "properties": {
1432
+ "enabled": {
1433
+ "type": "boolean",
1434
+ "description": "Whether or not cache is enabled for adapter",
1435
+ "default": false
1436
+ },
1437
+ "entities": {
1438
+ "type": "array",
1439
+ "description": "Information for the cached entities",
1440
+ "items": {
1441
+ "type": "object",
1442
+ "properties": {
1443
+ "entityType": {
1444
+ "type": "string",
1445
+ "description": "The name of the entity - should match adapter entity configuration or a broker (e.g. Device)",
1446
+ "default": ""
1447
+ },
1448
+ "frequency": {
1449
+ "type": "integer",
1450
+ "description": "how long (in minutes) we wait to re-populate the cache",
1451
+ "default": 1440,
1452
+ "maximum": 10080
1453
+ },
1454
+ "flushOnFail": {
1455
+ "type": "boolean",
1456
+ "description": "Whether to clear the cache we have if the populate failed",
1457
+ "default": false
1458
+ },
1459
+ "limit": {
1460
+ "type": "integer",
1461
+ "description": "maximum number of items to keep in cache",
1462
+ "default": 1000
1463
+ },
1464
+ "retryAttempts": {
1465
+ "type": "integer",
1466
+ "description": "number of times to retry the populate call before failure",
1467
+ "default": 5
1468
+ },
1469
+ "sort": {
1470
+ "type": "boolean",
1471
+ "description": "whether to sort the data or not",
1472
+ "default": true
1473
+ },
1474
+ "populate": {
1475
+ "type": "array",
1476
+ "description": "Information for the call(s) used to populate the cache",
1477
+ "items": {
1478
+ "type": "object",
1479
+ "properties": {
1480
+ "path": {
1481
+ "type": "string",
1482
+ "description": "The fully qualified path of the call to getDevice (e.g. /rest/api/device/{deviceid})",
1483
+ "default": ""
1484
+ },
1485
+ "method": {
1486
+ "type": "string",
1487
+ "description": "The method of the call to getDevice",
1488
+ "default": "GET"
1489
+ },
1490
+ "query": {
1491
+ "type": "object",
1492
+ "description": "The json object with query parameters of the call to getDevice",
1493
+ "additionalProperties": {
1494
+ "type": [
1495
+ "string",
1496
+ "number"
1497
+ ]
1498
+ }
1499
+ },
1500
+ "body": {
1501
+ "type": "object",
1502
+ "description": "The json object with body of the call to getDevice",
1503
+ "additionalProperties": {
1504
+ "type": [
1505
+ "string",
1506
+ "number"
1507
+ ]
1508
+ }
1509
+ },
1510
+ "headers": {
1511
+ "type": "object",
1512
+ "description": "The json object with headers of the call to getDevice",
1513
+ "additionalProperties": {
1514
+ "type": [
1515
+ "string",
1516
+ "number"
1517
+ ]
1518
+ }
1519
+ },
1520
+ "handleFailure": {
1521
+ "type": "string",
1522
+ "enum": [
1523
+ "ignore",
1524
+ "fail"
1525
+ ],
1526
+ "description": "return failure or ignore failure",
1527
+ "default": "ignore"
1528
+ },
1529
+ "requestFields": {
1530
+ "type": "object",
1531
+ "description": "The json object with response fields of the call to getDevice",
1532
+ "additionalProperties": {
1533
+ "type": [
1534
+ "string",
1535
+ "number"
1536
+ ]
1537
+ },
1538
+ "properties": {}
1539
+ },
1540
+ "responseDatakey": {
1541
+ "type": "string",
1542
+ "description": "place in the response where the data is - supports jsonquery",
1543
+ "default": ""
1544
+ },
1545
+ "responseFields": {
1546
+ "type": "object",
1547
+ "description": "The json object with response fields of the call to getDevice",
1548
+ "additionalProperties": {
1549
+ "type": [
1550
+ "string",
1551
+ "number"
1552
+ ]
1553
+ }
1554
+ }
1555
+ }
1556
+ }
1557
+ },
1558
+ "cachedTasks": {
1559
+ "type": "array",
1560
+ "description": "Information for the call(s) used to populate the cache",
1561
+ "items": {
1562
+ "type": "object",
1563
+ "properties": {
1564
+ "name": {
1565
+ "type": "string",
1566
+ "description": "the name of the task/action that should utilize cached information",
1567
+ "default": ""
1568
+ },
1569
+ "filterField": {
1570
+ "type": "string",
1571
+ "description": "the field that contains filter information for this call",
1572
+ "default": ""
1573
+ },
1574
+ "filterLoc": {
1575
+ "type": "string",
1576
+ "description": "the field that contains the location of the filter field",
1577
+ "default": ""
1578
+ }
1579
+ }
1580
+ }
1581
+ }
1582
+ }
1583
+ }
1584
+ }
1585
+ }
1259
1586
  }
1260
1587
  }
1261
1588
  }
Binary file
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "0.8.4",
3
- "configLines": 22337,
4
- "scriptLines": 1707,
5
- "codeLines": 31284,
6
- "testLines": 26263,
7
- "testCases": 1359,
8
- "totalCodeLines": 59254,
9
- "wfTasks": 380
2
+ "version": "1.0.4",
3
+ "configLines": 62990,
4
+ "scriptLines": 1783,
5
+ "codeLines": 53766,
6
+ "testLines": 43439,
7
+ "testCases": 2230,
8
+ "totalCodeLines": 98988,
9
+ "wfTasks": 611
10
10
  }