@itentialopensource/adapter-dna_center 0.5.4 → 0.5.7

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.
Files changed (45) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +12 -12
  3. package/CHANGELOG.md +24 -0
  4. package/ENHANCE.md +69 -0
  5. package/PROPERTIES.md +247 -0
  6. package/README.md +151 -379
  7. package/SUMMARY.md +9 -0
  8. package/TROUBLESHOOT.md +46 -0
  9. package/adapter.js +2212 -85
  10. package/adapterBase.js +848 -50
  11. package/entities/.generic/action.json +214 -0
  12. package/entities/.generic/schema.json +28 -0
  13. package/entities/.system/action.json +1 -1
  14. package/entities/Sites/action.json +42 -0
  15. package/entities/Sites/schema.json +2 -0
  16. package/error.json +12 -0
  17. package/package.json +45 -23
  18. package/pronghorn.json +780 -0
  19. package/propertiesDecorators.json +14 -0
  20. package/propertiesSchema.json +451 -11
  21. package/refs?service=git-upload-pack +0 -0
  22. package/report/updateReport1594147160686.json +95 -0
  23. package/report/updateReport1614887797185.json +95 -0
  24. package/report/updateReport1651598418513.json +114 -0
  25. package/sampleProperties.json +20 -5
  26. package/test/integration/adapterTestBasicGet.js +85 -0
  27. package/test/integration/adapterTestConnectivity.js +93 -0
  28. package/test/integration/adapterTestIntegration.js +87 -11
  29. package/test/unit/adapterBaseTestUnit.js +947 -0
  30. package/test/unit/adapterTestUnit.js +794 -18
  31. package/utils/addAuth.js +94 -0
  32. package/utils/artifactize.js +9 -14
  33. package/utils/basicGet.js +50 -0
  34. package/utils/checkMigrate.js +63 -0
  35. package/utils/entitiesToDB.js +224 -0
  36. package/utils/findPath.js +74 -0
  37. package/utils/modify.js +154 -0
  38. package/utils/packModificationScript.js +1 -1
  39. package/utils/patches2bundledDeps.js +90 -0
  40. package/utils/pre-commit.sh +1 -1
  41. package/utils/removeHooks.js +20 -0
  42. package/utils/tbScript.js +169 -0
  43. package/utils/tbUtils.js +464 -0
  44. package/utils/troubleshootingAdapter.js +190 -0
  45. package/gl-code-quality-report.json +0 -1
@@ -0,0 +1,14 @@
1
+ [
2
+ {
3
+ "type": "encryption",
4
+ "pointer": "/authentication/password"
5
+ },
6
+ {
7
+ "type": "encryption",
8
+ "pointer": "/authentication/token"
9
+ },
10
+ {
11
+ "type": "encryption",
12
+ "pointer": "/mongo/password"
13
+ }
14
+ ]
@@ -46,8 +46,16 @@
46
46
  "none"
47
47
  ]
48
48
  },
49
- "save_metric": {
49
+ "encode_pathvars": {
50
50
  "type": "boolean",
51
+ "description": "When true the path variables are encoded in the url",
52
+ "default": true
53
+ },
54
+ "save_metric": {
55
+ "type": [
56
+ "boolean",
57
+ "string"
58
+ ],
51
59
  "description": "When true the metrics collected by the adapter will be stored in mongo or on the filesystem",
52
60
  "default": false
53
61
  },
@@ -85,6 +93,9 @@
85
93
  },
86
94
  "mongo": {
87
95
  "$ref": "#/definitions/mongo"
96
+ },
97
+ "devicebroker": {
98
+ "$ref": "#/definitions/devicebroker"
88
99
  }
89
100
  },
90
101
  "required": [
@@ -104,6 +115,7 @@
104
115
  "enum": [
105
116
  "basic user_password",
106
117
  "static_token",
118
+ "jwt_token",
107
119
  "request_token",
108
120
  "no_authentication"
109
121
  ]
@@ -190,7 +202,10 @@
190
202
  ]
