@itentialopensource/adapter-aruba_airwave 0.1.1 → 0.2.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 CHANGED
@@ -1,4 +1,20 @@
1
1
 
2
+ ## 0.2.1 [01-09-2023]
3
+
4
+ * Fixed entity paths and updated package-lock
5
+
6
+ See merge request itentialopensource/adapters/controller-orchestrator/adapter-aruba_airwave!2
7
+
8
+ ---
9
+
10
+ ## 0.2.0 [11-03-2022]
11
+
12
+ * Add new call
13
+
14
+ See merge request itentialopensource/adapters/controller-orchestrator/adapter-aruba_airwave!1
15
+
16
+ ---
17
+
2
18
  ## 0.1.1 [10-31-2022]
3
19
 
4
20
  * Bug fixes and performance improvements
@@ -6,4 +22,3 @@
6
22
  See commit 365fc74
7
23
 
8
24
  ---
9
-
package/adapter.js CHANGED
@@ -1111,6 +1111,87 @@ class ArubaAirwave extends AdapterBaseCl {
1111
1111
  }
1112
1112
  }
1113
1113
 
1114
+ /**
1115
+ * @function moveDeviceToGroup
1116
+ * @pronghornType method
1117
+ * @name moveDeviceToGroup
1118
+ * @summary Move device
1119
+ * @param {Object} body - device_id, group_name, group_id
1120
+ * @param {getCallback} callback - a callback function to return the result
1121
+ * @return {object} results - An object containing the response of the action
1122
+ *
1123
+ * @route {PUT} /moveDeviceToGroup
1124
+ * @roles admin
1125
+ * @task true
1126
+ */
1127
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
1128
+ moveDeviceToGroup(body, callback) {
1129
+ const meth = 'adapter-moveDeviceToGroup';
1130
+ const origin = `${this.id}-${meth}`;
1131
+ log.trace(origin);
1132
+
1133
+ if (this.suspended && this.suspendMode === 'error') {
1134
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1135
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1136
+ return callback(null, errorObj);
1137
+ }
1138
+
1139
+ /* HERE IS WHERE YOU VALIDATE DATA */
1140
+ if (body === undefined || body === null || body === '') {
1141
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
1142
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1143
+ return callback(null, errorObj);
1144
+ }
1145
+
1146
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
1147
+ const queryParamsAvailable = {};
1148
+ const queryParams = {};
1149
+ const pathVars = [];
1150
+ const bodyVars = body;
1151
+
1152
+ // loop in template. long callback arg name to avoid identifier conflicts
1153
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1154
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1155
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1156
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1157
+ }
1158
+ });
1159
+
1160
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
1161
+ // see adapter code documentation for more information on the request object's fields
1162
+ const reqObj = {
1163
+ payload: bodyVars,
1164
+ uriPathVars: pathVars,
1165
+ uriQuery: queryParams
1166
+ };
1167
+
1168
+ try {
1169
+ // Make the call -
1170
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
1171
+ return this.requestHandlerInst.identifyRequest('DeviceAPIS', 'moveDeviceToGroup', reqObj, true, (irReturnData, irReturnError) => {
1172
+ // if we received an error or their is no response on the results
1173
+ // return an error
1174
+ if (irReturnError) {
1175
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
1176
+ return callback(null, irReturnError);
1177
+ }
1178
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
1179
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['moveDeviceToGroup'], null, null, null);
1180
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1181
+ return callback(null, errorObj);
1182
+ }
1183
+
1184
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
1185
+ // return the response
1186
+ return callback(irReturnData, null);
1187
+ });
1188
+ } catch (ex) {
1189
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
1190
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1191
+ return callback(null, errorObj);
1192
+ }
1193
+ }
1194
+
1114
1195
  /**
1115
1196
  * @function aPLog
1116
1197
  * @pronghornType method
@@ -4,7 +4,7 @@
4
4
  "name": "deleteDevice",
5
5
  "protocol": "REST",
6
6
  "method": "DELETE",
7
- "entitypath": "{base_path}/{version}/delete_device?{query}",
7
+ "entitypath": "{base_path}/{version}/api/delete_device?{query}",
8
8
  "requestSchema": "schema.json",
9
9
  "responseSchema": "schema.json",
10
10
  "timeout": 0,
@@ -25,7 +25,28 @@
25
25
  "name": "moveDeviceToFolder",
26
26
  "protocol": "REST",
27
27
  "method": "PUT",
28
- "entitypath": "{base_path}/{version}/move_to_folder?{query}",
28
+ "entitypath": "{base_path}/{version}/api/move_to_folder?{query}",
29
+ "requestSchema": "schema.json",
30
+ "responseSchema": "schema.json",
31
+ "timeout": 0,
32
+ "sendEmpty": false,
33
+ "sendGetBody": false,
34
+ "requestDatatype": "JSON",
35
+ "responseDatatype": "JSON",
36
+ "headers": {},
37
+ "responseObjects": [
38
+ {
39
+ "type": "default",
40
+ "key": "",
41
+ "mockFile": ""
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "name": "moveDeviceToGroup",
47
+ "protocol": "REST",
48
+ "method": "PUT",
49
+ "entitypath": "{base_path}/{version}/api/move_to_group?{query}",
29
50
  "requestSchema": "schema.json",
30
51
  "responseSchema": "schema.json",
31
52
  "timeout": 0,
@@ -11,7 +11,8 @@
11
11
  "default": "aPSearch",
12
12
  "enum": [
13
13
  "deleteDevice",
14
- "moveDeviceToFolder"
14
+ "moveDeviceToFolder",
15
+ "moveDeviceToGroup"
15
16
  ],
16
17
  "external_name": "ph_request_type"
17
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-aruba_airwave",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "This adapter integrates with system described as: Aruba Airwave",
5
5
  "main": "adapter.js",
6
6
  "wizardVersion": "2.43.5",
package/pronghorn.json CHANGED
@@ -516,6 +516,41 @@
516
516
  },
517
517
  "task": true
518
518
  },
519
+ {
520
+ "name": "moveDeviceToGroup",
521
+ "summary": "Move device",
522
+ "description": "Move a device with device ID from one group to another group with group ID or group name in AirWave",
523
+ "input": [
524
+ {
525
+ "name": "body",
526
+ "type": "object",
527
+ "info": "device_id, group_name, group_id",
528
+ "description": "device_id, group_name, group_id",
529
+ "schema": {
530
+ "title": "body",
531
+ "type": "object"
532
+ },
533
+ "required": true
534
+ }
535
+ ],
536
+ "output": {
537
+ "name": "result",
538
+ "type": "object",
539
+ "description": "A JSON Object containing status, code and the result",
540
+ "schema": {
541
+ "title": "result",
542
+ "type": "object"
543
+ }
544
+ },
545
+ "roles": [
546
+ "admin"
547
+ ],
548
+ "route": {
549
+ "verb": "PUT",
550
+ "path": "/moveDeviceToGroup"
551
+ },
552
+ "task": true
553
+ },
519
554
  {
520
555
  "name": "aPLog",
521
556
  "summary": "AP Log",
Binary file