@itentialopensource/adapter-f5_bigiq 0.4.9 → 0.5.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/adapter.js CHANGED
@@ -29286,6 +29286,2973 @@ class F5BigIQ extends AdapterBaseCl {
29286
29286
  return callback(null, errorObj);
29287
29287
  }
29288
29288
  }
29289
+
29290
+ /**
29291
+ * @function initialLicenseActivation
29292
+ * @pronghornType method
29293
+ * @name initialLicenseActivation
29294
+ * @summary Activate a license
29295
+ *
29296
+ * @param {object} body - Body.
29297
+ * @param {getCallback} callback - a callback function to return the result
29298
+ * @return {object} results - An object containing the response of the action
29299
+ *
29300
+ * @route {POST} /initialLicenseActivation
29301
+ * @roles admin
29302
+ * @task true
29303
+ */
29304
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
29305
+ initialLicenseActivation(body, callback) {
29306
+ const meth = 'adapter-initialLicenseActivation';
29307
+ const origin = `${this.id}-${meth}`;
29308
+ log.trace(origin);
29309
+
29310
+ if (this.suspended && this.suspendMode === 'error') {
29311
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
29312
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29313
+ return callback(null, errorObj);
29314
+ }
29315
+
29316
+ /* HERE IS WHERE YOU VALIDATE DATA */
29317
+ if (body === undefined || body === null || body === '') {
29318
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
29319
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29320
+ return callback(null, errorObj);
29321
+ }
29322
+
29323
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
29324
+ const queryParamsAvailable = {};
29325
+ const queryParams = {};
29326
+ const pathVars = [];
29327
+ const bodyVars = body;
29328
+
29329
+ // loop in template. long callback arg name to avoid identifier conflicts
29330
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
29331
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
29332
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
29333
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
29334
+ }
29335
+ });
29336
+
29337
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
29338
+ // see adapter code documentation for more information on the request object's fields
29339
+ const reqObj = {
29340
+ payload: bodyVars,
29341
+ uriPathVars: pathVars,
29342
+ uriQuery: queryParams
29343
+ };
29344
+
29345
+ try {
29346
+ // Make the call -
29347
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
29348
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'initialLicenseActivation', reqObj, true, (irReturnData, irReturnError) => {
29349
+ // if we received an error or their is no response on the results
29350
+ // return an error
29351
+ if (irReturnError) {
29352
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
29353
+ return callback(null, irReturnError);
29354
+ }
29355
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
29356
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['initialLicenseActivation'], null, null, null);
29357
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29358
+ return callback(null, errorObj);
29359
+ }
29360
+
29361
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
29362
+ // return the response
29363
+ return callback(irReturnData, null);
29364
+ });
29365
+ } catch (ex) {
29366
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
29367
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29368
+ return callback(null, errorObj);
29369
+ }
29370
+ }
29371
+
29372
+ /**
29373
+ * @function pollInitialLicenseActivation
29374
+ * @pronghornType method
29375
+ * @name pollInitialLicenseActivation
29376
+ * @summary Poll license activation status.
29377
+ *
29378
+ * @param {string} registrationKey - registrationKey param
29379
+ * @param {getCallback} callback - a callback function to return the result
29380
+ * @return {object} results - An object containing the response of the action
29381
+ *
29382
+ * @route {POST} /pollInitialLicenseActivation
29383
+ * @roles admin
29384
+ * @task true
29385
+ */
29386
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
29387
+ pollInitialLicenseActivation(registrationKey, callback) {
29388
+ const meth = 'adapter-pollInitialLicenseActivation';
29389
+ const origin = `${this.id}-${meth}`;
29390
+ log.trace(origin);
29391
+
29392
+ if (this.suspended && this.suspendMode === 'error') {
29393
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
29394
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29395
+ return callback(null, errorObj);
29396
+ }
29397
+
29398
+ /* HERE IS WHERE YOU VALIDATE DATA */
29399
+ if (registrationKey === undefined || registrationKey === null || registrationKey === '') {
29400
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['registrationKey'], null, null, null);
29401
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29402
+ return callback(null, errorObj);
29403
+ }
29404
+
29405
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
29406
+ const queryParamsAvailable = {};
29407
+ const queryParams = {};
29408
+ const pathVars = [registrationKey];
29409
+ const bodyVars = {};
29410
+
29411
+ // loop in template. long callback arg name to avoid identifier conflicts
29412
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
29413
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
29414
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
29415
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
29416
+ }
29417
+ });
29418
+
29419
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
29420
+ // see adapter code documentation for more information on the request object's fields
29421
+ const reqObj = {
29422
+ payload: bodyVars,
29423
+ uriPathVars: pathVars,
29424
+ uriQuery: queryParams
29425
+ };
29426
+
29427
+ try {
29428
+ // Make the call -
29429
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
29430
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'pollInitialLicenseActivation', reqObj, true, (irReturnData, irReturnError) => {
29431
+ // if we received an error or their is no response on the results
29432
+ // return an error
29433
+ if (irReturnError) {
29434
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
29435
+ return callback(null, irReturnError);
29436
+ }
29437
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
29438
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['pollInitialLicenseActivation'], null, null, null);
29439
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29440
+ return callback(null, errorObj);
29441
+ }
29442
+
29443
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
29444
+ // return the response
29445
+ return callback(irReturnData, null);
29446
+ });
29447
+ } catch (ex) {
29448
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
29449
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29450
+ return callback(null, errorObj);
29451
+ }
29452
+ }
29453
+
29454
+ /**
29455
+ * @function completeInitialActivation
29456
+ * @pronghornType method
29457
+ * @name completeInitialActivation
29458
+ * @summary Complete or retry an activation.
29459
+ *
29460
+ * @param {string} registrationKey - registrationKey param
29461
+ * @param {object} body - Body containing eulaText or licenseText and status
29462
+ * @param {getCallback} callback - a callback function to return the result
29463
+ * @return {object} results - An object containing the response of the action
29464
+ *
29465
+ * @route {POST} /completeInitialActivation
29466
+ * @roles admin
29467
+ * @task true
29468
+ */
29469
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
29470
+ completeInitialActivation(registrationKey, body, callback) {
29471
+ const meth = 'adapter-completeInitialActivation';
29472
+ const origin = `${this.id}-${meth}`;
29473
+ log.trace(origin);
29474
+
29475
+ if (this.suspended && this.suspendMode === 'error') {
29476
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
29477
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29478
+ return callback(null, errorObj);
29479
+ }
29480
+
29481
+ /* HERE IS WHERE YOU VALIDATE DATA */
29482
+ if (registrationKey === undefined || registrationKey === null || registrationKey === '') {
29483
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['registrationKey'], null, null, null);
29484
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29485
+ return callback(null, errorObj);
29486
+ }
29487
+ if (body === undefined || body === null || body === '') {
29488
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
29489
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29490
+ return callback(null, errorObj);
29491
+ }
29492
+
29493
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
29494
+ const queryParamsAvailable = {};
29495
+ const queryParams = {};
29496
+ const pathVars = [registrationKey];
29497
+ const bodyVars = body;
29498
+
29499
+ // loop in template. long callback arg name to avoid identifier conflicts
29500
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
29501
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
29502
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
29503
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
29504
+ }
29505
+ });
29506
+
29507
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
29508
+ // see adapter code documentation for more information on the request object's fields
29509
+ const reqObj = {
29510
+ payload: bodyVars,
29511
+ uriPathVars: pathVars,
29512
+ uriQuery: queryParams
29513
+ };
29514
+
29515
+ try {
29516
+ // Make the call -
29517
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
29518
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'completeInitialActivation', reqObj, false, (irReturnData, irReturnError) => {
29519
+ // if we received an error or their is no response on the results
29520
+ // return an error
29521
+ if (irReturnError) {
29522
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
29523
+ return callback(null, irReturnError);
29524
+ }
29525
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
29526
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['completeInitialActivation'], null, null, null);
29527
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29528
+ return callback(null, errorObj);
29529
+ }
29530
+
29531
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
29532
+ // return the response
29533
+ return callback(irReturnData, null);
29534
+ });
29535
+ } catch (ex) {
29536
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
29537
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29538
+ return callback(null, errorObj);
29539
+ }
29540
+ }
29541
+
29542
+ /**
29543
+ * @function removeFailedInitialActivation
29544
+ * @pronghornType method
29545
+ * @name removeFailedInitialActivation
29546
+ * @summary Remove failed activation.
29547
+ *
29548
+ * @param {string} registrationKey - License registration key
29549
+ * @param {getCallback} callback - a callback function to return the result
29550
+ * @return {object} results - An object containing the response of the action
29551
+ *
29552
+ * @route {POST} /removeFailedInitialActivation
29553
+ * @roles admin
29554
+ * @task true
29555
+ */
29556
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
29557
+ removeFailedInitialActivation(registrationKey, callback) {
29558
+ const meth = 'adapter-removeFailedInitialActivation';
29559
+ const origin = `${this.id}-${meth}`;
29560
+ log.trace(origin);
29561
+
29562
+ if (this.suspended && this.suspendMode === 'error') {
29563
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
29564
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29565
+ return callback(null, errorObj);
29566
+ }
29567
+
29568
+ /* HERE IS WHERE YOU VALIDATE DATA */
29569
+ if (registrationKey === undefined || registrationKey === null || registrationKey === '') {
29570
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['registrationKey'], null, null, null);
29571
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29572
+ return callback(null, errorObj);
29573
+ }
29574
+
29575
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
29576
+ const queryParamsAvailable = {};
29577
+ const queryParams = {};
29578
+ const pathVars = [registrationKey];
29579
+ const bodyVars = {};
29580
+
29581
+ // loop in template. long callback arg name to avoid identifier conflicts
29582
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
29583
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
29584
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
29585
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
29586
+ }
29587
+ });
29588
+
29589
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
29590
+ // see adapter code documentation for more information on the request object's fields
29591
+ const reqObj = {
29592
+ payload: bodyVars,
29593
+ uriPathVars: pathVars,
29594
+ uriQuery: queryParams
29595
+ };
29596
+
29597
+ try {
29598
+ // Make the call -
29599
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
29600
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'removeFailedInitialActivation', reqObj, false, (irReturnData, irReturnError) => {
29601
+ // if we received an error or their is no response on the results
29602
+ // return an error
29603
+ if (irReturnError) {
29604
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
29605
+ return callback(null, irReturnError);
29606
+ }
29607
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
29608
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['removeFailedInitialActivation'], null, null, null);
29609
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29610
+ return callback(null, errorObj);
29611
+ }
29612
+
29613
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
29614
+ // return the response
29615
+ return callback(irReturnData, null);
29616
+ });
29617
+ } catch (ex) {
29618
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
29619
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29620
+ return callback(null, errorObj);
29621
+ }
29622
+ }
29623
+
29624
+ /**
29625
+ * @function getLicenseReference
29626
+ * @pronghornType method
29627
+ * @name getLicenseReference
29628
+ * @summary Get license reference.
29629
+ *
29630
+ * @param {string} uuid - uuid param
29631
+ * @param {getCallback} callback - a callback function to return the result
29632
+ * @return {object} results - An object containing the response of the action
29633
+ *
29634
+ * @route {POST} /getLicenseReference
29635
+ * @roles admin
29636
+ * @task true
29637
+ */
29638
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
29639
+ getLicenseReference(uuid, callback) {
29640
+ const meth = 'adapter-getLicenseReference';
29641
+ const origin = `${this.id}-${meth}`;
29642
+ log.trace(origin);
29643
+
29644
+ if (this.suspended && this.suspendMode === 'error') {
29645
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
29646
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29647
+ return callback(null, errorObj);
29648
+ }
29649
+
29650
+ /* HERE IS WHERE YOU VALIDATE DATA */
29651
+ if (uuid === undefined || uuid === null || uuid === '') {
29652
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uuid'], null, null, null);
29653
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29654
+ return callback(null, errorObj);
29655
+ }
29656
+
29657
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
29658
+ const queryParamsAvailable = {};
29659
+ const queryParams = {};
29660
+ const pathVars = [uuid];
29661
+ const bodyVars = {};
29662
+
29663
+ // loop in template. long callback arg name to avoid identifier conflicts
29664
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
29665
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
29666
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
29667
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
29668
+ }
29669
+ });
29670
+
29671
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
29672
+ // see adapter code documentation for more information on the request object's fields
29673
+ const reqObj = {
29674
+ payload: bodyVars,
29675
+ uriPathVars: pathVars,
29676
+ uriQuery: queryParams
29677
+ };
29678
+
29679
+ try {
29680
+ // Make the call -
29681
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
29682
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'getLicenseReference', reqObj, true, (irReturnData, irReturnError) => {
29683
+ // if we received an error or their is no response on the results
29684
+ // return an error
29685
+ if (irReturnError) {
29686
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
29687
+ return callback(null, irReturnError);
29688
+ }
29689
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
29690
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getLicenseReference'], null, null, null);
29691
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29692
+ return callback(null, errorObj);
29693
+ }
29694
+
29695
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
29696
+ // return the response
29697
+ return callback(irReturnData, null);
29698
+ });
29699
+ } catch (ex) {
29700
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
29701
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29702
+ return callback(null, errorObj);
29703
+ }
29704
+ }
29705
+
29706
+ /**
29707
+ * @function reactivateLicense
29708
+ * @pronghornType method
29709
+ * @name reactivateLicense
29710
+ * @summary Reactivate or complete activation of purchased pool license.
29711
+ *
29712
+ * @param {string} uuid - uuid param
29713
+ * @param {object} body - Body for reactivation or completing activation
29714
+ * @param {getCallback} callback - a callback function to return the result
29715
+ * @return {object} results - An object containing the response of the action
29716
+ *
29717
+ * @route {POST} /reactivateLicense
29718
+ * @roles admin
29719
+ * @task true
29720
+ */
29721
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
29722
+ reactivateLicense(uuid, body, callback) {
29723
+ const meth = 'adapter-reactivateLicense';
29724
+ const origin = `${this.id}-${meth}`;
29725
+ log.trace(origin);
29726
+
29727
+ if (this.suspended && this.suspendMode === 'error') {
29728
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
29729
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29730
+ return callback(null, errorObj);
29731
+ }
29732
+
29733
+ /* HERE IS WHERE YOU VALIDATE DATA */
29734
+ if (uuid === undefined || uuid === null || uuid === '') {
29735
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uuid'], null, null, null);
29736
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29737
+ return callback(null, errorObj);
29738
+ }
29739
+ if (body === undefined || body === null || body === '') {
29740
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
29741
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29742
+ return callback(null, errorObj);
29743
+ }
29744
+
29745
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
29746
+ const queryParamsAvailable = {};
29747
+ const queryParams = {};
29748
+ const pathVars = [uuid];
29749
+ const bodyVars = body;
29750
+
29751
+ // loop in template. long callback arg name to avoid identifier conflicts
29752
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
29753
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
29754
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
29755
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
29756
+ }
29757
+ });
29758
+
29759
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
29760
+ // see adapter code documentation for more information on the request object's fields
29761
+ const reqObj = {
29762
+ payload: bodyVars,
29763
+ uriPathVars: pathVars,
29764
+ uriQuery: queryParams
29765
+ };
29766
+
29767
+ try {
29768
+ // Make the call -
29769
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
29770
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'reactivateLicense', reqObj, false, (irReturnData, irReturnError) => {
29771
+ // if we received an error or their is no response on the results
29772
+ // return an error
29773
+ if (irReturnError) {
29774
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
29775
+ return callback(null, irReturnError);
29776
+ }
29777
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
29778
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['reactivateLicense'], null, null, null);
29779
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29780
+ return callback(null, errorObj);
29781
+ }
29782
+
29783
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
29784
+ // return the response
29785
+ return callback(irReturnData, null);
29786
+ });
29787
+ } catch (ex) {
29788
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
29789
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29790
+ return callback(null, errorObj);
29791
+ }
29792
+ }
29793
+
29794
+ /**
29795
+ * @function deletePurchasedPoolLicense
29796
+ * @pronghornType method
29797
+ * @name deletePurchasedPoolLicense
29798
+ * @summary Delete a purchased pool license.
29799
+ *
29800
+ * @param {string} uuid - License uuid
29801
+ * @param {getCallback} callback - a callback function to return the result
29802
+ * @return {object} results - An object containing the response of the action
29803
+ *
29804
+ * @route {POST} /deletePurchasedPoolLicense
29805
+ * @roles admin
29806
+ * @task true
29807
+ */
29808
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
29809
+ deletePurchasedPoolLicense(uuid, callback) {
29810
+ const meth = 'adapter-deletePurchasedPoolLicense';
29811
+ const origin = `${this.id}-${meth}`;
29812
+ log.trace(origin);
29813
+
29814
+ if (this.suspended && this.suspendMode === 'error') {
29815
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
29816
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29817
+ return callback(null, errorObj);
29818
+ }
29819
+
29820
+ /* HERE IS WHERE YOU VALIDATE DATA */
29821
+ if (uuid === undefined || uuid === null || uuid === '') {
29822
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uuid'], null, null, null);
29823
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29824
+ return callback(null, errorObj);
29825
+ }
29826
+
29827
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
29828
+ const queryParamsAvailable = {};
29829
+ const queryParams = {};
29830
+ const pathVars = [uuid];
29831
+ const bodyVars = {};
29832
+
29833
+ // loop in template. long callback arg name to avoid identifier conflicts
29834
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
29835
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
29836
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
29837
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
29838
+ }
29839
+ });
29840
+
29841
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
29842
+ // see adapter code documentation for more information on the request object's fields
29843
+ const reqObj = {
29844
+ payload: bodyVars,
29845
+ uriPathVars: pathVars,
29846
+ uriQuery: queryParams
29847
+ };
29848
+
29849
+ try {
29850
+ // Make the call -
29851
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
29852
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'deletePurchasedPoolLicense', reqObj, false, (irReturnData, irReturnError) => {
29853
+ // if we received an error or their is no response on the results
29854
+ // return an error
29855
+ if (irReturnError) {
29856
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
29857
+ return callback(null, irReturnError);
29858
+ }
29859
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
29860
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deletePurchasedPoolLicense'], null, null, null);
29861
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29862
+ return callback(null, errorObj);
29863
+ }
29864
+
29865
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
29866
+ // return the response
29867
+ return callback(irReturnData, null);
29868
+ });
29869
+ } catch (ex) {
29870
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
29871
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29872
+ return callback(null, errorObj);
29873
+ }
29874
+ }
29875
+
29876
+ /**
29877
+ * @function assignOrRevokeLicense
29878
+ * @pronghornType method
29879
+ * @name assignOrRevokeLicense
29880
+ * @summary Assign or revoke a pool license to a managed device
29881
+ *
29882
+ * @param {object} body - Body to assign or revoke license
29883
+ * @param {getCallback} callback - a callback function to return the result
29884
+ * @return {object} results - An object containing the response of the action
29885
+ *
29886
+ * @route {POST} /assignOrRevokeLicense
29887
+ * @roles admin
29888
+ * @task true
29889
+ */
29890
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
29891
+ assignOrRevokeLicense(body, callback) {
29892
+ const meth = 'adapter-assignOrRevokeLicense';
29893
+ const origin = `${this.id}-${meth}`;
29894
+ log.trace(origin);
29895
+
29896
+ if (this.suspended && this.suspendMode === 'error') {
29897
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
29898
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29899
+ return callback(null, errorObj);
29900
+ }
29901
+
29902
+ /* HERE IS WHERE YOU VALIDATE DATA */
29903
+ if (body === undefined || body === null || body === '') {
29904
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
29905
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29906
+ return callback(null, errorObj);
29907
+ }
29908
+
29909
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
29910
+ const queryParamsAvailable = {};
29911
+ const queryParams = {};
29912
+ const pathVars = [];
29913
+ const bodyVars = body;
29914
+
29915
+ // loop in template. long callback arg name to avoid identifier conflicts
29916
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
29917
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
29918
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
29919
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
29920
+ }
29921
+ });
29922
+
29923
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
29924
+ // see adapter code documentation for more information on the request object's fields
29925
+ const reqObj = {
29926
+ payload: bodyVars,
29927
+ uriPathVars: pathVars,
29928
+ uriQuery: queryParams
29929
+ };
29930
+
29931
+ try {
29932
+ // Make the call -
29933
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
29934
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'assignOrRevokeLicense', reqObj, true, (irReturnData, irReturnError) => {
29935
+ // if we received an error or their is no response on the results
29936
+ // return an error
29937
+ if (irReturnError) {
29938
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
29939
+ return callback(null, irReturnError);
29940
+ }
29941
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
29942
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['assignOrRevokeLicense'], null, null, null);
29943
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29944
+ return callback(null, errorObj);
29945
+ }
29946
+
29947
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
29948
+ // return the response
29949
+ return callback(irReturnData, null);
29950
+ });
29951
+ } catch (ex) {
29952
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
29953
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29954
+ return callback(null, errorObj);
29955
+ }
29956
+ }
29957
+
29958
+ /**
29959
+ * @function pollTaskForCompletion
29960
+ * @pronghornType method
29961
+ * @name pollTaskForCompletion
29962
+ * @summary Pool assign or revoke license task for completion.
29963
+ *
29964
+ * @param {string} uuid - uuid param
29965
+ * @param {getCallback} callback - a callback function to return the result
29966
+ * @return {object} results - An object containing the response of the action
29967
+ *
29968
+ * @route {POST} /pollTaskForCompletion
29969
+ * @roles admin
29970
+ * @task true
29971
+ */
29972
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
29973
+ pollTaskForCompletion(uuid, callback) {
29974
+ const meth = 'adapter-pollTaskForCompletion';
29975
+ const origin = `${this.id}-${meth}`;
29976
+ log.trace(origin);
29977
+
29978
+ if (this.suspended && this.suspendMode === 'error') {
29979
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
29980
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29981
+ return callback(null, errorObj);
29982
+ }
29983
+
29984
+ /* HERE IS WHERE YOU VALIDATE DATA */
29985
+ if (uuid === undefined || uuid === null || uuid === '') {
29986
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uuid'], null, null, null);
29987
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
29988
+ return callback(null, errorObj);
29989
+ }
29990
+
29991
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
29992
+ const queryParamsAvailable = {};
29993
+ const queryParams = {};
29994
+ const pathVars = [uuid];
29995
+ const bodyVars = {};
29996
+
29997
+ // loop in template. long callback arg name to avoid identifier conflicts
29998
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
29999
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
30000
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
30001
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
30002
+ }
30003
+ });
30004
+
30005
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
30006
+ // see adapter code documentation for more information on the request object's fields
30007
+ const reqObj = {
30008
+ payload: bodyVars,
30009
+ uriPathVars: pathVars,
30010
+ uriQuery: queryParams
30011
+ };
30012
+
30013
+ try {
30014
+ // Make the call -
30015
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
30016
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'pollTaskForCompletion', reqObj, true, (irReturnData, irReturnError) => {
30017
+ // if we received an error or their is no response on the results
30018
+ // return an error
30019
+ if (irReturnError) {
30020
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
30021
+ return callback(null, irReturnError);
30022
+ }
30023
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
30024
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['pollTaskForCompletion'], null, null, null);
30025
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30026
+ return callback(null, errorObj);
30027
+ }
30028
+
30029
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
30030
+ // return the response
30031
+ return callback(irReturnData, null);
30032
+ });
30033
+ } catch (ex) {
30034
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
30035
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30036
+ return callback(null, errorObj);
30037
+ }
30038
+ }
30039
+
30040
+ /**
30041
+ * @function viewOutstandingAssignments
30042
+ * @pronghornType method
30043
+ * @name viewOutstandingAssignments
30044
+ * @summary View outstanding assignments.
30045
+ *
30046
+ * @param {getCallback} callback - a callback function to return the result
30047
+ * @return {object} results - An object containing the response of the action
30048
+ *
30049
+ * @route {GET} /viewOutstandingAssignments
30050
+ * @roles admin
30051
+ * @task true
30052
+ */
30053
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
30054
+ viewOutstandingAssignments(callback) {
30055
+ const meth = 'adapter-viewOutstandingAssignments';
30056
+ const origin = `${this.id}-${meth}`;
30057
+ log.trace(origin);
30058
+
30059
+ if (this.suspended && this.suspendMode === 'error') {
30060
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
30061
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30062
+ return callback(null, errorObj);
30063
+ }
30064
+
30065
+ /* HERE IS WHERE YOU VALIDATE DATA */
30066
+
30067
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
30068
+ const queryParamsAvailable = {};
30069
+ const queryParams = {};
30070
+ const pathVars = [];
30071
+ const bodyVars = {};
30072
+
30073
+ // loop in template. long callback arg name to avoid identifier conflicts
30074
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
30075
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
30076
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
30077
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
30078
+ }
30079
+ });
30080
+
30081
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
30082
+ // see adapter code documentation for more information on the request object's fields
30083
+ const reqObj = {
30084
+ payload: bodyVars,
30085
+ uriPathVars: pathVars,
30086
+ uriQuery: queryParams
30087
+ };
30088
+
30089
+ try {
30090
+ // Make the call -
30091
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
30092
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'viewOutstandingAssignments', reqObj, true, (irReturnData, irReturnError) => {
30093
+ // if we received an error or their is no response on the results
30094
+ // return an error
30095
+ if (irReturnError) {
30096
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
30097
+ return callback(null, irReturnError);
30098
+ }
30099
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
30100
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['viewOutstandingAssignments'], null, null, null);
30101
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30102
+ return callback(null, errorObj);
30103
+ }
30104
+
30105
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
30106
+ // return the response
30107
+ return callback(irReturnData, null);
30108
+ });
30109
+ } catch (ex) {
30110
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
30111
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30112
+ return callback(null, errorObj);
30113
+ }
30114
+ }
30115
+
30116
+ /**
30117
+ * @function queryExistingPurchasedLicenses
30118
+ * @pronghornType method
30119
+ * @name queryExistingPurchasedLicenses
30120
+ * @summary Query existing purchased pool licenses.
30121
+ *
30122
+ * @param {getCallback} callback - a callback function to return the result
30123
+ * @return {object} results - An object containing the response of the action
30124
+ *
30125
+ * @route {GET} /queryExistingPurchasedLicenses
30126
+ * @roles admin
30127
+ * @task true
30128
+ */
30129
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
30130
+ queryExistingPurchasedLicenses(callback) {
30131
+ const meth = 'adapter-queryExistingPurchasedLicenses';
30132
+ const origin = `${this.id}-${meth}`;
30133
+ log.trace(origin);
30134
+
30135
+ if (this.suspended && this.suspendMode === 'error') {
30136
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
30137
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30138
+ return callback(null, errorObj);
30139
+ }
30140
+
30141
+ /* HERE IS WHERE YOU VALIDATE DATA */
30142
+
30143
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
30144
+ const queryParamsAvailable = {};
30145
+ const queryParams = {};
30146
+ const pathVars = [];
30147
+ const bodyVars = {};
30148
+
30149
+ // loop in template. long callback arg name to avoid identifier conflicts
30150
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
30151
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
30152
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
30153
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
30154
+ }
30155
+ });
30156
+
30157
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
30158
+ // see adapter code documentation for more information on the request object's fields
30159
+ const reqObj = {
30160
+ payload: bodyVars,
30161
+ uriPathVars: pathVars,
30162
+ uriQuery: queryParams
30163
+ };
30164
+
30165
+ try {
30166
+ // Make the call -
30167
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
30168
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'queryExistingPurchasedLicenses', reqObj, true, (irReturnData, irReturnError) => {
30169
+ // if we received an error or their is no response on the results
30170
+ // return an error
30171
+ if (irReturnError) {
30172
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
30173
+ return callback(null, irReturnError);
30174
+ }
30175
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
30176
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['queryExistingPurchasedLicenses'], null, null, null);
30177
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30178
+ return callback(null, errorObj);
30179
+ }
30180
+
30181
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
30182
+ // return the response
30183
+ return callback(irReturnData, null);
30184
+ });
30185
+ } catch (ex) {
30186
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
30187
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30188
+ return callback(null, errorObj);
30189
+ }
30190
+ }
30191
+
30192
+ /**
30193
+ * @function activateNewPurchasedPoolLicense
30194
+ * @pronghornType method
30195
+ * @name activateNewPurchasedPoolLicense
30196
+ * @summary Activate a purchased pool license
30197
+ *
30198
+ * @param {object} body - Body with registration key, name and method
30199
+ * @param {getCallback} callback - a callback function to return the result
30200
+ * @return {object} results - An object containing the response of the action
30201
+ *
30202
+ * @route {POST} /activateNewPurchasedPoolLicense
30203
+ * @roles admin
30204
+ * @task true
30205
+ */
30206
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
30207
+ activateNewPurchasedPoolLicense(body, callback) {
30208
+ const meth = 'adapter-activateNewPurchasedPoolLicense';
30209
+ const origin = `${this.id}-${meth}`;
30210
+ log.trace(origin);
30211
+
30212
+ if (this.suspended && this.suspendMode === 'error') {
30213
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
30214
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30215
+ return callback(null, errorObj);
30216
+ }
30217
+
30218
+ /* HERE IS WHERE YOU VALIDATE DATA */
30219
+ if (body === undefined || body === null || body === '') {
30220
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
30221
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30222
+ return callback(null, errorObj);
30223
+ }
30224
+
30225
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
30226
+ const queryParamsAvailable = {};
30227
+ const queryParams = {};
30228
+ const pathVars = [];
30229
+ const bodyVars = body;
30230
+
30231
+ // loop in template. long callback arg name to avoid identifier conflicts
30232
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
30233
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
30234
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
30235
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
30236
+ }
30237
+ });
30238
+
30239
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
30240
+ // see adapter code documentation for more information on the request object's fields
30241
+ const reqObj = {
30242
+ payload: bodyVars,
30243
+ uriPathVars: pathVars,
30244
+ uriQuery: queryParams
30245
+ };
30246
+
30247
+ try {
30248
+ // Make the call -
30249
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
30250
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'activateNewPurchasedPoolLicense', reqObj, true, (irReturnData, irReturnError) => {
30251
+ // if we received an error or their is no response on the results
30252
+ // return an error
30253
+ if (irReturnError) {
30254
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
30255
+ return callback(null, irReturnError);
30256
+ }
30257
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
30258
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['activateNewPurchasedPoolLicense'], null, null, null);
30259
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30260
+ return callback(null, errorObj);
30261
+ }
30262
+
30263
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
30264
+ // return the response
30265
+ return callback(irReturnData, null);
30266
+ });
30267
+ } catch (ex) {
30268
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
30269
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30270
+ return callback(null, errorObj);
30271
+ }
30272
+ }
30273
+
30274
+ /**
30275
+ * @function queryPurchasedPoolLicenseAssignments
30276
+ * @pronghornType method
30277
+ * @name queryPurchasedPoolLicenseAssignments
30278
+ * @summary Query assignments for a purchased pool license.
30279
+ *
30280
+ * @param {string} uuid - uuid param
30281
+ * @param {getCallback} callback - a callback function to return the result
30282
+ * @return {object} results - An object containing the response of the action
30283
+ *
30284
+ * @route {POST} /queryPurchasedPoolLicenseAssignments
30285
+ * @roles admin
30286
+ * @task true
30287
+ */
30288
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
30289
+ queryPurchasedPoolLicenseAssignments(uuid, callback) {
30290
+ const meth = 'adapter-queryPurchasedPoolLicenseAssignments';
30291
+ const origin = `${this.id}-${meth}`;
30292
+ log.trace(origin);
30293
+
30294
+ if (this.suspended && this.suspendMode === 'error') {
30295
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
30296
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30297
+ return callback(null, errorObj);
30298
+ }
30299
+
30300
+ /* HERE IS WHERE YOU VALIDATE DATA */
30301
+ if (uuid === undefined || uuid === null || uuid === '') {
30302
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uuid'], null, null, null);
30303
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30304
+ return callback(null, errorObj);
30305
+ }
30306
+
30307
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
30308
+ const queryParamsAvailable = {};
30309
+ const queryParams = {};
30310
+ const pathVars = [uuid];
30311
+ const bodyVars = {};
30312
+
30313
+ // loop in template. long callback arg name to avoid identifier conflicts
30314
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
30315
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
30316
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
30317
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
30318
+ }
30319
+ });
30320
+
30321
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
30322
+ // see adapter code documentation for more information on the request object's fields
30323
+ const reqObj = {
30324
+ payload: bodyVars,
30325
+ uriPathVars: pathVars,
30326
+ uriQuery: queryParams
30327
+ };
30328
+
30329
+ try {
30330
+ // Make the call -
30331
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
30332
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'queryPurchasedPoolLicenseAssignments', reqObj, true, (irReturnData, irReturnError) => {
30333
+ // if we received an error or their is no response on the results
30334
+ // return an error
30335
+ if (irReturnError) {
30336
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
30337
+ return callback(null, irReturnError);
30338
+ }
30339
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
30340
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['queryPurchasedPoolLicenseAssignments'], null, null, null);
30341
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30342
+ return callback(null, errorObj);
30343
+ }
30344
+
30345
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
30346
+ // return the response
30347
+ return callback(irReturnData, null);
30348
+ });
30349
+ } catch (ex) {
30350
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
30351
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30352
+ return callback(null, errorObj);
30353
+ }
30354
+ }
30355
+
30356
+ /**
30357
+ * @function assignPurchasedPoolLicenseMembers
30358
+ * @pronghornType method
30359
+ * @name assignPurchasedPoolLicenseMembers
30360
+ * @summary Assign license to managed device
30361
+ *
30362
+ * @param {string} uuid - uuid param
30363
+ * @param {object} body - Body containing device reference or details
30364
+ * @param {getCallback} callback - a callback function to return the result
30365
+ * @return {object} results - An object containing the response of the action
30366
+ *
30367
+ * @route {POST} /assignPurchasedPoolLicenseMembers
30368
+ * @roles admin
30369
+ * @task true
30370
+ */
30371
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
30372
+ assignPurchasedPoolLicenseMembers(uuid, body, callback) {
30373
+ const meth = 'adapter-assignPurchasedPoolLicenseMembers';
30374
+ const origin = `${this.id}-${meth}`;
30375
+ log.trace(origin);
30376
+
30377
+ if (this.suspended && this.suspendMode === 'error') {
30378
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
30379
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30380
+ return callback(null, errorObj);
30381
+ }
30382
+
30383
+ /* HERE IS WHERE YOU VALIDATE DATA */
30384
+ if (uuid === undefined || uuid === null || uuid === '') {
30385
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uuid'], null, null, null);
30386
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30387
+ return callback(null, errorObj);
30388
+ }
30389
+ if (body === undefined || body === null || body === '') {
30390
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
30391
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30392
+ return callback(null, errorObj);
30393
+ }
30394
+
30395
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
30396
+ const queryParamsAvailable = {};
30397
+ const queryParams = {};
30398
+ const pathVars = [uuid];
30399
+ const bodyVars = body;
30400
+
30401
+ // loop in template. long callback arg name to avoid identifier conflicts
30402
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
30403
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
30404
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
30405
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
30406
+ }
30407
+ });
30408
+
30409
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
30410
+ // see adapter code documentation for more information on the request object's fields
30411
+ const reqObj = {
30412
+ payload: bodyVars,
30413
+ uriPathVars: pathVars,
30414
+ uriQuery: queryParams
30415
+ };
30416
+
30417
+ try {
30418
+ // Make the call -
30419
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
30420
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'assignPurchasedPoolLicenseMembers', reqObj, true, (irReturnData, irReturnError) => {
30421
+ // if we received an error or their is no response on the results
30422
+ // return an error
30423
+ if (irReturnError) {
30424
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
30425
+ return callback(null, irReturnError);
30426
+ }
30427
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
30428
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['assignPurchasedPoolLicenseMembers'], null, null, null);
30429
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30430
+ return callback(null, errorObj);
30431
+ }
30432
+
30433
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
30434
+ // return the response
30435
+ return callback(irReturnData, null);
30436
+ });
30437
+ } catch (ex) {
30438
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
30439
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30440
+ return callback(null, errorObj);
30441
+ }
30442
+ }
30443
+
30444
+ /**
30445
+ * @function queryPurchasedPoolLicenseAssignmentStatus
30446
+ * @pronghornType method
30447
+ * @name queryPurchasedPoolLicenseAssignmentStatus
30448
+ * @summary Query license assignment status.
30449
+ *
30450
+ * @param {string} uuid - License uuid
30451
+ * @param {string} memberUuid - Member uuid
30452
+ * @param {getCallback} callback - a callback function to return the result
30453
+ * @return {object} results - An object containing the response of the action
30454
+ *
30455
+ * @route {POST} /queryPurchasedPoolLicenseAssignmentStatus
30456
+ * @roles admin
30457
+ * @task true
30458
+ */
30459
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
30460
+ queryPurchasedPoolLicenseAssignmentStatus(uuid, memberUuid, callback) {
30461
+ const meth = 'adapter-queryPurchasedPoolLicenseAssignmentStatus';
30462
+ const origin = `${this.id}-${meth}`;
30463
+ log.trace(origin);
30464
+
30465
+ if (this.suspended && this.suspendMode === 'error') {
30466
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
30467
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30468
+ return callback(null, errorObj);
30469
+ }
30470
+
30471
+ /* HERE IS WHERE YOU VALIDATE DATA */
30472
+ if (uuid === undefined || uuid === null || uuid === '') {
30473
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uuid'], null, null, null);
30474
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30475
+ return callback(null, errorObj);
30476
+ }
30477
+ if (memberUuid === undefined || memberUuid === null || memberUuid === '') {
30478
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['memberUuid'], null, null, null);
30479
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30480
+ return callback(null, errorObj);
30481
+ }
30482
+
30483
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
30484
+ const queryParamsAvailable = {};
30485
+ const queryParams = {};
30486
+ const pathVars = [uuid, memberUuid];
30487
+ const bodyVars = {};
30488
+
30489
+ // loop in template. long callback arg name to avoid identifier conflicts
30490
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
30491
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
30492
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
30493
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
30494
+ }
30495
+ });
30496
+
30497
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
30498
+ // see adapter code documentation for more information on the request object's fields
30499
+ const reqObj = {
30500
+ payload: bodyVars,
30501
+ uriPathVars: pathVars,
30502
+ uriQuery: queryParams
30503
+ };
30504
+
30505
+ try {
30506
+ // Make the call -
30507
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
30508
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'queryPurchasedPoolLicenseAssignmentStatus', reqObj, true, (irReturnData, irReturnError) => {
30509
+ // if we received an error or their is no response on the results
30510
+ // return an error
30511
+ if (irReturnError) {
30512
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
30513
+ return callback(null, irReturnError);
30514
+ }
30515
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
30516
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['queryPurchasedPoolLicenseAssignmentStatus'], null, null, null);
30517
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30518
+ return callback(null, errorObj);
30519
+ }
30520
+
30521
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
30522
+ // return the response
30523
+ return callback(irReturnData, null);
30524
+ });
30525
+ } catch (ex) {
30526
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
30527
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30528
+ return callback(null, errorObj);
30529
+ }
30530
+ }
30531
+
30532
+ /**
30533
+ * @function refreshPurchasedPoolLicenseOnBigIPDevice
30534
+ * @pronghornType method
30535
+ * @name refreshPurchasedPoolLicenseOnBigIPDevice
30536
+ * @summary Refresh the license on a BIG-IP device
30537
+ *
30538
+ * @param {string} uuid - uuid param
30539
+ * @param {string} memberUuid - Member uuid
30540
+ * @param {object} body - Body including state and optional creds
30541
+ * @param {getCallback} callback - a callback function to return the result
30542
+ * @return {object} results - An object containing the response of the action
30543
+ *
30544
+ * @route {POST} /refreshPurchasedPoolLicenseOnBigIPDevice
30545
+ * @roles admin
30546
+ * @task true
30547
+ */
30548
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
30549
+ refreshPurchasedPoolLicenseOnBigIPDevice(uuid, memberUuid, body, callback) {
30550
+ const meth = 'adapter-refreshPurchasedPoolLicenseOnBigIPDevice';
30551
+ const origin = `${this.id}-${meth}`;
30552
+ log.trace(origin);
30553
+
30554
+ if (this.suspended && this.suspendMode === 'error') {
30555
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
30556
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30557
+ return callback(null, errorObj);
30558
+ }
30559
+
30560
+ /* HERE IS WHERE YOU VALIDATE DATA */
30561
+ if (uuid === undefined || uuid === null || uuid === '') {
30562
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uuid'], null, null, null);
30563
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30564
+ return callback(null, errorObj);
30565
+ }
30566
+ if (memberUuid === undefined || memberUuid === null || memberUuid === '') {
30567
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['memberUuid'], null, null, null);
30568
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30569
+ return callback(null, errorObj);
30570
+ }
30571
+ if (body === undefined || body === null || body === '') {
30572
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
30573
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30574
+ return callback(null, errorObj);
30575
+ }
30576
+
30577
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
30578
+ const queryParamsAvailable = {};
30579
+ const queryParams = {};
30580
+ const pathVars = [uuid, memberUuid];
30581
+ const bodyVars = body;
30582
+
30583
+ // loop in template. long callback arg name to avoid identifier conflicts
30584
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
30585
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
30586
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
30587
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
30588
+ }
30589
+ });
30590
+
30591
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
30592
+ // see adapter code documentation for more information on the request object's fields
30593
+ const reqObj = {
30594
+ payload: bodyVars,
30595
+ uriPathVars: pathVars,
30596
+ uriQuery: queryParams
30597
+ };
30598
+
30599
+ try {
30600
+ // Make the call -
30601
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
30602
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'refreshPurchasedPoolLicenseOnBigIPDevice', reqObj, false, (irReturnData, irReturnError) => {
30603
+ // if we received an error or their is no response on the results
30604
+ // return an error
30605
+ if (irReturnError) {
30606
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
30607
+ return callback(null, irReturnError);
30608
+ }
30609
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
30610
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['refreshPurchasedPoolLicenseOnBigIPDevice'], null, null, null);
30611
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30612
+ return callback(null, errorObj);
30613
+ }
30614
+
30615
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
30616
+ // return the response
30617
+ return callback(irReturnData, null);
30618
+ });
30619
+ } catch (ex) {
30620
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
30621
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30622
+ return callback(null, errorObj);
30623
+ }
30624
+ }
30625
+
30626
+ /**
30627
+ * @function revokeAPurchasedPoolLicense
30628
+ * @pronghornType method
30629
+ * @name revokeAPurchasedPoolLicense
30630
+ * @summary Revoke a license from a device.
30631
+ *
30632
+ * @param {string} uuid - uuid param
30633
+ * @param {string} memberUuid - Member uuid
30634
+ * @param {getCallback} callback - a callback function to return the result
30635
+ * @return {object} results - An object containing the response of the action
30636
+ *
30637
+ * @route {POST} /revokeAPurchasedPoolLicense
30638
+ * @roles admin
30639
+ * @task true
30640
+ */
30641
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
30642
+ revokeAPurchasedPoolLicense(uuid, memberUuid, callback) {
30643
+ const meth = 'adapter-revokeAPurchasedPoolLicense';
30644
+ const origin = `${this.id}-${meth}`;
30645
+ log.trace(origin);
30646
+
30647
+ if (this.suspended && this.suspendMode === 'error') {
30648
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
30649
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30650
+ return callback(null, errorObj);
30651
+ }
30652
+
30653
+ /* HERE IS WHERE YOU VALIDATE DATA */
30654
+ if (uuid === undefined || uuid === null || uuid === '') {
30655
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uuid'], null, null, null);
30656
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30657
+ return callback(null, errorObj);
30658
+ }
30659
+ if (memberUuid === undefined || memberUuid === null || memberUuid === '') {
30660
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['memberUuid'], null, null, null);
30661
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30662
+ return callback(null, errorObj);
30663
+ }
30664
+
30665
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
30666
+ const queryParamsAvailable = {};
30667
+ const queryParams = {};
30668
+ const pathVars = [uuid, memberUuid];
30669
+ const bodyVars = {};
30670
+
30671
+ // loop in template. long callback arg name to avoid identifier conflicts
30672
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
30673
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
30674
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
30675
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
30676
+ }
30677
+ });
30678
+
30679
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
30680
+ // see adapter code documentation for more information on the request object's fields
30681
+ const reqObj = {
30682
+ payload: bodyVars,
30683
+ uriPathVars: pathVars,
30684
+ uriQuery: queryParams
30685
+ };
30686
+
30687
+ try {
30688
+ // Make the call -
30689
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
30690
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'revokeAPurchasedPoolLicense', reqObj, false, (irReturnData, irReturnError) => {
30691
+ // if we received an error or their is no response on the results
30692
+ // return an error
30693
+ if (irReturnError) {
30694
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
30695
+ return callback(null, irReturnError);
30696
+ }
30697
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
30698
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['revokeAPurchasedPoolLicense'], null, null, null);
30699
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30700
+ return callback(null, errorObj);
30701
+ }
30702
+
30703
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
30704
+ // return the response
30705
+ return callback(irReturnData, null);
30706
+ });
30707
+ } catch (ex) {
30708
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
30709
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30710
+ return callback(null, errorObj);
30711
+ }
30712
+ }
30713
+
30714
+ /**
30715
+ * @function queryExistingRegKeyPools
30716
+ * @pronghornType method
30717
+ * @name queryExistingRegKeyPools
30718
+ * @summary Query existing RegKey Pools.
30719
+ *
30720
+ * @param {getCallback} callback - a callback function to return the result
30721
+ * @return {object} results - An object containing the response of the action
30722
+ *
30723
+ * @route {GET} /queryExistingRegKeyPools
30724
+ * @roles admin
30725
+ * @task true
30726
+ */
30727
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
30728
+ queryExistingRegKeyPools(callback) {
30729
+ const meth = 'adapter-queryExistingRegKeyPools';
30730
+ const origin = `${this.id}-${meth}`;
30731
+ log.trace(origin);
30732
+
30733
+ if (this.suspended && this.suspendMode === 'error') {
30734
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
30735
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30736
+ return callback(null, errorObj);
30737
+ }
30738
+
30739
+ /* HERE IS WHERE YOU VALIDATE DATA */
30740
+
30741
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
30742
+ const queryParamsAvailable = {};
30743
+ const queryParams = {};
30744
+ const pathVars = [];
30745
+ const bodyVars = {};
30746
+
30747
+ // loop in template. long callback arg name to avoid identifier conflicts
30748
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
30749
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
30750
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
30751
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
30752
+ }
30753
+ });
30754
+
30755
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
30756
+ // see adapter code documentation for more information on the request object's fields
30757
+ const reqObj = {
30758
+ payload: bodyVars,
30759
+ uriPathVars: pathVars,
30760
+ uriQuery: queryParams
30761
+ };
30762
+
30763
+ try {
30764
+ // Make the call -
30765
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
30766
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'queryExistingRegKeyPools', reqObj, true, (irReturnData, irReturnError) => {
30767
+ // if we received an error or their is no response on the results
30768
+ // return an error
30769
+ if (irReturnError) {
30770
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
30771
+ return callback(null, irReturnError);
30772
+ }
30773
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
30774
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['queryExistingRegKeyPools'], null, null, null);
30775
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30776
+ return callback(null, errorObj);
30777
+ }
30778
+
30779
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
30780
+ // return the response
30781
+ return callback(irReturnData, null);
30782
+ });
30783
+ } catch (ex) {
30784
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
30785
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30786
+ return callback(null, errorObj);
30787
+ }
30788
+ }
30789
+
30790
+ /**
30791
+ * @function createRegKeyPool
30792
+ * @pronghornType method
30793
+ * @name createRegKeyPool
30794
+ * @summary Create a RegKey Pool
30795
+ *
30796
+ * @param {object} body - Body
30797
+ * @param {getCallback} callback - a callback function to return the result
30798
+ * @return {object} results - An object containing the response of the action
30799
+ *
30800
+ * @route {POST} /createRegKeyPool
30801
+ * @roles admin
30802
+ * @task true
30803
+ */
30804
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
30805
+ createRegKeyPool(body, callback) {
30806
+ const meth = 'adapter-createRegKeyPool';
30807
+ const origin = `${this.id}-${meth}`;
30808
+ log.trace(origin);
30809
+
30810
+ if (this.suspended && this.suspendMode === 'error') {
30811
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
30812
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30813
+ return callback(null, errorObj);
30814
+ }
30815
+
30816
+ /* HERE IS WHERE YOU VALIDATE DATA */
30817
+ if (body === undefined || body === null || body === '') {
30818
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
30819
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30820
+ return callback(null, errorObj);
30821
+ }
30822
+
30823
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
30824
+ const queryParamsAvailable = {};
30825
+ const queryParams = {};
30826
+ const pathVars = [];
30827
+ const bodyVars = body;
30828
+
30829
+ // loop in template. long callback arg name to avoid identifier conflicts
30830
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
30831
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
30832
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
30833
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
30834
+ }
30835
+ });
30836
+
30837
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
30838
+ // see adapter code documentation for more information on the request object's fields
30839
+ const reqObj = {
30840
+ payload: bodyVars,
30841
+ uriPathVars: pathVars,
30842
+ uriQuery: queryParams
30843
+ };
30844
+
30845
+ try {
30846
+ // Make the call -
30847
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
30848
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'createRegKeyPool', reqObj, true, (irReturnData, irReturnError) => {
30849
+ // if we received an error or their is no response on the results
30850
+ // return an error
30851
+ if (irReturnError) {
30852
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
30853
+ return callback(null, irReturnError);
30854
+ }
30855
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
30856
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createRegKeyPool'], null, null, null);
30857
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30858
+ return callback(null, errorObj);
30859
+ }
30860
+
30861
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
30862
+ // return the response
30863
+ return callback(irReturnData, null);
30864
+ });
30865
+ } catch (ex) {
30866
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
30867
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30868
+ return callback(null, errorObj);
30869
+ }
30870
+ }
30871
+
30872
+ /**
30873
+ * @function updateRegKeyPool
30874
+ * @pronghornType method
30875
+ * @name updateRegKeyPool
30876
+ * @summary Update a RegKey Pool to change name and/or description
30877
+ *
30878
+ * @param {string} id - RegKey Pool ID
30879
+ * @param {object} body - Body
30880
+ * @param {getCallback} callback - a callback function to return the result
30881
+ * @return {object} results - An object containing the response of the action
30882
+ *
30883
+ * @route {POST} /updateRegKeyPool
30884
+ * @roles admin
30885
+ * @task true
30886
+ */
30887
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
30888
+ updateRegKeyPool(id, body, callback) {
30889
+ const meth = 'adapter-updateRegKeyPool';
30890
+ const origin = `${this.id}-${meth}`;
30891
+ log.trace(origin);
30892
+
30893
+ if (this.suspended && this.suspendMode === 'error') {
30894
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
30895
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30896
+ return callback(null, errorObj);
30897
+ }
30898
+
30899
+ /* HERE IS WHERE YOU VALIDATE DATA */
30900
+ if (id === undefined || id === null || id === '') {
30901
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
30902
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30903
+ return callback(null, errorObj);
30904
+ }
30905
+ if (body === undefined || body === null || body === '') {
30906
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
30907
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30908
+ return callback(null, errorObj);
30909
+ }
30910
+
30911
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
30912
+ const queryParamsAvailable = {};
30913
+ const queryParams = {};
30914
+ const pathVars = [id];
30915
+ const bodyVars = body;
30916
+
30917
+ // loop in template. long callback arg name to avoid identifier conflicts
30918
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
30919
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
30920
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
30921
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
30922
+ }
30923
+ });
30924
+
30925
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
30926
+ // see adapter code documentation for more information on the request object's fields
30927
+ const reqObj = {
30928
+ payload: bodyVars,
30929
+ uriPathVars: pathVars,
30930
+ uriQuery: queryParams
30931
+ };
30932
+
30933
+ try {
30934
+ // Make the call -
30935
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
30936
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'updateRegKeyPool', reqObj, false, (irReturnData, irReturnError) => {
30937
+ // if we received an error or their is no response on the results
30938
+ // return an error
30939
+ if (irReturnError) {
30940
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
30941
+ return callback(null, irReturnError);
30942
+ }
30943
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
30944
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['updateRegKeyPool'], null, null, null);
30945
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30946
+ return callback(null, errorObj);
30947
+ }
30948
+
30949
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
30950
+ // return the response
30951
+ return callback(irReturnData, null);
30952
+ });
30953
+ } catch (ex) {
30954
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
30955
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30956
+ return callback(null, errorObj);
30957
+ }
30958
+ }
30959
+
30960
+ /**
30961
+ * @function removeRegKeyPool
30962
+ * @pronghornType method
30963
+ * @name removeRegKeyPool
30964
+ * @summary Remove a RegKey Pool
30965
+ *
30966
+ * @param {string} id - RegKey Pool ID
30967
+ * @param {getCallback} callback - a callback function to return the result
30968
+ * @return {object} results - An object containing the response of the action
30969
+ *
30970
+ * @route {POST} /removeRegKeyPool
30971
+ * @roles admin
30972
+ * @task true
30973
+ */
30974
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
30975
+ removeRegKeyPool(id, callback) {
30976
+ const meth = 'adapter-removeRegKeyPool';
30977
+ const origin = `${this.id}-${meth}`;
30978
+ log.trace(origin);
30979
+
30980
+ if (this.suspended && this.suspendMode === 'error') {
30981
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
30982
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30983
+ return callback(null, errorObj);
30984
+ }
30985
+
30986
+ /* HERE IS WHERE YOU VALIDATE DATA */
30987
+ if (id === undefined || id === null || id === '') {
30988
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
30989
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
30990
+ return callback(null, errorObj);
30991
+ }
30992
+
30993
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
30994
+ const queryParamsAvailable = {};
30995
+ const queryParams = {};
30996
+ const pathVars = [id];
30997
+ const bodyVars = {};
30998
+
30999
+ // loop in template. long callback arg name to avoid identifier conflicts
31000
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
31001
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
31002
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
31003
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
31004
+ }
31005
+ });
31006
+
31007
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
31008
+ // see adapter code documentation for more information on the request object's fields
31009
+ const reqObj = {
31010
+ payload: bodyVars,
31011
+ uriPathVars: pathVars,
31012
+ uriQuery: queryParams
31013
+ };
31014
+
31015
+ try {
31016
+ // Make the call -
31017
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
31018
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'removeRegKeyPool', reqObj, false, (irReturnData, irReturnError) => {
31019
+ // if we received an error or their is no response on the results
31020
+ // return an error
31021
+ if (irReturnError) {
31022
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
31023
+ return callback(null, irReturnError);
31024
+ }
31025
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
31026
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['removeRegKeyPool'], null, null, null);
31027
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31028
+ return callback(null, errorObj);
31029
+ }
31030
+
31031
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
31032
+ // return the response
31033
+ return callback(irReturnData, null);
31034
+ });
31035
+ } catch (ex) {
31036
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
31037
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31038
+ return callback(null, errorObj);
31039
+ }
31040
+ }
31041
+
31042
+ /**
31043
+ * @function queryExistingLicenseKeysForRegKeyPool
31044
+ * @pronghornType method
31045
+ * @name queryExistingLicenseKeysForRegKeyPool
31046
+ * @summary Query existing license keys for a RegKey Pool.
31047
+ *
31048
+ * @param {string} id - RegKey Pool ID
31049
+ * @param {getCallback} callback - a callback function to return the result
31050
+ * @return {object} results - An object containing the response of the action
31051
+ *
31052
+ * @route {POST} /queryExistingLicenseKeysForRegKeyPool
31053
+ * @roles admin
31054
+ * @task true
31055
+ */
31056
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
31057
+ queryExistingLicenseKeysForRegKeyPool(id, callback) {
31058
+ const meth = 'adapter-queryExistingLicenseKeysForRegKeyPool';
31059
+ const origin = `${this.id}-${meth}`;
31060
+ log.trace(origin);
31061
+
31062
+ if (this.suspended && this.suspendMode === 'error') {
31063
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
31064
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31065
+ return callback(null, errorObj);
31066
+ }
31067
+
31068
+ /* HERE IS WHERE YOU VALIDATE DATA */
31069
+ if (id === undefined || id === null || id === '') {
31070
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
31071
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31072
+ return callback(null, errorObj);
31073
+ }
31074
+
31075
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
31076
+ const queryParamsAvailable = {};
31077
+ const queryParams = {};
31078
+ const pathVars = [id];
31079
+ const bodyVars = {};
31080
+
31081
+ // loop in template. long callback arg name to avoid identifier conflicts
31082
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
31083
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
31084
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
31085
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
31086
+ }
31087
+ });
31088
+
31089
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
31090
+ // see adapter code documentation for more information on the request object's fields
31091
+ const reqObj = {
31092
+ payload: bodyVars,
31093
+ uriPathVars: pathVars,
31094
+ uriQuery: queryParams
31095
+ };
31096
+
31097
+ try {
31098
+ // Make the call -
31099
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
31100
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'queryExistingLicenseKeysForRegKeyPool', reqObj, true, (irReturnData, irReturnError) => {
31101
+ // if we received an error or their is no response on the results
31102
+ // return an error
31103
+ if (irReturnError) {
31104
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
31105
+ return callback(null, irReturnError);
31106
+ }
31107
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
31108
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['queryExistingLicenseKeysForRegKeyPool'], null, null, null);
31109
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31110
+ return callback(null, errorObj);
31111
+ }
31112
+
31113
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
31114
+ // return the response
31115
+ return callback(irReturnData, null);
31116
+ });
31117
+ } catch (ex) {
31118
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
31119
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31120
+ return callback(null, errorObj);
31121
+ }
31122
+ }
31123
+
31124
+ /**
31125
+ * @function addLicenseKey
31126
+ * @pronghornType method
31127
+ * @name addLicenseKey
31128
+ * @summary Add a license key
31129
+ *
31130
+ * @param {string} id - RegKey Pool ID
31131
+ * @param {object} body - Body
31132
+ * @param {getCallback} callback - a callback function to return the result
31133
+ * @return {object} results - An object containing the response of the action
31134
+ *
31135
+ * @route {POST} /addLicenseKey
31136
+ * @roles admin
31137
+ * @task true
31138
+ */
31139
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
31140
+ addLicenseKey(id, body, callback) {
31141
+ const meth = 'adapter-addLicenseKey';
31142
+ const origin = `${this.id}-${meth}`;
31143
+ log.trace(origin);
31144
+
31145
+ if (this.suspended && this.suspendMode === 'error') {
31146
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
31147
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31148
+ return callback(null, errorObj);
31149
+ }
31150
+
31151
+ /* HERE IS WHERE YOU VALIDATE DATA */
31152
+ if (id === undefined || id === null || id === '') {
31153
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
31154
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31155
+ return callback(null, errorObj);
31156
+ }
31157
+ if (body === undefined || body === null || body === '') {
31158
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
31159
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31160
+ return callback(null, errorObj);
31161
+ }
31162
+
31163
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
31164
+ const queryParamsAvailable = {};
31165
+ const queryParams = {};
31166
+ const pathVars = [id];
31167
+ const bodyVars = body;
31168
+
31169
+ // loop in template. long callback arg name to avoid identifier conflicts
31170
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
31171
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
31172
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
31173
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
31174
+ }
31175
+ });
31176
+
31177
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
31178
+ // see adapter code documentation for more information on the request object's fields
31179
+ const reqObj = {
31180
+ payload: bodyVars,
31181
+ uriPathVars: pathVars,
31182
+ uriQuery: queryParams
31183
+ };
31184
+
31185
+ try {
31186
+ // Make the call -
31187
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
31188
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'addLicenseKey', reqObj, true, (irReturnData, irReturnError) => {
31189
+ // if we received an error or their is no response on the results
31190
+ // return an error
31191
+ if (irReturnError) {
31192
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
31193
+ return callback(null, irReturnError);
31194
+ }
31195
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
31196
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addLicenseKey'], null, null, null);
31197
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31198
+ return callback(null, errorObj);
31199
+ }
31200
+
31201
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
31202
+ // return the response
31203
+ return callback(irReturnData, null);
31204
+ });
31205
+ } catch (ex) {
31206
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
31207
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31208
+ return callback(null, errorObj);
31209
+ }
31210
+ }
31211
+
31212
+ /**
31213
+ * @function pollForRegKeyActivationStatus
31214
+ * @pronghornType method
31215
+ * @name pollForRegKeyActivationStatus
31216
+ * @summary Poll to get status
31217
+ *
31218
+ * @param {string} id - RegKey Pool ID
31219
+ * @param {string} regKey - RegKey
31220
+ * @param {getCallback} callback - a callback function to return the result
31221
+ * @return {object} results - An object containing the response of the action
31222
+ *
31223
+ * @route {POST} /pollForRegKeyActivationStatus
31224
+ * @roles admin
31225
+ * @task true
31226
+ */
31227
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
31228
+ pollForRegKeyActivationStatus(id, regKey, callback) {
31229
+ const meth = 'adapter-pollForRegKeyActivationStatus';
31230
+ const origin = `${this.id}-${meth}`;
31231
+ log.trace(origin);
31232
+
31233
+ if (this.suspended && this.suspendMode === 'error') {
31234
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
31235
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31236
+ return callback(null, errorObj);
31237
+ }
31238
+
31239
+ /* HERE IS WHERE YOU VALIDATE DATA */
31240
+ if (id === undefined || id === null || id === '') {
31241
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
31242
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31243
+ return callback(null, errorObj);
31244
+ }
31245
+ if (regKey === undefined || regKey === null || regKey === '') {
31246
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['regKey'], null, null, null);
31247
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31248
+ return callback(null, errorObj);
31249
+ }
31250
+
31251
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
31252
+ const queryParamsAvailable = {};
31253
+ const queryParams = {};
31254
+ const pathVars = [id, regKey];
31255
+ const bodyVars = {};
31256
+
31257
+ // loop in template. long callback arg name to avoid identifier conflicts
31258
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
31259
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
31260
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
31261
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
31262
+ }
31263
+ });
31264
+
31265
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
31266
+ // see adapter code documentation for more information on the request object's fields
31267
+ const reqObj = {
31268
+ payload: bodyVars,
31269
+ uriPathVars: pathVars,
31270
+ uriQuery: queryParams
31271
+ };
31272
+
31273
+ try {
31274
+ // Make the call -
31275
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
31276
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'pollForRegKeyActivationStatus', reqObj, true, (irReturnData, irReturnError) => {
31277
+ // if we received an error or their is no response on the results
31278
+ // return an error
31279
+ if (irReturnError) {
31280
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
31281
+ return callback(null, irReturnError);
31282
+ }
31283
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
31284
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['pollForRegKeyActivationStatus'], null, null, null);
31285
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31286
+ return callback(null, errorObj);
31287
+ }
31288
+
31289
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
31290
+ // return the response
31291
+ return callback(irReturnData, null);
31292
+ });
31293
+ } catch (ex) {
31294
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
31295
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31296
+ return callback(null, errorObj);
31297
+ }
31298
+ }
31299
+
31300
+ /**
31301
+ * @function completeRegKeyActivation
31302
+ * @pronghornType method
31303
+ * @name completeRegKeyActivation
31304
+ * @summary Complete or retry reg key activiation. May also reactivate a license with add-on keys.
31305
+ *
31306
+ * @param {string} id - RegKey Pool ID
31307
+ * @param {string} regKey - RegKey
31308
+ * @param {object} body - Body for manual or automatic activation
31309
+ * @param {getCallback} callback - a callback function to return the result
31310
+ * @return {object} results - An object containing the response of the action
31311
+ *
31312
+ * @route {POST} /completeRegKeyActivation
31313
+ * @roles admin
31314
+ * @task true
31315
+ */
31316
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
31317
+ completeRegKeyActivation(id, regKey, body, callback) {
31318
+ const meth = 'adapter-completeRegKeyActivation';
31319
+ const origin = `${this.id}-${meth}`;
31320
+ log.trace(origin);
31321
+
31322
+ if (this.suspended && this.suspendMode === 'error') {
31323
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
31324
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31325
+ return callback(null, errorObj);
31326
+ }
31327
+
31328
+ /* HERE IS WHERE YOU VALIDATE DATA */
31329
+ if (id === undefined || id === null || id === '') {
31330
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
31331
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31332
+ return callback(null, errorObj);
31333
+ }
31334
+ if (regKey === undefined || regKey === null || regKey === '') {
31335
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['regKey'], null, null, null);
31336
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31337
+ return callback(null, errorObj);
31338
+ }
31339
+ if (body === undefined || body === null || body === '') {
31340
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
31341
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31342
+ return callback(null, errorObj);
31343
+ }
31344
+
31345
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
31346
+ const queryParamsAvailable = {};
31347
+ const queryParams = {};
31348
+ const pathVars = [id, regKey];
31349
+ const bodyVars = body;
31350
+
31351
+ // loop in template. long callback arg name to avoid identifier conflicts
31352
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
31353
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
31354
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
31355
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
31356
+ }
31357
+ });
31358
+
31359
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
31360
+ // see adapter code documentation for more information on the request object's fields
31361
+ const reqObj = {
31362
+ payload: bodyVars,
31363
+ uriPathVars: pathVars,
31364
+ uriQuery: queryParams
31365
+ };
31366
+
31367
+ try {
31368
+ // Make the call -
31369
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
31370
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'completeRegKeyActivation', reqObj, false, (irReturnData, irReturnError) => {
31371
+ // if we received an error or their is no response on the results
31372
+ // return an error
31373
+ if (irReturnError) {
31374
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
31375
+ return callback(null, irReturnError);
31376
+ }
31377
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
31378
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['completeRegKeyActivation'], null, null, null);
31379
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31380
+ return callback(null, errorObj);
31381
+ }
31382
+
31383
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
31384
+ // return the response
31385
+ return callback(irReturnData, null);
31386
+ });
31387
+ } catch (ex) {
31388
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
31389
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31390
+ return callback(null, errorObj);
31391
+ }
31392
+ }
31393
+
31394
+ /**
31395
+ * @function deleteRegistrationKey
31396
+ * @pronghornType method
31397
+ * @name deleteRegistrationKey
31398
+ * @summary Delete a Registration key
31399
+ *
31400
+ * @param {string} id - RegKey Pool ID
31401
+ * @param {string} regKey - RegKey
31402
+ * @param {getCallback} callback - a callback function to return the result
31403
+ * @return {object} results - An object containing the response of the action
31404
+ *
31405
+ * @route {POST} /deleteRegistrationKey
31406
+ * @roles admin
31407
+ * @task true
31408
+ */
31409
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
31410
+ deleteRegistrationKey(id, regKey, callback) {
31411
+ const meth = 'adapter-deleteRegistrationKey';
31412
+ const origin = `${this.id}-${meth}`;
31413
+ log.trace(origin);
31414
+
31415
+ if (this.suspended && this.suspendMode === 'error') {
31416
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
31417
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31418
+ return callback(null, errorObj);
31419
+ }
31420
+
31421
+ /* HERE IS WHERE YOU VALIDATE DATA */
31422
+ if (id === undefined || id === null || id === '') {
31423
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
31424
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31425
+ return callback(null, errorObj);
31426
+ }
31427
+ if (regKey === undefined || regKey === null || regKey === '') {
31428
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['regKey'], null, null, null);
31429
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31430
+ return callback(null, errorObj);
31431
+ }
31432
+
31433
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
31434
+ const queryParamsAvailable = {};
31435
+ const queryParams = {};
31436
+ const pathVars = [id, regKey];
31437
+ const bodyVars = {};
31438
+
31439
+ // loop in template. long callback arg name to avoid identifier conflicts
31440
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
31441
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
31442
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
31443
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
31444
+ }
31445
+ });
31446
+
31447
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
31448
+ // see adapter code documentation for more information on the request object's fields
31449
+ const reqObj = {
31450
+ payload: bodyVars,
31451
+ uriPathVars: pathVars,
31452
+ uriQuery: queryParams
31453
+ };
31454
+
31455
+ try {
31456
+ // Make the call -
31457
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
31458
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'deleteRegistrationKey', reqObj, false, (irReturnData, irReturnError) => {
31459
+ // if we received an error or their is no response on the results
31460
+ // return an error
31461
+ if (irReturnError) {
31462
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
31463
+ return callback(null, irReturnError);
31464
+ }
31465
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
31466
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteRegistrationKey'], null, null, null);
31467
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31468
+ return callback(null, errorObj);
31469
+ }
31470
+
31471
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
31472
+ // return the response
31473
+ return callback(irReturnData, null);
31474
+ });
31475
+ } catch (ex) {
31476
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
31477
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31478
+ return callback(null, errorObj);
31479
+ }
31480
+ }
31481
+
31482
+ /**
31483
+ * @function getRegistrationKeyAssignment
31484
+ * @pronghornType method
31485
+ * @name getRegistrationKeyAssignment
31486
+ * @summary Get the assignment for a registration key in a RegKey Pool
31487
+ *
31488
+ * @param {string} id - RegKey Pool ID
31489
+ * @param {string} regKey - RegKey
31490
+ * @param {getCallback} callback - a callback function to return the result
31491
+ * @return {object} results - An object containing the response of the action
31492
+ *
31493
+ * @route {POST} /getRegistrationKeyAssignment
31494
+ * @roles admin
31495
+ * @task true
31496
+ */
31497
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
31498
+ getRegistrationKeyAssignment(id, regKey, callback) {
31499
+ const meth = 'adapter-getRegistrationKeyAssignment';
31500
+ const origin = `${this.id}-${meth}`;
31501
+ log.trace(origin);
31502
+
31503
+ if (this.suspended && this.suspendMode === 'error') {
31504
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
31505
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31506
+ return callback(null, errorObj);
31507
+ }
31508
+
31509
+ /* HERE IS WHERE YOU VALIDATE DATA */
31510
+ if (id === undefined || id === null || id === '') {
31511
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
31512
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31513
+ return callback(null, errorObj);
31514
+ }
31515
+ if (regKey === undefined || regKey === null || regKey === '') {
31516
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['regKey'], null, null, null);
31517
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31518
+ return callback(null, errorObj);
31519
+ }
31520
+
31521
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
31522
+ const queryParamsAvailable = {};
31523
+ const queryParams = {};
31524
+ const pathVars = [id, regKey];
31525
+ const bodyVars = {};
31526
+
31527
+ // loop in template. long callback arg name to avoid identifier conflicts
31528
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
31529
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
31530
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
31531
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
31532
+ }
31533
+ });
31534
+
31535
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
31536
+ // see adapter code documentation for more information on the request object's fields
31537
+ const reqObj = {
31538
+ payload: bodyVars,
31539
+ uriPathVars: pathVars,
31540
+ uriQuery: queryParams
31541
+ };
31542
+
31543
+ try {
31544
+ // Make the call -
31545
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
31546
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'getRegistrationKeyAssignment', reqObj, true, (irReturnData, irReturnError) => {
31547
+ // if we received an error or their is no response on the results
31548
+ // return an error
31549
+ if (irReturnError) {
31550
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
31551
+ return callback(null, irReturnError);
31552
+ }
31553
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
31554
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getRegistrationKeyAssignment'], null, null, null);
31555
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31556
+ return callback(null, errorObj);
31557
+ }
31558
+
31559
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
31560
+ // return the response
31561
+ return callback(irReturnData, null);
31562
+ });
31563
+ } catch (ex) {
31564
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
31565
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31566
+ return callback(null, errorObj);
31567
+ }
31568
+ }
31569
+
31570
+ /**
31571
+ * @function assignRegistrationKeyToDevice
31572
+ * @pronghornType method
31573
+ * @name assignRegistrationKeyToDevice
31574
+ * @summary Assign a license to a managed or unmanaged device
31575
+ *
31576
+ * @param {string} id - RegKey Pool ID
31577
+ * @param {string} regKey - RegKey
31578
+ * @param {object} body - Body
31579
+ * @param {getCallback} callback - a callback function to return the result
31580
+ * @return {object} results - An object containing the response of the action
31581
+ *
31582
+ * @route {POST} /assignRegistrationKeyToDevice
31583
+ * @roles admin
31584
+ * @task true
31585
+ */
31586
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
31587
+ assignRegistrationKeyToDevice(id, regKey, body, callback) {
31588
+ const meth = 'adapter-assignRegistrationKeyToDevice';
31589
+ const origin = `${this.id}-${meth}`;
31590
+ log.trace(origin);
31591
+
31592
+ if (this.suspended && this.suspendMode === 'error') {
31593
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
31594
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31595
+ return callback(null, errorObj);
31596
+ }
31597
+
31598
+ /* HERE IS WHERE YOU VALIDATE DATA */
31599
+ if (id === undefined || id === null || id === '') {
31600
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
31601
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31602
+ return callback(null, errorObj);
31603
+ }
31604
+ if (regKey === undefined || regKey === null || regKey === '') {
31605
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['regKey'], null, null, null);
31606
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31607
+ return callback(null, errorObj);
31608
+ }
31609
+ if (body === undefined || body === null || body === '') {
31610
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
31611
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31612
+ return callback(null, errorObj);
31613
+ }
31614
+
31615
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
31616
+ const queryParamsAvailable = {};
31617
+ const queryParams = {};
31618
+ const pathVars = [id, regKey];
31619
+ const bodyVars = body;
31620
+
31621
+ // loop in template. long callback arg name to avoid identifier conflicts
31622
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
31623
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
31624
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
31625
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
31626
+ }
31627
+ });
31628
+
31629
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
31630
+ // see adapter code documentation for more information on the request object's fields
31631
+ const reqObj = {
31632
+ payload: bodyVars,
31633
+ uriPathVars: pathVars,
31634
+ uriQuery: queryParams
31635
+ };
31636
+
31637
+ try {
31638
+ // Make the call -
31639
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
31640
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'assignRegistrationKeyToDevice', reqObj, true, (irReturnData, irReturnError) => {
31641
+ // if we received an error or their is no response on the results
31642
+ // return an error
31643
+ if (irReturnError) {
31644
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
31645
+ return callback(null, irReturnError);
31646
+ }
31647
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
31648
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['assignRegistrationKeyToDevice'], null, null, null);
31649
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31650
+ return callback(null, errorObj);
31651
+ }
31652
+
31653
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
31654
+ // return the response
31655
+ return callback(irReturnData, null);
31656
+ });
31657
+ } catch (ex) {
31658
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
31659
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31660
+ return callback(null, errorObj);
31661
+ }
31662
+ }
31663
+
31664
+ /**
31665
+ * @function getRegistrationKeyAssignmentStatus
31666
+ * @pronghornType method
31667
+ * @name getRegistrationKeyAssignmentStatus
31668
+ * @summary Get the status of a new registration key assignment
31669
+ *
31670
+ * @param {string} id - RegKey Pool ID
31671
+ * @param {string} regKey - RegKey
31672
+ * @param {string} memberUuid - Member uuid
31673
+ * @param {getCallback} callback - a callback function to return the result
31674
+ * @return {object} results - An object containing the response of the action
31675
+ *
31676
+ * @route {POST} /getRegistrationKeyAssignmentStatus
31677
+ * @roles admin
31678
+ * @task true
31679
+ */
31680
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
31681
+ getRegistrationKeyAssignmentStatus(id, regKey, memberUuid, callback) {
31682
+ const meth = 'adapter-getRegistrationKeyAssignmentStatus';
31683
+ const origin = `${this.id}-${meth}`;
31684
+ log.trace(origin);
31685
+
31686
+ if (this.suspended && this.suspendMode === 'error') {
31687
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
31688
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31689
+ return callback(null, errorObj);
31690
+ }
31691
+
31692
+ /* HERE IS WHERE YOU VALIDATE DATA */
31693
+ if (id === undefined || id === null || id === '') {
31694
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
31695
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31696
+ return callback(null, errorObj);
31697
+ }
31698
+ if (regKey === undefined || regKey === null || regKey === '') {
31699
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['regKey'], null, null, null);
31700
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31701
+ return callback(null, errorObj);
31702
+ }
31703
+ if (memberUuid === undefined || memberUuid === null || memberUuid === '') {
31704
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['memberUuid'], null, null, null);
31705
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31706
+ return callback(null, errorObj);
31707
+ }
31708
+
31709
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
31710
+ const queryParamsAvailable = {};
31711
+ const queryParams = {};
31712
+ const pathVars = [id, regKey, memberUuid];
31713
+ const bodyVars = {};
31714
+
31715
+ // loop in template. long callback arg name to avoid identifier conflicts
31716
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
31717
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
31718
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
31719
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
31720
+ }
31721
+ });
31722
+
31723
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
31724
+ // see adapter code documentation for more information on the request object's fields
31725
+ const reqObj = {
31726
+ payload: bodyVars,
31727
+ uriPathVars: pathVars,
31728
+ uriQuery: queryParams
31729
+ };
31730
+
31731
+ try {
31732
+ // Make the call -
31733
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
31734
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'getRegistrationKeyAssignmentStatus', reqObj, true, (irReturnData, irReturnError) => {
31735
+ // if we received an error or their is no response on the results
31736
+ // return an error
31737
+ if (irReturnError) {
31738
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
31739
+ return callback(null, irReturnError);
31740
+ }
31741
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
31742
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getRegistrationKeyAssignmentStatus'], null, null, null);
31743
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31744
+ return callback(null, errorObj);
31745
+ }
31746
+
31747
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
31748
+ // return the response
31749
+ return callback(irReturnData, null);
31750
+ });
31751
+ } catch (ex) {
31752
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
31753
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31754
+ return callback(null, errorObj);
31755
+ }
31756
+ }
31757
+
31758
+ /**
31759
+ * @function revokedRegistrationKeyFromDevice
31760
+ * @pronghornType method
31761
+ * @name revokedRegistrationKeyFromDevice
31762
+ * @summary Revoke a license from a managed or unmanaged device
31763
+ *
31764
+ * @param {string} id - RegKey Pool ID
31765
+ * @param {string} regKey - RegKey
31766
+ * @param {string} memberUuid - Member uuid
31767
+ * @param {object} [body] - Body required for unmanaged devices
31768
+ * @param {getCallback} callback - a callback function to return the result
31769
+ * @return {object} results - An object containing the response of the action
31770
+ *
31771
+ * @route {POST} /revokedRegistrationKeyFromDevice
31772
+ * @roles admin
31773
+ * @task true
31774
+ */
31775
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
31776
+ revokedRegistrationKeyFromDevice(id, regKey, memberUuid, body, callback) {
31777
+ const meth = 'adapter-revokedRegistrationKeyFromDevice';
31778
+ const origin = `${this.id}-${meth}`;
31779
+ log.trace(origin);
31780
+
31781
+ if (this.suspended && this.suspendMode === 'error') {
31782
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
31783
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31784
+ return callback(null, errorObj);
31785
+ }
31786
+
31787
+ /* HERE IS WHERE YOU VALIDATE DATA */
31788
+ if (id === undefined || id === null || id === '') {
31789
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
31790
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31791
+ return callback(null, errorObj);
31792
+ }
31793
+ if (regKey === undefined || regKey === null || regKey === '') {
31794
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['regKey'], null, null, null);
31795
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31796
+ return callback(null, errorObj);
31797
+ }
31798
+ if (memberUuid === undefined || memberUuid === null || memberUuid === '') {
31799
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['memberUuid'], null, null, null);
31800
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31801
+ return callback(null, errorObj);
31802
+ }
31803
+
31804
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
31805
+ const queryParamsAvailable = {};
31806
+ const queryParams = {};
31807
+ const pathVars = [id, regKey, memberUuid];
31808
+ const bodyVars = body;
31809
+
31810
+ // loop in template. long callback arg name to avoid identifier conflicts
31811
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
31812
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
31813
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
31814
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
31815
+ }
31816
+ });
31817
+
31818
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
31819
+ // see adapter code documentation for more information on the request object's fields
31820
+ const reqObj = {
31821
+ payload: bodyVars,
31822
+ uriPathVars: pathVars,
31823
+ uriQuery: queryParams
31824
+ };
31825
+
31826
+ try {
31827
+ // Make the call -
31828
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
31829
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'revokedRegistrationKeyFromDevice', reqObj, false, (irReturnData, irReturnError) => {
31830
+ // if we received an error or their is no response on the results
31831
+ // return an error
31832
+ if (irReturnError) {
31833
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
31834
+ return callback(null, irReturnError);
31835
+ }
31836
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
31837
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['revokedRegistrationKeyFromDevice'], null, null, null);
31838
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31839
+ return callback(null, errorObj);
31840
+ }
31841
+
31842
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
31843
+ // return the response
31844
+ return callback(irReturnData, null);
31845
+ });
31846
+ } catch (ex) {
31847
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
31848
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31849
+ return callback(null, errorObj);
31850
+ }
31851
+ }
31852
+
31853
+ /**
31854
+ * @function setLicenseText
31855
+ * @pronghornType method
31856
+ * @name setLicenseText
31857
+ * @summary Set the license text
31858
+ *
31859
+ * @param {object} body - Body with LicenseText
31860
+ * @param {getCallback} callback - a callback function to return the result
31861
+ * @return {object} results - An object containing the response of the action
31862
+ *
31863
+ * @route {POST} /setLicenseText
31864
+ * @roles admin
31865
+ * @task true
31866
+ */
31867
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
31868
+ setLicenseText(body, callback) {
31869
+ const meth = 'adapter-setLicenseText';
31870
+ const origin = `${this.id}-${meth}`;
31871
+ log.trace(origin);
31872
+
31873
+ if (this.suspended && this.suspendMode === 'error') {
31874
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
31875
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31876
+ return callback(null, errorObj);
31877
+ }
31878
+
31879
+ /* HERE IS WHERE YOU VALIDATE DATA */
31880
+ if (body === undefined || body === null || body === '') {
31881
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
31882
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31883
+ return callback(null, errorObj);
31884
+ }
31885
+
31886
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
31887
+ const queryParamsAvailable = {};
31888
+ const queryParams = {};
31889
+ const pathVars = [];
31890
+ const bodyVars = body;
31891
+
31892
+ // loop in template. long callback arg name to avoid identifier conflicts
31893
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
31894
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
31895
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
31896
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
31897
+ }
31898
+ });
31899
+
31900
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
31901
+ // see adapter code documentation for more information on the request object's fields
31902
+ const reqObj = {
31903
+ payload: bodyVars,
31904
+ uriPathVars: pathVars,
31905
+ uriQuery: queryParams
31906
+ };
31907
+
31908
+ try {
31909
+ // Make the call -
31910
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
31911
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'setLicenseText', reqObj, true, (irReturnData, irReturnError) => {
31912
+ // if we received an error or their is no response on the results
31913
+ // return an error
31914
+ if (irReturnError) {
31915
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
31916
+ return callback(null, irReturnError);
31917
+ }
31918
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
31919
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['setLicenseText'], null, null, null);
31920
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31921
+ return callback(null, errorObj);
31922
+ }
31923
+
31924
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
31925
+ // return the response
31926
+ return callback(irReturnData, null);
31927
+ });
31928
+ } catch (ex) {
31929
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
31930
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31931
+ return callback(null, errorObj);
31932
+ }
31933
+ }
31934
+
31935
+ /**
31936
+ * @function getLicenseText
31937
+ * @pronghornType method
31938
+ * @name getLicenseText
31939
+ * @summary Get the license text
31940
+ *
31941
+ * @param {getCallback} callback - a callback function to return the result
31942
+ * @return {object} results - An object containing the response of the action
31943
+ *
31944
+ * @route {GET} /getLicenseText
31945
+ * @roles admin
31946
+ * @task true
31947
+ */
31948
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
31949
+ getLicenseText(callback) {
31950
+ const meth = 'adapter-getLicenseText';
31951
+ const origin = `${this.id}-${meth}`;
31952
+ log.trace(origin);
31953
+
31954
+ if (this.suspended && this.suspendMode === 'error') {
31955
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
31956
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31957
+ return callback(null, errorObj);
31958
+ }
31959
+
31960
+ /* HERE IS WHERE YOU VALIDATE DATA */
31961
+
31962
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
31963
+ const queryParamsAvailable = {};
31964
+ const queryParams = {};
31965
+ const pathVars = [];
31966
+ const bodyVars = {};
31967
+
31968
+ // loop in template. long callback arg name to avoid identifier conflicts
31969
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
31970
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
31971
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
31972
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
31973
+ }
31974
+ });
31975
+
31976
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
31977
+ // see adapter code documentation for more information on the request object's fields
31978
+ const reqObj = {
31979
+ payload: bodyVars,
31980
+ uriPathVars: pathVars,
31981
+ uriQuery: queryParams
31982
+ };
31983
+
31984
+ try {
31985
+ // Make the call -
31986
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
31987
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'getLicenseText', reqObj, true, (irReturnData, irReturnError) => {
31988
+ // if we received an error or their is no response on the results
31989
+ // return an error
31990
+ if (irReturnError) {
31991
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
31992
+ return callback(null, irReturnError);
31993
+ }
31994
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
31995
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getLicenseText'], null, null, null);
31996
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
31997
+ return callback(null, errorObj);
31998
+ }
31999
+
32000
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
32001
+ // return the response
32002
+ return callback(irReturnData, null);
32003
+ });
32004
+ } catch (ex) {
32005
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
32006
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
32007
+ return callback(null, errorObj);
32008
+ }
32009
+ }
32010
+
32011
+ /**
32012
+ * @function createUtilityBillingLicenseReport
32013
+ * @pronghornType method
32014
+ * @name createUtilityBillingLicenseReport
32015
+ * @summary Create utility billing license report
32016
+ *
32017
+ * @param {object} body - Body
32018
+ * @param {getCallback} callback - a callback function to return the result
32019
+ * @return {object} results - An object containing the response of the action
32020
+ *
32021
+ * @route {POST} /createUtilityBillingLicenseReport
32022
+ * @roles admin
32023
+ * @task true
32024
+ */
32025
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
32026
+ createUtilityBillingLicenseReport(body, callback) {
32027
+ const meth = 'adapter-createUtilityBillingLicenseReport';
32028
+ const origin = `${this.id}-${meth}`;
32029
+ log.trace(origin);
32030
+
32031
+ if (this.suspended && this.suspendMode === 'error') {
32032
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
32033
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
32034
+ return callback(null, errorObj);
32035
+ }
32036
+
32037
+ /* HERE IS WHERE YOU VALIDATE DATA */
32038
+ if (body === undefined || body === null || body === '') {
32039
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
32040
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
32041
+ return callback(null, errorObj);
32042
+ }
32043
+
32044
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
32045
+ const queryParamsAvailable = {};
32046
+ const queryParams = {};
32047
+ const pathVars = [];
32048
+ const bodyVars = body;
32049
+
32050
+ // loop in template. long callback arg name to avoid identifier conflicts
32051
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
32052
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
32053
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
32054
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
32055
+ }
32056
+ });
32057
+
32058
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
32059
+ // see adapter code documentation for more information on the request object's fields
32060
+ const reqObj = {
32061
+ payload: bodyVars,
32062
+ uriPathVars: pathVars,
32063
+ uriQuery: queryParams
32064
+ };
32065
+
32066
+ try {
32067
+ // Make the call -
32068
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
32069
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'createUtilityBillingLicenseReport', reqObj, true, (irReturnData, irReturnError) => {
32070
+ // if we received an error or their is no response on the results
32071
+ // return an error
32072
+ if (irReturnError) {
32073
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
32074
+ return callback(null, irReturnError);
32075
+ }
32076
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
32077
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createUtilityBillingLicenseReport'], null, null, null);
32078
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
32079
+ return callback(null, errorObj);
32080
+ }
32081
+
32082
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
32083
+ // return the response
32084
+ return callback(irReturnData, null);
32085
+ });
32086
+ } catch (ex) {
32087
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
32088
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
32089
+ return callback(null, errorObj);
32090
+ }
32091
+ }
32092
+
32093
+ /**
32094
+ * @function getUtilityBillingReportStatus
32095
+ * @pronghornType method
32096
+ * @name getUtilityBillingReportStatus
32097
+ * @summary View the status of a utility billing report
32098
+ *
32099
+ * @param {string} id - id
32100
+ * @param {getCallback} callback - a callback function to return the result
32101
+ * @return {object} results - An object containing the response of the action
32102
+ *
32103
+ * @route {POST} /getUtilityBillingReportStatus
32104
+ * @roles admin
32105
+ * @task true
32106
+ */
32107
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
32108
+ getUtilityBillingReportStatus(id, callback) {
32109
+ const meth = 'adapter-getUtilityBillingReportStatus';
32110
+ const origin = `${this.id}-${meth}`;
32111
+ log.trace(origin);
32112
+
32113
+ if (this.suspended && this.suspendMode === 'error') {
32114
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
32115
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
32116
+ return callback(null, errorObj);
32117
+ }
32118
+
32119
+ /* HERE IS WHERE YOU VALIDATE DATA */
32120
+ if (id === undefined || id === null || id === '') {
32121
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
32122
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
32123
+ return callback(null, errorObj);
32124
+ }
32125
+
32126
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
32127
+ const queryParamsAvailable = {};
32128
+ const queryParams = {};
32129
+ const pathVars = [id];
32130
+ const bodyVars = {};
32131
+
32132
+ // loop in template. long callback arg name to avoid identifier conflicts
32133
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
32134
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
32135
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
32136
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
32137
+ }
32138
+ });
32139
+
32140
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
32141
+ // see adapter code documentation for more information on the request object's fields
32142
+ const reqObj = {
32143
+ payload: bodyVars,
32144
+ uriPathVars: pathVars,
32145
+ uriQuery: queryParams
32146
+ };
32147
+
32148
+ try {
32149
+ // Make the call -
32150
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
32151
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'getUtilityBillingReportStatus', reqObj, true, (irReturnData, irReturnError) => {
32152
+ // if we received an error or their is no response on the results
32153
+ // return an error
32154
+ if (irReturnError) {
32155
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
32156
+ return callback(null, irReturnError);
32157
+ }
32158
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
32159
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getUtilityBillingReportStatus'], null, null, null);
32160
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
32161
+ return callback(null, errorObj);
32162
+ }
32163
+
32164
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
32165
+ // return the response
32166
+ return callback(irReturnData, null);
32167
+ });
32168
+ } catch (ex) {
32169
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
32170
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
32171
+ return callback(null, errorObj);
32172
+ }
32173
+ }
32174
+
32175
+ /**
32176
+ * @function downloadUtilityBillingReport
32177
+ * @pronghornType method
32178
+ * @name downloadUtilityBillingReport
32179
+ * @summary Download a utility billing report
32180
+ *
32181
+ * @param {string} report - report
32182
+ * @param {getCallback} callback - a callback function to return the result
32183
+ * @return {object} results - An object containing the response of the action
32184
+ *
32185
+ * @route {POST} /downloadUtilityBillingReport
32186
+ * @roles admin
32187
+ * @task true
32188
+ */
32189
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
32190
+ downloadUtilityBillingReport(report, callback) {
32191
+ const meth = 'adapter-downloadUtilityBillingReport';
32192
+ const origin = `${this.id}-${meth}`;
32193
+ log.trace(origin);
32194
+
32195
+ if (this.suspended && this.suspendMode === 'error') {
32196
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
32197
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
32198
+ return callback(null, errorObj);
32199
+ }
32200
+
32201
+ /* HERE IS WHERE YOU VALIDATE DATA */
32202
+ if (report === undefined || report === null || report === '') {
32203
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['report'], null, null, null);
32204
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
32205
+ return callback(null, errorObj);
32206
+ }
32207
+
32208
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
32209
+ const queryParamsAvailable = {};
32210
+ const queryParams = {};
32211
+ const pathVars = [report];
32212
+ const bodyVars = {};
32213
+
32214
+ // loop in template. long callback arg name to avoid identifier conflicts
32215
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
32216
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
32217
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
32218
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
32219
+ }
32220
+ });
32221
+
32222
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
32223
+ // see adapter code documentation for more information on the request object's fields
32224
+ const reqObj = {
32225
+ payload: bodyVars,
32226
+ uriPathVars: pathVars,
32227
+ uriQuery: queryParams
32228
+ };
32229
+
32230
+ try {
32231
+ // Make the call -
32232
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
32233
+ return this.requestHandlerInst.identifyRequest('LicenseManagement', 'downloadUtilityBillingReport', reqObj, true, (irReturnData, irReturnError) => {
32234
+ // if we received an error or their is no response on the results
32235
+ // return an error
32236
+ if (irReturnError) {
32237
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
32238
+ return callback(null, irReturnError);
32239
+ }
32240
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
32241
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['downloadUtilityBillingReport'], null, null, null);
32242
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
32243
+ return callback(null, errorObj);
32244
+ }
32245
+
32246
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
32247
+ // return the response
32248
+ return callback(irReturnData, null);
32249
+ });
32250
+ } catch (ex) {
32251
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
32252
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
32253
+ return callback(null, errorObj);
32254
+ }
32255
+ }
29289
32256
  }
29290
32257
 
29291
32258
  module.exports = F5BigIQ;