191
203
  },
192
204
  "auth_field": {
193
- "type": "string",
205
+ "type": [
206
+ "string",
207
+ "array"
208
+ ],
194
209
  "description": "The field in which to pass the token",
195
210
  "default": "header.headers.X-AUTH-TOKEN",
196
211
  "examples": [
@@ -202,7 +217,10 @@
202
217
  ]
203
218
  },
204
219
  "auth_field_format": {
205
- "type": "string",
220
+ "type": [
221
+ "string",
222
+ "array"
223
+ ],
206
224
  "description": "The format used to pass the authentication -- variables {token}, {username}, {password} will be replaced with the proper values. {b64}...{/b64} will base64 encode everything between the start and end tag.",
207
225
  "default": "{token}",
208
226
  "examples": [
@@ -212,6 +230,26 @@
212
230
  "Basic {b64}{username}:{password}{/b64}",
213
231
  "token={token}"
214
232
  ]
233
+ },
234
+ "auth_logging": {
235
+ "type": "boolean",
236
+ "description": "This property turns on logging of Authentication Information and should only be true when debugging authentication and connectivity",
237
+ "default": false
238
+ },
239
+ "client_id": {
240
+ "type": "string",
241
+ "description": "The client id for OAuth requests - can also use username depending on schema",
242
+ "default": ""
243
+ },
244
+ "client_secret": {
245
+ "type": "string",
246
+ "description": "The client secret for OAuth requests - can also use password depending on schema",
247
+ "default": ""
248
+ },
249
+ "grant_type": {
250
+ "type": "string",
251
+ "description": "The grant type for OAuth requests - can also provide in schema",
252
+ "default": ""
215
253
  }
216
254
  },
217
255
  "required": [
@@ -311,6 +349,10 @@
311
349
  "examples": [
312
350
  "/api/version/ping"
313
351
  ]
352
+ },
353
+ "query_object": {
354
+ "type": "object",
355
+ "description": "Query object { device: xxxxx } to be placed into the healthcheck, will be converted to query string by the adapter"
314
356
  }
315
357
  },
316
358
  "required": [
@@ -370,7 +412,7 @@
370
412
  "type": "integer",
371
413
  "description": "defines the number of request that Pronghorn can send dna_center at one time",
372
414
  "default": 1,
373
- "minimum": 1,
415
+ "minimum": 0,
374
416
  "maximum": 1000
375
417
  },
376
418
  "expire_timeout": {
@@ -386,6 +428,23 @@
386
428
  "default": 200,
387
429
  "minimum": 50,
388
430
  "maximum": 60000
431
+ },
432
+ "priorities": {
433
+ "type": "array",
434
+ "description": "define your priorities here",
435
+ "items": {
436
+ "type": "object",
437
+ "properties": {
438
+ "value": {
439
+ "type": "number",
440
+ "description": "Defines a priority - this number is what is passed in on a priority request"
441
+ },
442
+ "percent": {
443
+ "type": "number",
444
+ "description": "this is the percent of the queue that comes before the priority request (0 is front of queue, 100 is last in queue)"
445
+ }
446
+ }
447
+ }
389
448
  }
390
449
  },
391
450
  "required": [
@@ -433,11 +492,12 @@
433
492
  "maximum": 20
434
493
  },
435
494
  "limit_retry_error": {
436
- "type": "integer",
437
- "description": "http error status number which defines that no capacity was available and thus after waiting a short interval the adapter can retry the request",
438
- "default": 0,
439
- "minimum": 0,
440
- "maximum": 1000
495
+ "type": [
496
+ "integer",
497
+ "array"
498
+ ],
499
+ "description": "http error status number which defines that no capacity was available and thus after waiting a short interval the adapter can retry the request. Supports an array of numbers or strings including a range provided as '###-###'",
500
+ "default": 0
441
501
  },
442
502
  "failover_codes": {
443
503
  "type": "array",
@@ -489,6 +549,11 @@
489
549
  "type": "boolean",
490
550
  "description": "Archives each request/response and corresponding metrics",
491
551
  "default": false
552
+ },
553
+ "return_request": {
554
+ "type": "boolean",
555
+ "description": "This property turns on returning the response information - need to be carefull in case credentials are in the path",
556
+ "default": false
492
557
  }
493
558
  },
494
559
  "required": [
@@ -529,8 +594,19 @@
529
594
  "http",
530
595
  "https",
531
596
  "socks4",
532
- "socks5"
597
+ "socks5",
598
+ "tls"
533
599
  ]
600
+ },
601
+ "username": {
602
+ "type": "string",
603
+ "description": "username for proxy authentication",
604
+ "default": ""
605
+ },
606
+ "password": {
607
+ "type": "string",
608
+ "description": "password for proxy authentication",
609
+ "default": ""
534
610
  }
535
611
  },
536
612
  "required": [
@@ -582,7 +658,7 @@
582
658
  "description": "The fully qualified path name to the CA file used for SSL",
583
659
  "default": "",
584
660
  "examples": [
585
- "keys/key.pem"
661
+ "security/ca.pem"
586
662
  ]
587
663
  },
588
664
  "key_file": {
@@ -762,6 +838,370 @@
762
838
  }
763
839
  }
764
840
  }
841
+ },
842
+ "devicebroker": {
843
+ "type": "object",
844
+ "properties": {
845
+ "getDevice": {
846
+ "type": "array",
847
+ "description": "Broker call(s) to getDevice",
848
+ "items": {
849
+ "properties": {
850
+ "path": {
851
+ "type": "string",
852
+ "description": "The fully qualified path of the call to getDevice (e.g. /rest/api/device/{deviceid})",
853
+ "default": ""
854
+ },
855
+ "method": {
856
+ "type": "string",
857
+ "description": "The method of the call to getDevice",
858
+ "default": "GET"
859
+ },
860
+ "query": {
861
+ "type": "object",
862
+ "description": "The json object with query parameters of the call to getDevice",
863
+ "additionalProperties": {
864
+ "type": "string"
865
+ }
866
+ },
867
+ "body": {
868
+ "type": "object",
869
+ "description": "The json object with body of the call to getDevice",
870
+ "additionalProperties": {
871
+ "type": "string"
872
+ }
873
+ },
874
+ "headers": {
875
+ "type": "object",
876
+ "description": "The json object with headers of the call to getDevice",
877
+ "additionalProperties": {
878
+ "type": "string"
879
+ }
880
+ },
881
+ "handleFailure": {
882
+ "type": "string",
883
+ "enum": [
884
+ "ignore",
885
+ "fail"
886
+ ],
887
+ "description": "return failure or ignore failure",
888
+ "default": "ignore"
889
+ },
890
+ "requestFields": {
891
+ "type": "object",
892
+ "description": "The json object with response fields of the call to getDevice",
893
+ "additionalProperties": {
894
+ "type": "string"
895
+ },
896
+ "properties": {}
897
+ },
898
+ "responseFields": {
899
+ "type": "object",
900
+ "description": "The json object with response fields of the call to getDevice",
901
+ "additionalProperties": {
902
+ "type": "string"
903
+ },
904
+ "properties": {
905
+ "name": {
906
+ "type": "string",
907
+ "description": "The field in response to getDevice that contains the name of the device",
908
+ "default": "name"
909
+ },
910
+ "ostype": {
911
+ "type": "string",
912
+ "description": "The field in response to getDevice that contains the ostype of the device",
913
+ "default": "ostype"
914
+ },
915
+ "ostypePrefix": {
916
+ "type": "string",
917
+ "description": "Any prefix that should be added to the ostype of the device (e.g. aws-)",
918
+ "default": ""
919
+ },
920
+ "port": {
921
+ "type": "string",
922
+ "description": "The field in response to getDevice that contains the port of the device",
923
+ "default": ""
924
+ },
925
+ "ip": {
926
+ "type": "string",
927
+ "description": "The field in response to getDevice that contains the ip address of the device",
928
+ "default": ""
929
+ }
930
+ }
931
+ }
932
+ }
933
+ }
934
+ },
935
+ "getDevicesFiltered": {
936
+ "type": "array",
937
+ "description": "Broker call(s) to getDevicesFiltered",
938
+ "items": {
939
+ "properties": {
940
+ "path": {
941
+ "type": "string",
942
+ "description": "The fully qualified path of the call to getDevicesFiltered (e.g. /rest/api/device/{deviceid})",
943
+ "default": ""
944
+ },
945
+ "method": {
946
+ "type": "string",
947
+ "description": "The method of the call to getDevicesFiltered",
948
+ "default": "GET"
949
+ },
950
+ "query": {
951
+ "type": "object",
952
+ "description": "The json object with query parameters of the call to getDevicesFiltered",
953
+ "additionalProperties": {
954
+ "type": "string"
955
+ }
956
+ },
957
+ "body": {
958
+ "type": "object",
959
+ "description": "The json object with body of the call to getDevicesFiltered",
960
+ "additionalProperties": {
961
+ "type": "string"
962
+ }
963
+ },
964
+ "headers": {
965
+ "type": "object",
966
+ "description": "The json object with headers of the call to getDevicesFiltered",
967
+ "additionalProperties": {
968
+ "type": "string"
969
+ }
970
+ },
971
+ "handleFailure": {
972
+ "type": "string",
973
+ "enum": [
974
+ "ignore",
975
+ "fail"
976
+ ],
977
+ "description": "return failure or ignore failure",
978
+ "default": "ignore"
979
+ },
980
+ "responseFields": {
981
+ "type": "object",
982
+ "description": "The json object with response fields of the call to getDevicesFiltered",
983
+ "additionalProperties": {
984
+ "type": "string"
985
+ },
986
+ "properties": {
987
+ "name": {
988
+ "type": "string",
989
+ "description": "The field in response to getDevicesFiltered that contains the name of the device",
990
+ "default": "name"
991
+ },
992
+ "ostype": {
993
+ "type": "string",
994
+ "description": "The field in response to getDevicesFiltered that contains the ostype of the device",
995
+ "default": "ostype"
996
+ },
997
+ "ostypePrefix": {
998
+ "type": "string",
999
+ "description": "Any prefix that should be added to the ostype of the device (e.g. aws-)",
1000
+ "default": ""
1001
+ },
1002
+ "port_field": {
1003
+ "type": "string",
1004
+ "description": "The field in response to getDevicesFiltered that contains the port of the device",
1005
+ "default": ""
1006
+ },
1007
+ "ip_field": {
1008
+ "type": "string",
1009
+ "description": "The field in response to getDevicesFiltered that contains the ip address of the device",
1010
+ "default": ""
1011
+ }
1012
+ }
1013
+ }
1014
+ }
1015
+ }
1016
+ },
1017
+ "isAlive": {
1018
+ "type": "array",
1019
+ "description": "Broker call(s) to determine if the device isAlive",
1020
+ "items": {
1021
+ "properties": {
1022
+ "path": {
1023
+ "type": "string",
1024
+ "description": "The fully qualified path of the call to isAlive (e.g. /rest/api/device/{deviceid})",
1025
+ "default": ""
1026
+ },
1027
+ "method": {
1028
+ "type": "string",
1029
+ "description": "The method of the call to isAlive",
1030
+ "default": "GET"
1031
+ },
1032
+ "query": {
1033
+ "type": "object",
1034
+ "description": "The json object with query parameters of the call to isAlive",
1035
+ "additionalProperties": {
1036
+ "type": "string"
1037
+ }
1038
+ },
1039
+ "body": {
1040
+ "type": "object",
1041
+ "description": "The json object with body of the call to isAlive",
1042
+ "additionalProperties": {
1043
+ "type": "string"
1044
+ }
1045
+ },
1046
+ "headers": {
1047
+ "type": "object",
1048
+ "description": "The json object with headers of the call to isAlive",
1049
+ "additionalProperties": {
1050
+ "type": "string"
1051
+ }
1052
+ },
1053
+ "handleFailure": {
1054
+ "type": "string",
1055
+ "enum": [
1056
+ "ignore",
1057
+ "fail"
1058
+ ],
1059
+ "description": "return failure or ignore isAlive",
1060
+ "default": "ignore"
1061
+ },
1062
+ "statusValue": {
1063
+ "type": "string",
1064
+ "description": "The expected value in the status field",
1065
+ "default": "true"
1066
+ },
1067
+ "requestFields": {
1068
+ "type": "object",
1069
+ "description": "The json object with response fields of the call to getDevice",
1070
+ "additionalProperties": {
1071
+ "type": "string"
1072
+ },
1073
+ "properties": {}
1074
+ },
1075
+ "responseFields": {
1076
+ "type": "object",
1077
+ "description": "The json object with response fields of the call to isAlive",
1078
+ "additionalProperties": {
1079
+ "type": "string"
1080
+ },
1081
+ "properties": {
1082
+ "status": {
1083
+ "type": "string",
1084
+ "description": "The field in response to isAlive that contains the status of the device",
1085
+ "default": "name"
1086
+ }
1087
+ }
1088
+ }
1089
+ }
1090
+ }
1091
+ },
1092
+ "getConfig": {
1093
+ "type": "array",
1094
+ "description": "Broker call(s) to getConfig",
1095
+ "items": {
1096
+ "properties": {
1097
+ "path": {
1098
+ "type": "string",
1099
+ "description": "The fully qualified path of the call to getConfig (e.g. /rest/api/device/{deviceid})",
1100
+ "default": ""
1101
+ },
1102
+ "method": {
1103
+ "type": "string",
1104
+ "description": "The method of the call to getConfig",
1105
+ "default": "GET"
1106
+ },
1107
+ "query": {
1108
+ "type": "object",
1109
+ "description": "The json object with query parameters of the call to getConfig",
1110
+ "additionalProperties": {
1111
+ "type": "string"
1112
+ }
1113
+ },
1114
+ "body": {
1115
+ "type": "object",
1116
+ "description": "The json object with body of the call to getConfig",
1117
+ "additionalProperties": {
1118
+ "type": "string"
1119
+ }
1120
+ },
1121
+ "headers": {
1122
+ "type": "object",
1123
+ "description": "The json object with headers of the call to getConfig",
1124
+ "additionalProperties": {
1125
+ "type": "string"
1126
+ }
1127
+ },
1128
+ "handleFailure": {
1129
+ "type": "string",
1130
+ "enum": [
1131
+ "ignore",
1132
+ "fail"
1133
+ ],
1134
+ "description": "return failure or ignore getConfig",
1135
+ "default": "ignore"
1136
+ },
1137
+ "requestFields": {
1138
+ "type": "object",
1139
+ "description": "The json object with response fields of the call to getDevice",
1140
+ "additionalProperties": {
1141
+ "type": "string"
1142
+ },
1143
+ "properties": {}
1144
+ },
1145
+ "responseFields": {
1146
+ "type": "object",
1147
+ "description": "The json object with response fields of the call to getConfig",
1148
+ "additionalProperties": {
1149
+ "type": "string"
1150
+ },
1151
+ "properties": {}
1152
+ }
1153
+ }
1154
+ }
1155
+ },
1156
+ "getCount": {
1157
+ "type": "array",
1158
+ "description": "Broker call(s) to getCount",
1159
+ "items": {
1160
+ "properties": {
1161
+ "path": {
1162
+ "type": "string",
1163
+ "description": "The fully qualified path of the call to getCount (e.g. /rest/api/device/{deviceid})",
1164
+ "default": ""
1165
+ },
1166
+ "method": {
1167
+ "type": "string",
1168
+ "description": "The method of the call to getCount",
1169
+ "default": "GET"
1170
+ },
1171
+ "query": {
1172
+ "type": "object",
1173
+ "description": "The json object with query parameters of the call to getCount",
1174
+ "additionalProperties": {
1175
+ "type": "string"
1176
+ }
1177
+ },
1178
+ "body": {
1179
+ "type": "object",
1180
+ "description": "The json object with body of the call to getCount",
1181
+ "additionalProperties": {
1182
+ "type": "string"
1183
+ }
1184
+ },
1185
+ "headers": {
1186
+ "type": "object",
1187
+ "description": "The json object with headers of the call to getCount",
1188
+ "additionalProperties": {
1189
+ "type": "string"
1190
+ }
1191
+ },
1192
+ "handleFailure": {
1193
+ "type": "string",
1194
+ "enum": [
1195
+ "ignore",
1196
+ "fail"
1197
+ ],
1198
+ "description": "return failure or ignore getCount",
1199
+ "default": "ignore"
1200
+ }
1201
+ }
1202
+ }
1203
+ }
1204
+ }
765
1205
  }
766
1206
  }
767
1207
  }
Binary file
@@ -0,0 +1,95 @@
1
+ {
2
+ "errors": [],
3
+ "statistics": [
4
+ {
5
+ "owner": "errorJson",
6
+ "description": "New adapter errors available for use",
7
+ "value": 0
8
+ },
9
+ {
10
+ "owner": "errorJson",
11
+ "description": "Adapter errors no longer available for use",
12
+ "value": 0
13
+ },
14
+ {
15
+ "owner": "errorJson",
16
+ "description": "Adapter errors that have been updated (e.g. recommendation changes)",
17
+ "value": 29
18
+ },
19
+ {
20
+ "owner": "packageJson",
21
+ "description": "Number of production dependencies",
22
+ "value": 5
23
+ },
24
+ {
25
+ "owner": "packageJson",
26
+ "description": "Number of development dependencies",
27
+ "value": 9
28
+ },
29
+ {
30
+ "owner": "packageJson",
31
+ "description": "Number of npm scripts",
32
+ "value": 10
33
+ },
34
+ {
35
+ "owner": "packageJson",
36
+ "description": "Runtime Library dependency",
37
+ "value": "^4.34.4"
38
+ },
39
+ {
40
+ "owner": "propertiesSchemaJson",
41
+ "description": "Adapter properties defined in the propertiesSchema file",
42
+ "value": 56
43
+ },
44
+ {
45
+ "owner": "readmeMd",
46
+ "description": "Number of lines in the README.md",
47
+ "value": 530
48
+ },
49
+ {
50
+ "owner": "unitTestJS",
51
+ "description": "Number of lines of code in unit tests",
52
+ "value": 6499
53
+ },
54
+ {
55
+ "owner": "unitTestJS",
56
+ "description": "Number of unit tests",
57
+ "value": 417
58
+ },
59
+ {
60
+ "owner": "integrationTestJS",
61
+ "description": "Number of lines of code in integration tests",
62
+ "value": 5366
63
+ },
64
+ {
65
+ "owner": "integrationTestJS",
66
+ "description": "Number of integration tests",
67
+ "value": 174
68
+ },
69
+ {
70
+ "owner": "staticFile",
71
+ "description": "Number of lines of code in adapterBase.js",
72
+ "value": 751
73
+ },
74
+ {
75
+ "owner": "staticFile",
76
+ "description": "Number of static files added",
77
+ "value": 18
78
+ },
79
+ {
80
+ "owner": "Overall",
81
+ "description": "Total lines of Code",
82
+ "value": 12616
83
+ },
84
+ {
85
+ "owner": "Overall",
86
+ "description": "Total Tests",
87
+ "value": 591
88
+ },
89
+ {
90
+ "owner": "Overall",
91
+ "description": "Total Files",
92
+ "value": 6
93
+ }
94
+ ]
95
+ }