@itentialopensource/adapter-vmware_vcenter 0.5.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +12 -12
  3. package/CHANGELOG.md +32 -0
  4. package/README.md +209 -29
  5. package/adapter.js +1476 -34
  6. package/adapterBase.js +289 -11
  7. package/entities/.generic/action.json +109 -0
  8. package/entities/.generic/schema.json +23 -0
  9. package/entities/.system/action.json +3 -3
  10. package/entities/.system/schemaTokenReq.json +2 -2
  11. package/entities/Vmtemplatelibraryitems/action.json +25 -0
  12. package/entities/Vmtemplatelibraryitems/schema.json +19 -0
  13. package/error.json +6 -0
  14. package/package.json +42 -21
  15. package/pronghorn.json +614 -0
  16. package/propertiesSchema.json +56 -9
  17. package/refs?service=git-upload-pack +0 -0
  18. package/report/updateReport1594310791028.json +95 -0
  19. package/report/updateReport1615860501665.json +95 -0
  20. package/report/updateReport1643047821981.json +95 -0
  21. package/sampleProperties.json +20 -5
  22. package/test/integration/adapterTestBasicGet.js +85 -0
  23. package/test/integration/adapterTestConnectivity.js +93 -0
  24. package/test/integration/adapterTestIntegration.js +59 -6
  25. package/test/unit/adapterBaseTestUnit.js +944 -0
  26. package/test/unit/adapterTestUnit.js +683 -10
  27. package/utils/addAuth.js +94 -0
  28. package/utils/basicGet.js +50 -0
  29. package/utils/checkMigrate.js +63 -0
  30. package/utils/entitiesToDB.js +224 -0
  31. package/utils/findPath.js +74 -0
  32. package/utils/modify.js +154 -0
  33. package/utils/packModificationScript.js +1 -1
  34. package/utils/patches2bundledDeps.js +90 -0
  35. package/utils/removeHooks.js +20 -0
  36. package/utils/tbScript.js +169 -0
  37. package/utils/tbUtils.js +451 -0
  38. package/utils/troubleshootingAdapter.js +190 -0
package/adapter.js CHANGED
@@ -10,7 +10,6 @@
10
10
 
11
11
  /* Required libraries. */
12
12
  const path = require('path');
13
- // const xmldom = require('xmldom');
14
13
 
15
14
  /* Fetch in the other needed components for the this Adaptor */
16
15
  const AdapterBaseCl = require(path.join(__dirname, 'adapterBase.js'));
@@ -24,43 +23,249 @@ class VmwareVCenter extends AdapterBaseCl {
24
23
  /**
25
24
  * VmwareVCenter Adapter
26
25
  * @constructor
26
+ */
27
+ /* Working on changing the way we do Emit methods due to size and time constrainsts
27
28
  constructor(prongid, properties) {
28
29
  // Instantiate the AdapterBase super class
29
30
  super(prongid, properties);
30
31
 
32
+ const restFunctionNames = this.getWorkflowFunctions();
33
+
34
+ // Dynamically bind emit functions
35
+ for (let i = 0; i < restFunctionNames.length; i += 1) {
36
+ // Bind function to have name fnNameEmit for fnName
37
+ const version = restFunctionNames[i].match(/__v[0-9]+/);
38
+ const baseFnName = restFunctionNames[i].replace(/__v[0-9]+/, '');
39
+ const fnNameEmit = version ? `${baseFnName}Emit${version}` : `${baseFnName}Emit`;
40
+ this[fnNameEmit] = function (...args) {
41
+ // extract the callback
42
+ const callback = args[args.length - 1];
43
+ // slice the callback from args so we can insert our own
44
+ const functionArgs = args.slice(0, args.length - 1);
45
+ // create a random name for the listener
46
+ const eventName = `${restFunctionNames[i]}:${Math.random().toString(36)}`;
47
+ // tell the calling class to start listening
48
+ callback({ event: eventName, status: 'received' });
49
+ // store parent for use of this context later
50
+ const parent = this;
51
+ // store emission function
52
+ const func = function (val, err) {
53
+ parent.removeListener(eventName, func);
54
+ parent.emit(eventName, val, err);
55
+ };
56
+ // Use apply to call the function in a specific context
57
+ this[restFunctionNames[i]].apply(this, functionArgs.concat([func])); // eslint-disable-line prefer-spread
58
+ };
59
+ }
60
+
31
61
  // Uncomment if you have things to add to the constructor like using your own properties.
32
62
  // Otherwise the constructor in the adapterBase will be used.
33
63
  // Capture my own properties - they need to be defined in propertiesSchema.json
34
- if (this.allProps && this.allProps.myownproperty) {
35
- mypropvariable = this.allProps.myownproperty;
36
- }
64
+ // if (this.allProps && this.allProps.myownproperty) {
65
+ // mypropvariable = this.allProps.myownproperty;
66
+ // }
37
67
  }
38
68
  */
39
69
 
40
70
  /**
41
71
  * @callback healthCallback
42
- * @param {Object} result - the result of the get request (contains an id and a status)
72
+ * @param {Object} reqObj - the request to send into the healthcheck
73
+ * @param {Callback} callback - The results of the call
43
74
  */
75
+ healthCheck(reqObj, callback) {
76
+ // you can modify what is passed into the healthcheck by changing things in the newReq
77
+ let newReq = null;
78
+ if (reqObj) {
79
+ newReq = Object.assign(...reqObj);
80
+ }
81
+ super.healthCheck(newReq, callback);
82
+ }
83
+
44
84
  /**
45
- * @callback getCallback
46
- * @param {Object} result - the result of the get request (entity/ies)
47
- * @param {String} error - any error that occurred
85
+ * @getWorkflowFunctions
48
86
  */
87
+ getWorkflowFunctions(inIgnore) {
88
+ let myIgnore = ['hasEntities', 'hasDevices'];
89
+ if (!inIgnore && Array.isArray(inIgnore)) {
90
+ myIgnore = inIgnore;
91
+ } else if (!inIgnore && typeof inIgnore === 'string') {
92
+ myIgnore = [inIgnore];
93
+ }
94
+
95
+ // The generic adapter functions should already be ignored (e.g. healthCheck)
96
+ // you can add specific methods that you do not want to be workflow functions to ignore like below
97
+ // myIgnore.push('myMethodNotInWorkflow');
98
+
99
+ return super.getWorkflowFunctions(myIgnore);
100
+ }
101
+
49
102
  /**
50
- * @callback createCallback
51
- * @param {Object} item - the newly created entity
52
- * @param {String} error - any error that occurred
103
+ * updateAdapterConfiguration is used to update any of the adapter configuration files. This
104
+ * allows customers to make changes to adapter configuration without having to be on the
105
+ * file system.
106
+ *
107
+ * @function updateAdapterConfiguration
108
+ * @param {string} configFile - the name of the file being updated (required)
109
+ * @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
110
+ * @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
111
+ * @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
112
+ * @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
113
+ * @param {Callback} callback - The results of the call
53
114
  */
115
+ updateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
116
+ const origin = `${this.id}-adapter-updateAdapterConfiguration`;
117
+ log.trace(origin);
118
+ super.updateAdapterConfiguration(configFile, changes, entity, type, action, callback);
119
+ }
120
+
54
121
  /**
55
- * @callback updateCallback
56
- * @param {String} status - the status of the update action
57
- * @param {String} error - any error that occurred
122
+ * See if the API path provided is found in this adapter
123
+ *
124
+ * @function findPath
125
+ * @param {string} apiPath - the api path to check on
126
+ * @param {Callback} callback - The results of the call
58
127
  */
128
+ findPath(apiPath, callback) {
129
+ const origin = `${this.id}-adapter-findPath`;
130
+ log.trace(origin);
131
+ super.findPath(apiPath, callback);
132
+ }
133
+
59
134
  /**
60
- * @callback deleteCallback
61
- * @param {String} status - the status of the delete action
62
- * @param {String} error - any error that occurred
135
+ * @summary Suspends adapter
136
+ *
137
+ * @function suspend
138
+ * @param {Callback} callback - callback function
139
+ */
140
+ suspend(mode, callback) {
141
+ const origin = `${this.id}-adapter-suspend`;
142
+ log.trace(origin);
143
+ try {
144
+ return super.suspend(mode, callback);
145
+ } catch (error) {
146
+ log.error(`${origin}: ${error}`);
147
+ return callback(null, error);
148
+ }
149
+ }
150
+
151
+ /**
152
+ * @summary Unsuspends adapter
153
+ *
154
+ * @function unsuspend
155
+ * @param {Callback} callback - callback function
156
+ */
157
+ unsuspend(callback) {
158
+ const origin = `${this.id}-adapter-unsuspend`;
159
+ log.trace(origin);
160
+ try {
161
+ return super.unsuspend(callback);
162
+ } catch (error) {
163
+ log.error(`${origin}: ${error}`);
164
+ return callback(null, error);
165
+ }
166
+ }
167
+
168
+ /**
169
+ * @summary Get the Adaoter Queue
170
+ *
171
+ * @function getQueue
172
+ * @param {Callback} callback - callback function
173
+ */
174
+ getQueue(callback) {
175
+ const origin = `${this.id}-adapter-getQueue`;
176
+ log.trace(origin);
177
+ return super.getQueue(callback);
178
+ }
179
+
180
+ /**
181
+ * @summary Runs troubleshoot scripts for adapter
182
+ *
183
+ * @function troubleshoot
184
+ * @param {Object} props - the connection, healthcheck and authentication properties
185
+ *
186
+ * @param {boolean} persistFlag - whether the adapter properties should be updated
187
+ * @param {Callback} callback - The results of the call
188
+ */
189
+ troubleshoot(props, persistFlag, callback) {
190
+ const origin = `${this.id}-adapter-troubleshoot`;
191
+ log.trace(origin);
192
+ try {
193
+ return super.troubleshoot(props, persistFlag, this, callback);
194
+ } catch (error) {
195
+ log.error(`${origin}: ${error}`);
196
+ return callback(null, error);
197
+ }
198
+ }
199
+
200
+ /**
201
+ * @summary runs healthcheck script for adapter
202
+ *
203
+ * @function runHealthcheck
204
+ * @param {Adapter} adapter - adapter instance to troubleshoot
205
+ * @param {Callback} callback - callback function
206
+ */
207
+ runHealthcheck(callback) {
208
+ const origin = `${this.id}-adapter-runHealthcheck`;
209
+ log.trace(origin);
210
+ try {
211
+ return super.runHealthcheck(this, callback);
212
+ } catch (error) {
213
+ log.error(`${origin}: ${error}`);
214
+ return callback(null, error);
215
+ }
216
+ }
217
+
218
+ /**
219
+ * @summary runs connectivity check script for adapter
220
+ *
221
+ * @function runConnectivity
222
+ * @param {Callback} callback - callback function
223
+ */
224
+ runConnectivity(callback) {
225
+ const origin = `${this.id}-adapter-runConnectivity`;
226
+ log.trace(origin);
227
+ try {
228
+ return super.runConnectivity(callback);
229
+ } catch (error) {
230
+ log.error(`${origin}: ${error}`);
231
+ return callback(null, error);
232
+ }
233
+ }
234
+
235
+ /**
236
+ * @summary runs basicGet script for adapter
237
+ *
238
+ * @function runBasicGet
239
+ * @param {Callback} callback - callback function
240
+ */
241
+ runBasicGet(callback) {
242
+ const origin = `${this.id}-adapter-runBasicGet`;
243
+ log.trace(origin);
244
+ try {
245
+ return super.runBasicGet(callback);
246
+ } catch (error) {
247
+ log.error(`${origin}: ${error}`);
248
+ return callback(null, error);
249
+ }
250
+ }
251
+
252
+ /**
253
+ * @summary moves entites into Mongo DB
254
+ *
255
+ * @function moveEntitiesToDB
256
+ * @param {getCallback} callback - a callback function to return the result (Generics)
257
+ * or the error
63
258
  */
259
+ moveEntitiesToDB(callback) {
260
+ const origin = `${this.id}-adapter-moveEntitiesToDB`;
261
+ log.trace(origin);
262
+ try {
263
+ return super.moveEntitiesToDB(callback);
264
+ } catch (err) {
265
+ log.error(`${origin}: ${err}`);
266
+ return callback(null, err);
267
+ }
268
+ }
64
269
 
65
270
  /**
66
271
  * @summary Determines if this adapter supports the specific entity
@@ -94,7 +299,7 @@ class VmwareVCenter extends AdapterBaseCl {
94
299
  * desired capability or an error
95
300
  */
96
301
  verifyCapability(entityType, actionType, entityId, callback) {
97
- const meth = 'adapterBase-getQueue';
302
+ const meth = 'adapterBase-verifyCapability';
98
303
  const origin = `${this.id}-${meth}`;
99
304
  log.trace(origin);
100
305
 
@@ -199,38 +404,623 @@ class VmwareVCenter extends AdapterBaseCl {
199
404
  // unsupported entity type
200
405
  const result = [false];
201
406
 
202
- // put false in array for all entities
203
- if (Array.isArray(entityId)) {
204
- for (let e = 1; e < entityId.length; e += 1) {
205
- result.push(false);
206
- }
407
+ // put false in array for all entities
408
+ if (Array.isArray(entityId)) {
409
+ for (let e = 1; e < entityId.length; e += 1) {
410
+ result.push(false);
411
+ }
412
+ }
413
+
414
+ return callback(result);
415
+ }
416
+ }
417
+ }
418
+
419
+ /**
420
+ * @summary Updates the cache for all entities by call the get All entity method
421
+ *
422
+ * @function updateEntityCache
423
+ *
424
+ */
425
+ updateEntityCache() {
426
+ const origin = `${this.id}-adapter-updateEntityCache`;
427
+ log.trace(origin);
428
+
429
+ if (this.caching) {
430
+ // if the cache is invalid, update the cache
431
+ this.getEntities(null, null, null, null, (data, err) => {
432
+ if (err) {
433
+ log.trace(`${origin}: Could not load template_entity into cache - ${err}`);
434
+ }
435
+ });
436
+ }
437
+ }
438
+
439
+ /**
440
+ * Makes the requested generic call
441
+ *
442
+ * @function genericAdapterRequest
443
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
444
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
445
+ * @param {Object} queryData - the parameters to be put on the url (optional).
446
+ * Can be a stringified Object.
447
+ * @param {Object} requestBody - the body to add to the request (optional).
448
+ * Can be a stringified Object.
449
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
450
+ * Can be a stringified Object.
451
+ * @param {getCallback} callback - a callback function to return the result (Generics)
452
+ * or the error
453
+ */
454
+ genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
455
+ const meth = 'adapter-genericAdapterRequest';
456
+ const origin = `${this.id}-${meth}`;
457
+ log.trace(origin);
458
+
459
+ if (this.suspended && this.suspendMode === 'error') {
460
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
461
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
462
+ return callback(null, errorObj);
463
+ }
464
+
465
+ /* HERE IS WHERE YOU VALIDATE DATA */
466
+ if (uriPath === undefined || uriPath === null || uriPath === '') {
467
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
468
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
469
+ return callback(null, errorObj);
470
+ }
471
+ if (restMethod === undefined || restMethod === null || restMethod === '') {
472
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
473
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
474
+ return callback(null, errorObj);
475
+ }
476
+
477
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
478
+ // remove any leading / and split the uripath into path variables
479
+ let myPath = uriPath;
480
+ while (myPath.indexOf('/') === 0) {
481
+ myPath = myPath.substring(1);
482
+ }
483
+ const pathVars = myPath.split('/');
484
+ const queryParamsAvailable = queryData;
485
+ const queryParams = {};
486
+ const bodyVars = requestBody;
487
+
488
+ // loop in template. long callback arg name to avoid identifier conflicts
489
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
490
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
491
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
492
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
493
+ }
494
+ });
495
+
496
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
497
+ const reqObj = {
498
+ payload: bodyVars,
499
+ uriPathVars: pathVars,
500
+ uriQuery: queryParams,
501
+ uriOptions: {}
502
+ };
503
+ // add headers if provided
504
+ if (addlHeaders) {
505
+ reqObj.addlHeaders = addlHeaders;
506
+ }
507
+
508
+ // determine the call and return flag
509
+ let action = 'getGenerics';
510
+ let returnF = true;
511
+ if (restMethod.toUpperCase() === 'POST') {
512
+ action = 'createGeneric';
513
+ } else if (restMethod.toUpperCase() === 'PUT') {
514
+ action = 'updateGeneric';
515
+ } else if (restMethod.toUpperCase() === 'PATCH') {
516
+ action = 'patchGeneric';
517
+ } else if (restMethod.toUpperCase() === 'DELETE') {
518
+ action = 'deleteGeneric';
519
+ returnF = false;
520
+ }
521
+
522
+ try {
523
+ // Make the call -
524
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
525
+ return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
526
+ // if we received an error or their is no response on the results
527
+ // return an error
528
+ if (irReturnError) {
529
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
530
+ return callback(null, irReturnError);
531
+ }
532
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
533
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
534
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
535
+ return callback(null, errorObj);
536
+ }
537
+
538
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
539
+ // return the response
540
+ return callback(irReturnData, null);
541
+ });
542
+ } catch (ex) {
543
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
544
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
545
+ return callback(null, errorObj);
546
+ }
547
+ }
548
+
549
+ /* BROKER CALLS */
550
+ /**
551
+ * @summary Determines if this adapter supports any in a list of entities
552
+ *
553
+ * @function hasEntities
554
+ * @param {String} entityType - the entity type to check for
555
+ * @param {Array} entityList - the list of entities we are looking for
556
+ *
557
+ * @param {Callback} callback - A map where the entity is the key and the
558
+ * value is true or false
559
+ */
560
+ hasEntities(entityType, entityList, callback) {
561
+ const origin = `${this.id}-adapter-hasEntities`;
562
+ log.trace(origin);
563
+
564
+ switch (entityType) {
565
+ case 'Device':
566
+ return this.hasDevices(entityList, callback);
567
+ default:
568
+ return callback(null, `${this.id} does not support entity ${entityType}`);
569
+ }
570
+ }
571
+
572
+ /**
573
+ * @summary Helper method for hasEntities for the specific device case
574
+ *
575
+ * @param {Array} deviceList - array of unique device identifiers
576
+ * @param {Callback} callback - A map where the device is the key and the
577
+ * value is true or false
578
+ */
579
+ hasDevices(deviceList, callback) {
580
+ const origin = `${this.id}-adapter-hasDevices`;
581
+ log.trace(origin);
582
+
583
+ const findings = deviceList.reduce((map, device) => {
584
+ // eslint-disable-next-line no-param-reassign
585
+ map[device] = false;
586
+ log.debug(`In reduce: ${JSON.stringify(map)}`);
587
+ return map;
588
+ }, {});
589
+ const apiCalls = deviceList.map((device) => new Promise((resolve) => {
590
+ this.getDevice(device, (result, error) => {
591
+ if (error) {
592
+ log.debug(`In map error: ${JSON.stringify(device)}`);
593
+ return resolve({ name: device, found: false });
594
+ }
595
+ log.debug(`In map: ${JSON.stringify(device)}`);
596
+ return resolve({ name: device, found: true });
597
+ });
598
+ }));
599
+ Promise.all(apiCalls).then((results) => {
600
+ results.forEach((device) => {
601
+ findings[device.name] = device.found;
602
+ });
603
+ log.debug(`FINDINGS: ${JSON.stringify(findings)}`);
604
+ return callback(findings);
605
+ }).catch((errors) => {
606
+ log.error('Unable to do device lookup.');
607
+ return callback(null, { code: 503, message: 'Unable to do device lookup.', error: errors });
608
+ });
609
+ }
610
+
611
+ /**
612
+ * @summary Get Appliance that match the deviceName
613
+ *
614
+ * @function getDevice
615
+ * @param {String} deviceName - the deviceName to find (required)
616
+ *
617
+ * @param {getCallback} callback - a callback function to return the result
618
+ * (appliance) or the error
619
+ */
620
+ getDevice(deviceName, callback) {
621
+ const meth = 'adapter-getDevice';
622
+ const origin = `${this.id}-${meth}`;
623
+ log.trace(origin);
624
+
625
+ if (this.suspended && this.suspendMode === 'error') {
626
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
627
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
628
+ return callback(null, errorObj);
629
+ }
630
+
631
+ /* HERE IS WHERE YOU VALIDATE DATA */
632
+ if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
633
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
634
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
635
+ return callback(null, errorObj);
636
+ }
637
+
638
+ try {
639
+ // need to get the device so we can convert the deviceName to an id
640
+ // !! if we can do a lookup by name the getDevicesFiltered may not be necessary
641
+ const opts = {
642
+ filter: {
643
+ name: deviceName
644
+ }
645
+ };
646
+ return this.getDevicesFiltered(opts, (devs, ferr) => {
647
+ // if we received an error or their is no response on the results return an error
648
+ if (ferr) {
649
+ return callback(null, ferr);
650
+ }
651
+ if (devs.list.length < 1) {
652
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
653
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
654
+ return callback(null, errorObj);
655
+ }
656
+ // get the uuid from the device
657
+ const { uuid } = devs.list[0];
658
+
659
+ // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
660
+ // !! you can also replace with a specific call if that is easier
661
+ const uriPath = `/call/toget/device/${uuid}`;
662
+ return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
663
+ // if we received an error or their is no response on the results return an error
664
+ if (error) {
665
+ return callback(null, error);
666
+ }
667
+ if (!result.response || !result.response.applianceMo) {
668
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDevice'], null, null, null);
669
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
670
+ return callback(null, errorObj);
671
+ }
672
+
673
+ // return the response
674
+ // !! format the data we send back
675
+ // !! these fields are config manager fields you need to map to the data we receive
676
+ const thisDevice = result.response;
677
+ thisDevice.name = thisDevice.systemName;
678
+ thisDevice.ostype = `System-${thisDevice.systemType}`;
679
+ thisDevice.port = thisDevice.systemPort;
680
+ thisDevice.ipaddress = thisDevice.systemIP;
681
+ return callback(thisDevice);
682
+ });
683
+ });
684
+ } catch (ex) {
685
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
686
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
687
+ return callback(null, errorObj);
688
+ }
689
+ }
690
+
691
+ /**
692
+ * @summary Get Appliances that match the filter
693
+ *
694
+ * @function getDevicesFiltered
695
+ * @param {Object} options - the data to use to filter the appliances (optional)
696
+ *
697
+ * @param {getCallback} callback - a callback function to return the result
698
+ * (appliances) or the error
699
+ */
700
+ getDevicesFiltered(options, callback) {
701
+ const meth = 'adapter-getDevicesFiltered';
702
+ const origin = `${this.id}-${meth}`;
703
+ log.trace(origin);
704
+
705
+ // verify the required fields have been provided
706
+ if (options === undefined || options === null || options === '' || options.length === 0) {
707
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['options'], null, null, null);
708
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
709
+ return callback(null, errorObj);
710
+ }
711
+ log.debug(`Device Filter Options: ${JSON.stringify(options)}`);
712
+
713
+ // TODO - get pagination working
714
+ // const nextToken = options.start;
715
+ // const maxResults = options.limit;
716
+
717
+ // set up the filter of Device Names
718
+ let filterName = [];
719
+ if (options && options.filter && options.filter.name) {
720
+ // when this hack is removed, remove the lint ignore above
721
+ if (Array.isArray(options.filter.name)) {
722
+ // eslint-disable-next-line prefer-destructuring
723
+ filterName = options.filter.name;
724
+ } else {
725
+ filterName = [options.filter.name];
726
+ }
727
+ }
728
+
729
+ // TODO - get sort and order working
730
+ /*
731
+ if (options && options.sort) {
732
+ reqObj.uriOptions.sort = JSON.stringify(options.sort);
733
+ }
734
+ if (options && options.order) {
735
+ reqObj.uriOptions.order = options.order;
736
+ }
737
+ */
738
+ try {
739
+ // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
740
+ // !! you can also replace with a specific call if that is easier
741
+ const uriPath = '/call/toget/devices';
742
+ return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
743
+ // if we received an error or their is no response on the results return an error
744
+ if (error) {
745
+ return callback(null, error);
746
+ }
747
+ if (!result.response) {
748
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDevicesFiltered'], null, null, null);
749
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
750
+ return callback(null, errorObj);
751
+ }
752
+
753
+ // !! go through the response - may have to look for sub object
754
+ // handle an array of devices
755
+ if (Array.isArray(result.response)) {
756
+ const myDevices = [];
757
+
758
+ for (let d = 0; d < result.response.length; d += 1) {
759
+ // !! format the data we send back
760
+ // !! these fields are config manager fields you need to map to the data we receive
761
+ const thisDevice = result.response;
762
+ thisDevice.name = thisDevice.systemName;
763
+ thisDevice.ostype = `System-${thisDevice.systemType}`;
764
+ thisDevice.port = thisDevice.systemPort;
765
+ thisDevice.ipaddress = thisDevice.systemIP;
766
+
767
+ // if there is no filter - return the device
768
+ if (filterName.length === 0) {
769
+ myDevices.push(thisDevice);
770
+ } else {
771
+ // if we have to match a filter
772
+ let found = false;
773
+ for (let f = 0; f < filterName.length; f += 1) {
774
+ if (thisDevice.name.indexOf(filterName[f]) >= 0) {
775
+ found = true;
776
+ break;
777
+ }
778
+ }
779
+ // matching device
780
+ if (found) {
781
+ myDevices.push(thisDevice);
782
+ }
783
+ }
784
+ }
785
+ log.debug(`${origin}: Found #${myDevices.length} devices.`);
786
+ log.debug(`Devices: ${JSON.stringify(myDevices)}`);
787
+ return callback({ total: myDevices.length, list: myDevices });
788
+ }
789
+ // handle a single device response
790
+ // !! format the data we send back
791
+ // !! these fields are config manager fields you need to map to the data we receive
792
+ const thisDevice = result.response;
793
+ thisDevice.name = thisDevice.systemName;
794
+ thisDevice.ostype = `System-${thisDevice.systemType}`;
795
+ thisDevice.port = thisDevice.systemPort;
796
+ thisDevice.ipaddress = thisDevice.systemIP;
797
+
798
+ // if there is no filter - return the device
799
+ if (filterName.length === 0) {
800
+ log.debug(`${origin}: Found #1 device.`);
801
+ log.debug(`Device: ${JSON.stringify(thisDevice)}`);
802
+ return callback({ total: 1, list: [thisDevice] });
803
+ }
804
+
805
+ // if there is a filter need to check for matching device
806
+ let found = false;
807
+ for (let f = 0; f < filterName.length; f += 1) {
808
+ if (thisDevice.name.indexOf(filterName[f]) >= 0) {
809
+ found = true;
810
+ break;
811
+ }
812
+ }
813
+ // matching device
814
+ if (found) {
815
+ log.debug(`${origin}: Found #1 device.`);
816
+ log.debug(`Device Found: ${JSON.stringify(thisDevice)}`);
817
+ return callback({ total: 1, list: [thisDevice] });
818
+ }
819
+ // not a matching device
820
+ log.debug(`${origin}: No matching device found.`);
821
+ return callback({ total: 0, list: [] });
822
+ });
823
+ } catch (ex) {
824
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
825
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
826
+ return callback(null, errorObj);
827
+ }
828
+ }
829
+
830
+ /**
831
+ * @summary Gets the status for the provided appliance
832
+ *
833
+ * @function isAlive
834
+ * @param {String} deviceName - the deviceName of the appliance. (required)
835
+ *
836
+ * @param {configCallback} callback - callback function to return the result
837
+ * (appliance isAlive) or the error
838
+ */
839
+ isAlive(deviceName, callback) {
840
+ const meth = 'adapter-isAlive';
841
+ const origin = `${this.id}-${meth}`;
842
+ log.trace(origin);
843
+
844
+ // verify the required fields have been provided
845
+ if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
846
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
847
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
848
+ return callback(null, errorObj);
849
+ }
850
+
851
+ try {
852
+ // need to get the device so we can convert the deviceName to an id
853
+ // !! if we can do a lookup by name the getDevicesFiltered may not be necessary
854
+ const opts = {
855
+ filter: {
856
+ name: deviceName
857
+ }
858
+ };
859
+ return this.getDevicesFiltered(opts, (devs, ferr) => {
860
+ // if we received an error or their is no response on the results return an error
861
+ if (ferr) {
862
+ return callback(null, ferr);
863
+ }
864
+ if (devs.list.length < 1) {
865
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
866
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
867
+ return callback(null, errorObj);
868
+ }
869
+ // get the uuid from the device
870
+ const { uuid } = devs.list[0];
871
+
872
+ // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
873
+ // !! you can also replace with a specific call if that is easier
874
+ const uriPath = `/call/toget/status/${uuid}`;
875
+ return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
876
+ // if we received an error or their is no response on the results return an error
877
+ if (error) {
878
+ return callback(null, error);
879
+ }
880
+ // !! should update this to make sure we are checking for the appropriate object/field
881
+ if (!result.response || !result.response.returnObj || !Object.hasOwnProperty.call(result.response.returnObj, 'statusField')) {
882
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['isAlive'], null, null, null);
883
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
884
+ return callback(null, errorObj);
885
+ }
886
+
887
+ // !! return the response - Update to the appropriate object/field
888
+ return callback(!result.response.returnObj.statusField);
889
+ });
890
+ });
891
+ } catch (ex) {
892
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
893
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
894
+ return callback(null, errorObj);
895
+ }
896
+ }
897
+
898
+ /**
899
+ * @summary Gets a config for the provided Appliance
900
+ *
901
+ * @function getConfig
902
+ * @param {String} deviceName - the deviceName of the appliance. (required)
903
+ * @param {String} format - the desired format of the config. (optional)
904
+ *
905
+ * @param {configCallback} callback - callback function to return the result
906
+ * (appliance config) or the error
907
+ */
908
+ getConfig(deviceName, format, callback) {
909
+ const meth = 'adapter-getConfig';
910
+ const origin = `${this.id}-${meth}`;
911
+ log.trace(origin);
912
+
913
+ // verify the required fields have been provided
914
+ if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
915
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
916
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
917
+ return callback(null, errorObj);
918
+ }
919
+
920
+ try {
921
+ // need to get the device so we can convert the deviceName to an id
922
+ // !! if we can do a lookup by name the getDevicesFiltered may not be necessary
923
+ const opts = {
924
+ filter: {
925
+ name: deviceName
926
+ }
927
+ };
928
+ return this.getDevicesFiltered(opts, (devs, ferr) => {
929
+ // if we received an error or their is no response on the results return an error
930
+ if (ferr) {
931
+ return callback(null, ferr);
932
+ }
933
+ if (devs.list.length < 1) {
934
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
935
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
936
+ return callback(null, errorObj);
207
937
  }
938
+ // get the uuid from the device
939
+ const { uuid } = devs.list[0];
208
940
 
209
- return callback(result);
210
- }
941
+ // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
942
+ // !! you can also replace with a specific call if that is easier
943
+ const uriPath = `/call/toget/config/${uuid}`;
944
+ return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
945
+ // if we received an error or their is no response on the results return an error
946
+ if (error) {
947
+ return callback(null, error);
948
+ }
949
+
950
+ // return the result
951
+ const newResponse = {
952
+ response: JSON.stringify(result.response, null, 2)
953
+ };
954
+ return callback(newResponse);
955
+ });
956
+ });
957
+ } catch (ex) {
958
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
959
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
960
+ return callback(null, errorObj);
211
961
  }
212
962
  }
213
963
 
214
964
  /**
215
- * @summary Updates the cache for all entities by call the get All entity method
965
+ * @summary Gets the device count from the system
216
966
  *
217
- * @function updateEntityCache
967
+ * @function getCount
218
968
  *
969
+ * @param {getCallback} callback - callback function to return the result
970
+ * (count) or the error
219
971
  */
220
- updateEntityCache() {
221
- const origin = `${this.id}-adapter-updateEntityCache`;
972
+ getCount(callback) {
973
+ const meth = 'adapter-getCount';
974
+ const origin = `${this.id}-${meth}`;
222
975
  log.trace(origin);
223
976
 
224
- if (this.caching) {
225
- // if the cache is invalid, update the cache
226
- this.getEntities(null, null, null, null, (data, err) => {
227
- if (err) {
228
- log.trace(`${origin}: Could not load template_entity into cache - ${err}`);
977
+ // verify the required fields have been provided
978
+
979
+ try {
980
+ // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
981
+ // !! you can also replace with a specific call if that is easier
982
+ const uriPath = '/call/toget/count';
983
+ return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
984
+ // if we received an error or their is no response on the results return an error
985
+ if (error) {
986
+ return callback(null, error);
229
987
  }
988
+
989
+ // return the result
990
+ return callback({ count: result.response });
230
991
  });
992
+ } catch (ex) {
993
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
994
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
995
+ return callback(null, errorObj);
231
996
  }
232
997
  }
233
998
 
999
+ /**
1000
+ * @callback healthCallback
1001
+ * @param {Object} result - the result of the get request (contains an id and a status)
1002
+ */
1003
+ /**
1004
+ * @callback getCallback
1005
+ * @param {Object} result - the result of the get request (entity/ies)
1006
+ * @param {String} error - any error that occurred
1007
+ */
1008
+ /**
1009
+ * @callback createCallback
1010
+ * @param {Object} item - the newly created entity
1011
+ * @param {String} error - any error that occurred
1012
+ */
1013
+ /**
1014
+ * @callback updateCallback
1015
+ * @param {String} status - the status of the update action
1016
+ * @param {String} error - any error that occurred
1017
+ */
1018
+ /**
1019
+ * @callback deleteCallback
1020
+ * @param {String} status - the status of the delete action
1021
+ * @param {String} error - any error that occurred
1022
+ */
1023
+
234
1024
  /**
235
1025
  * @summary Returns datastore information for the specified datastores. The key in the {@term result} {@term map} is the datastore identifier and the value in the {@term map} is the datastore information.
236
1026
  *
@@ -243,6 +1033,12 @@ class VmwareVCenter extends AdapterBaseCl {
243
1033
  const origin = `${this.id}-${meth}`;
244
1034
  log.trace(origin);
245
1035
 
1036
+ if (this.suspended && this.suspendMode === 'error') {
1037
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1038
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1039
+ return callback(null, errorObj);
1040
+ }
1041
+
246
1042
  /* HERE IS WHERE YOU VALIDATE DATA */
247
1043
 
248
1044
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -291,6 +1087,12 @@ class VmwareVCenter extends AdapterBaseCl {
291
1087
  const origin = `${this.id}-${meth}`;
292
1088
  log.trace(origin);
293
1089
 
1090
+ if (this.suspended && this.suspendMode === 'error') {
1091
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1092
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1093
+ return callback(null, errorObj);
1094
+ }
1095
+
294
1096
  /* HERE IS WHERE YOU VALIDATE DATA */
295
1097
 
296
1098
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -340,6 +1142,12 @@ class VmwareVCenter extends AdapterBaseCl {
340
1142
  const origin = `${this.id}-${meth}`;
341
1143
  log.trace(origin);
342
1144
 
1145
+ if (this.suspended && this.suspendMode === 'error') {
1146
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1147
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1148
+ return callback(null, errorObj);
1149
+ }
1150
+
343
1151
  /* HERE IS WHERE YOU VALIDATE DATA */
344
1152
  if (libraryItem === undefined || libraryItem === null || libraryItem === '') {
345
1153
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['libraryItem'], null, null, null);
@@ -410,6 +1218,12 @@ class VmwareVCenter extends AdapterBaseCl {
410
1218
  const origin = `${this.id}-${meth}`;
411
1219
  log.trace(origin);
412
1220
 
1221
+ if (this.suspended && this.suspendMode === 'error') {
1222
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1223
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1224
+ return callback(null, errorObj);
1225
+ }
1226
+
413
1227
  /* HERE IS WHERE YOU VALIDATE DATA */
414
1228
  if (vm === undefined || vm === null || vm === '') {
415
1229
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -479,6 +1293,12 @@ class VmwareVCenter extends AdapterBaseCl {
479
1293
  const origin = `${this.id}-${meth}`;
480
1294
  log.trace(origin);
481
1295
 
1296
+ if (this.suspended && this.suspendMode === 'error') {
1297
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1298
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1299
+ return callback(null, errorObj);
1300
+ }
1301
+
482
1302
  /* HERE IS WHERE YOU VALIDATE DATA */
483
1303
 
484
1304
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -524,6 +1344,12 @@ class VmwareVCenter extends AdapterBaseCl {
524
1344
  const origin = `${this.id}-${meth}`;
525
1345
  log.trace(origin);
526
1346
 
1347
+ if (this.suspended && this.suspendMode === 'error') {
1348
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1349
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1350
+ return callback(null, errorObj);
1351
+ }
1352
+
527
1353
  /* HERE IS WHERE YOU VALIDATE DATA */
528
1354
 
529
1355
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -570,6 +1396,12 @@ class VmwareVCenter extends AdapterBaseCl {
570
1396
  const origin = `${this.id}-${meth}`;
571
1397
  log.trace(origin);
572
1398
 
1399
+ if (this.suspended && this.suspendMode === 'error') {
1400
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1401
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1402
+ return callback(null, errorObj);
1403
+ }
1404
+
573
1405
  /* HERE IS WHERE YOU VALIDATE DATA */
574
1406
  if (clientTokensourcetargetcreateSpec === undefined || clientTokensourcetargetcreateSpec === null || clientTokensourcetargetcreateSpec === '') {
575
1407
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['clientTokensourcetargetcreateSpec'], null, null, null);
@@ -639,6 +1471,12 @@ class VmwareVCenter extends AdapterBaseCl {
639
1471
  const origin = `${this.id}-${meth}`;
640
1472
  log.trace(origin);
641
1473
 
1474
+ if (this.suspended && this.suspendMode === 'error') {
1475
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1476
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1477
+ return callback(null, errorObj);
1478
+ }
1479
+
642
1480
  /* HERE IS WHERE YOU VALIDATE DATA */
643
1481
  if (ovfLibraryItemId === undefined || ovfLibraryItemId === null || ovfLibraryItemId === '') {
644
1482
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['ovfLibraryItemId'], null, null, null);
@@ -715,6 +1553,12 @@ class VmwareVCenter extends AdapterBaseCl {
715
1553
  const origin = `${this.id}-${meth}`;
716
1554
  log.trace(origin);
717
1555
 
1556
+ if (this.suspended && this.suspendMode === 'error') {
1557
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1558
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1559
+ return callback(null, errorObj);
1560
+ }
1561
+
718
1562
  /* HERE IS WHERE YOU VALIDATE DATA */
719
1563
  if (ovfLibraryItemId === undefined || ovfLibraryItemId === null || ovfLibraryItemId === '') {
720
1564
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['ovfLibraryItemId'], null, null, null);
@@ -793,6 +1637,12 @@ class VmwareVCenter extends AdapterBaseCl {
793
1637
  const origin = `${this.id}-${meth}`;
794
1638
  log.trace(origin);
795
1639
 
1640
+ if (this.suspended && this.suspendMode === 'error') {
1641
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1642
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1643
+ return callback(null, errorObj);
1644
+ }
1645
+
796
1646
  /* HERE IS WHERE YOU VALIDATE DATA */
797
1647
 
798
1648
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -861,6 +1711,12 @@ class VmwareVCenter extends AdapterBaseCl {
861
1711
  const origin = `${this.id}-${meth}`;
862
1712
  log.trace(origin);
863
1713
 
1714
+ if (this.suspended && this.suspendMode === 'error') {
1715
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1716
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1717
+ return callback(null, errorObj);
1718
+ }
1719
+
864
1720
  /* HERE IS WHERE YOU VALIDATE DATA */
865
1721
  if (cluster === undefined || cluster === null || cluster === '') {
866
1722
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['cluster'], null, null, null);
@@ -929,6 +1785,12 @@ class VmwareVCenter extends AdapterBaseCl {
929
1785
  const origin = `${this.id}-${meth}`;
930
1786
  log.trace(origin);
931
1787
 
1788
+ if (this.suspended && this.suspendMode === 'error') {
1789
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1790
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1791
+ return callback(null, errorObj);
1792
+ }
1793
+
932
1794
  /* HERE IS WHERE YOU VALIDATE DATA */
933
1795
  if (spec === undefined || spec === null || spec === '') {
934
1796
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['spec'], null, null, null);
@@ -999,6 +1861,12 @@ class VmwareVCenter extends AdapterBaseCl {
999
1861
  const origin = `${this.id}-${meth}`;
1000
1862
  log.trace(origin);
1001
1863
 
1864
+ if (this.suspended && this.suspendMode === 'error') {
1865
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1866
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1867
+ return callback(null, errorObj);
1868
+ }
1869
+
1002
1870
  /* HERE IS WHERE YOU VALIDATE DATA */
1003
1871
 
1004
1872
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1066,6 +1934,12 @@ class VmwareVCenter extends AdapterBaseCl {
1066
1934
  const origin = `${this.id}-${meth}`;
1067
1935
  log.trace(origin);
1068
1936
 
1937
+ if (this.suspended && this.suspendMode === 'error') {
1938
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1939
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1940
+ return callback(null, errorObj);
1941
+ }
1942
+
1069
1943
  /* HERE IS WHERE YOU VALIDATE DATA */
1070
1944
  if (datacenter === undefined || datacenter === null || datacenter === '') {
1071
1945
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['datacenter'], null, null, null);
@@ -1135,6 +2009,12 @@ class VmwareVCenter extends AdapterBaseCl {
1135
2009
  const origin = `${this.id}-${meth}`;
1136
2010
  log.trace(origin);
1137
2011
 
2012
+ if (this.suspended && this.suspendMode === 'error') {
2013
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2014
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2015
+ return callback(null, errorObj);
2016
+ }
2017
+
1138
2018
  /* HERE IS WHERE YOU VALIDATE DATA */
1139
2019
  if (datacenter === undefined || datacenter === null || datacenter === '') {
1140
2020
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['datacenter'], null, null, null);
@@ -1207,6 +2087,12 @@ class VmwareVCenter extends AdapterBaseCl {
1207
2087
  const origin = `${this.id}-${meth}`;
1208
2088
  log.trace(origin);
1209
2089
 
2090
+ if (this.suspended && this.suspendMode === 'error') {
2091
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2092
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2093
+ return callback(null, errorObj);
2094
+ }
2095
+
1210
2096
  /* HERE IS WHERE YOU VALIDATE DATA */
1211
2097
 
1212
2098
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1276,6 +2162,12 @@ class VmwareVCenter extends AdapterBaseCl {
1276
2162
  const origin = `${this.id}-${meth}`;
1277
2163
  log.trace(origin);
1278
2164
 
2165
+ if (this.suspended && this.suspendMode === 'error') {
2166
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2167
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2168
+ return callback(null, errorObj);
2169
+ }
2170
+
1279
2171
  /* HERE IS WHERE YOU VALIDATE DATA */
1280
2172
  if (datastore === undefined || datastore === null || datastore === '') {
1281
2173
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['datastore'], null, null, null);
@@ -1348,6 +2240,12 @@ class VmwareVCenter extends AdapterBaseCl {
1348
2240
  const origin = `${this.id}-${meth}`;
1349
2241
  log.trace(origin);
1350
2242
 
2243
+ if (this.suspended && this.suspendMode === 'error') {
2244
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2245
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2246
+ return callback(null, errorObj);
2247
+ }
2248
+
1351
2249
  /* HERE IS WHERE YOU VALIDATE DATA */
1352
2250
 
1353
2251
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1417,6 +2315,12 @@ class VmwareVCenter extends AdapterBaseCl {
1417
2315
  const origin = `${this.id}-${meth}`;
1418
2316
  log.trace(origin);
1419
2317
 
2318
+ if (this.suspended && this.suspendMode === 'error') {
2319
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2320
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2321
+ return callback(null, errorObj);
2322
+ }
2323
+
1420
2324
  /* HERE IS WHERE YOU VALIDATE DATA */
1421
2325
  if (spec === undefined || spec === null || spec === '') {
1422
2326
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['spec'], null, null, null);
@@ -1491,6 +2395,12 @@ class VmwareVCenter extends AdapterBaseCl {
1491
2395
  const origin = `${this.id}-${meth}`;
1492
2396
  log.trace(origin);
1493
2397
 
2398
+ if (this.suspended && this.suspendMode === 'error') {
2399
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2400
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2401
+ return callback(null, errorObj);
2402
+ }
2403
+
1494
2404
  /* HERE IS WHERE YOU VALIDATE DATA */
1495
2405
 
1496
2406
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1562,6 +2472,12 @@ class VmwareVCenter extends AdapterBaseCl {
1562
2472
  const origin = `${this.id}-${meth}`;
1563
2473
  log.trace(origin);
1564
2474
 
2475
+ if (this.suspended && this.suspendMode === 'error') {
2476
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2477
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2478
+ return callback(null, errorObj);
2479
+ }
2480
+
1565
2481
  /* HERE IS WHERE YOU VALIDATE DATA */
1566
2482
  if (host === undefined || host === null || host === '') {
1567
2483
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['host'], null, null, null);
@@ -1630,6 +2546,12 @@ class VmwareVCenter extends AdapterBaseCl {
1630
2546
  const origin = `${this.id}-${meth}`;
1631
2547
  log.trace(origin);
1632
2548
 
2549
+ if (this.suspended && this.suspendMode === 'error') {
2550
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2551
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2552
+ return callback(null, errorObj);
2553
+ }
2554
+
1633
2555
  /* HERE IS WHERE YOU VALIDATE DATA */
1634
2556
  if (host === undefined || host === null || host === '') {
1635
2557
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['host'], null, null, null);
@@ -1698,6 +2620,12 @@ class VmwareVCenter extends AdapterBaseCl {
1698
2620
  const origin = `${this.id}-${meth}`;
1699
2621
  log.trace(origin);
1700
2622
 
2623
+ if (this.suspended && this.suspendMode === 'error') {
2624
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2625
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2626
+ return callback(null, errorObj);
2627
+ }
2628
+
1701
2629
  /* HERE IS WHERE YOU VALIDATE DATA */
1702
2630
  if (host === undefined || host === null || host === '') {
1703
2631
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['host'], null, null, null);
@@ -1770,6 +2698,12 @@ class VmwareVCenter extends AdapterBaseCl {
1770
2698
  const origin = `${this.id}-${meth}`;
1771
2699
  log.trace(origin);
1772
2700
 
2701
+ if (this.suspended && this.suspendMode === 'error') {
2702
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2703
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2704
+ return callback(null, errorObj);
2705
+ }
2706
+
1773
2707
  /* HERE IS WHERE YOU VALIDATE DATA */
1774
2708
 
1775
2709
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1844,6 +2778,12 @@ class VmwareVCenter extends AdapterBaseCl {
1844
2778
  const origin = `${this.id}-${meth}`;
1845
2779
  log.trace(origin);
1846
2780
 
2781
+ if (this.suspended && this.suspendMode === 'error') {
2782
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2783
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2784
+ return callback(null, errorObj);
2785
+ }
2786
+
1847
2787
  /* HERE IS WHERE YOU VALIDATE DATA */
1848
2788
 
1849
2789
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1914,6 +2854,12 @@ class VmwareVCenter extends AdapterBaseCl {
1914
2854
  const origin = `${this.id}-${meth}`;
1915
2855
  log.trace(origin);
1916
2856
 
2857
+ if (this.suspended && this.suspendMode === 'error') {
2858
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2859
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2860
+ return callback(null, errorObj);
2861
+ }
2862
+
1917
2863
  /* HERE IS WHERE YOU VALIDATE DATA */
1918
2864
  if (resourcepool === undefined || resourcepool === null || resourcepool === '') {
1919
2865
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['resourcepool'], null, null, null);
@@ -1982,6 +2928,12 @@ class VmwareVCenter extends AdapterBaseCl {
1982
2928
  const origin = `${this.id}-${meth}`;
1983
2929
  log.trace(origin);
1984
2930
 
2931
+ if (this.suspended && this.suspendMode === 'error') {
2932
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2933
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2934
+ return callback(null, errorObj);
2935
+ }
2936
+
1985
2937
  /* HERE IS WHERE YOU VALIDATE DATA */
1986
2938
  if (spec === undefined || spec === null || spec === '') {
1987
2939
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['spec'], null, null, null);
@@ -2057,6 +3009,12 @@ class VmwareVCenter extends AdapterBaseCl {
2057
3009
  const origin = `${this.id}-${meth}`;
2058
3010
  log.trace(origin);
2059
3011
 
3012
+ if (this.suspended && this.suspendMode === 'error') {
3013
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3014
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3015
+ return callback(null, errorObj);
3016
+ }
3017
+
2060
3018
  /* HERE IS WHERE YOU VALIDATE DATA */
2061
3019
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
2062
3020
  const queryParamsAvailable = {
@@ -2128,6 +3086,12 @@ class VmwareVCenter extends AdapterBaseCl {
2128
3086
  const origin = `${this.id}-${meth}`;
2129
3087
  log.trace(origin);
2130
3088
 
3089
+ if (this.suspended && this.suspendMode === 'error') {
3090
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3091
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3092
+ return callback(null, errorObj);
3093
+ }
3094
+
2131
3095
  /* HERE IS WHERE YOU VALIDATE DATA */
2132
3096
  if (vm === undefined || vm === null || vm === '') {
2133
3097
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -2196,6 +3160,12 @@ class VmwareVCenter extends AdapterBaseCl {
2196
3160
  const origin = `${this.id}-${meth}`;
2197
3161
  log.trace(origin);
2198
3162
 
3163
+ if (this.suspended && this.suspendMode === 'error') {
3164
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3165
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3166
+ return callback(null, errorObj);
3167
+ }
3168
+
2199
3169
  /* HERE IS WHERE YOU VALIDATE DATA */
2200
3170
  if (vm === undefined || vm === null || vm === '') {
2201
3171
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -2264,6 +3234,12 @@ class VmwareVCenter extends AdapterBaseCl {
2264
3234
  const origin = `${this.id}-${meth}`;
2265
3235
  log.trace(origin);
2266
3236
 
3237
+ if (this.suspended && this.suspendMode === 'error') {
3238
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3239
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3240
+ return callback(null, errorObj);
3241
+ }
3242
+
2267
3243
  /* HERE IS WHERE YOU VALIDATE DATA */
2268
3244
  if (vm === undefined || vm === null || vm === '') {
2269
3245
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -2333,6 +3309,12 @@ class VmwareVCenter extends AdapterBaseCl {
2333
3309
  const origin = `${this.id}-${meth}`;
2334
3310
  log.trace(origin);
2335
3311
 
3312
+ if (this.suspended && this.suspendMode === 'error') {
3313
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3314
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3315
+ return callback(null, errorObj);
3316
+ }
3317
+
2336
3318
  /* HERE IS WHERE YOU VALIDATE DATA */
2337
3319
  if (vm === undefined || vm === null || vm === '') {
2338
3320
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -2407,6 +3389,12 @@ class VmwareVCenter extends AdapterBaseCl {
2407
3389
  const origin = `${this.id}-${meth}`;
2408
3390
  log.trace(origin);
2409
3391
 
3392
+ if (this.suspended && this.suspendMode === 'error') {
3393
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3394
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3395
+ return callback(null, errorObj);
3396
+ }
3397
+
2410
3398
  /* HERE IS WHERE YOU VALIDATE DATA */
2411
3399
  if (vm === undefined || vm === null || vm === '') {
2412
3400
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -2476,6 +3464,12 @@ class VmwareVCenter extends AdapterBaseCl {
2476
3464
  const origin = `${this.id}-${meth}`;
2477
3465
  log.trace(origin);
2478
3466
 
3467
+ if (this.suspended && this.suspendMode === 'error') {
3468
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3469
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3470
+ return callback(null, errorObj);
3471
+ }
3472
+
2479
3473
  /* HERE IS WHERE YOU VALIDATE DATA */
2480
3474
  if (vm === undefined || vm === null || vm === '') {
2481
3475
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -2549,6 +3543,12 @@ class VmwareVCenter extends AdapterBaseCl {
2549
3543
  const origin = `${this.id}-${meth}`;
2550
3544
  log.trace(origin);
2551
3545
 
3546
+ if (this.suspended && this.suspendMode === 'error') {
3547
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3548
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3549
+ return callback(null, errorObj);
3550
+ }
3551
+
2552
3552
  /* HERE IS WHERE YOU VALIDATE DATA */
2553
3553
  if (vm === undefined || vm === null || vm === '') {
2554
3554
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -2618,6 +3618,12 @@ class VmwareVCenter extends AdapterBaseCl {
2618
3618
  const origin = `${this.id}-${meth}`;
2619
3619
  log.trace(origin);
2620
3620
 
3621
+ if (this.suspended && this.suspendMode === 'error') {
3622
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3623
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3624
+ return callback(null, errorObj);
3625
+ }
3626
+
2621
3627
  /* HERE IS WHERE YOU VALIDATE DATA */
2622
3628
  if (vm === undefined || vm === null || vm === '') {
2623
3629
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -2692,6 +3698,12 @@ class VmwareVCenter extends AdapterBaseCl {
2692
3698
  const origin = `${this.id}-${meth}`;
2693
3699
  log.trace(origin);
2694
3700
 
3701
+ if (this.suspended && this.suspendMode === 'error') {
3702
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3703
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3704
+ return callback(null, errorObj);
3705
+ }
3706
+
2695
3707
  /* HERE IS WHERE YOU VALIDATE DATA */
2696
3708
  if (vm === undefined || vm === null || vm === '') {
2697
3709
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -2766,6 +3778,12 @@ class VmwareVCenter extends AdapterBaseCl {
2766
3778
  const origin = `${this.id}-${meth}`;
2767
3779
  log.trace(origin);
2768
3780
 
3781
+ if (this.suspended && this.suspendMode === 'error') {
3782
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3783
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3784
+ return callback(null, errorObj);
3785
+ }
3786
+
2769
3787
  /* HERE IS WHERE YOU VALIDATE DATA */
2770
3788
  if (vm === undefined || vm === null || vm === '') {
2771
3789
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -2839,6 +3857,12 @@ class VmwareVCenter extends AdapterBaseCl {
2839
3857
  const origin = `${this.id}-${meth}`;
2840
3858
  log.trace(origin);
2841
3859
 
3860
+ if (this.suspended && this.suspendMode === 'error') {
3861
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3862
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3863
+ return callback(null, errorObj);
3864
+ }
3865
+
2842
3866
  /* HERE IS WHERE YOU VALIDATE DATA */
2843
3867
  if (vm === undefined || vm === null || vm === '') {
2844
3868
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -2908,6 +3932,12 @@ class VmwareVCenter extends AdapterBaseCl {
2908
3932
  const origin = `${this.id}-${meth}`;
2909
3933
  log.trace(origin);
2910
3934
 
3935
+ if (this.suspended && this.suspendMode === 'error') {
3936
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3937
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3938
+ return callback(null, errorObj);
3939
+ }
3940
+
2911
3941
  /* HERE IS WHERE YOU VALIDATE DATA */
2912
3942
  if (vm === undefined || vm === null || vm === '') {
2913
3943
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -2983,6 +4013,12 @@ class VmwareVCenter extends AdapterBaseCl {
2983
4013
  const origin = `${this.id}-${meth}`;
2984
4014
  log.trace(origin);
2985
4015
 
4016
+ if (this.suspended && this.suspendMode === 'error') {
4017
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
4018
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
4019
+ return callback(null, errorObj);
4020
+ }
4021
+
2986
4022
  /* HERE IS WHERE YOU VALIDATE DATA */
2987
4023
  if (vm === undefined || vm === null || vm === '') {
2988
4024
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -3062,6 +4098,12 @@ class VmwareVCenter extends AdapterBaseCl {
3062
4098
  const origin = `${this.id}-${meth}`;
3063
4099
  log.trace(origin);
3064
4100
 
4101
+ if (this.suspended && this.suspendMode === 'error') {
4102
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
4103
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
4104
+ return callback(null, errorObj);
4105
+ }
4106
+
3065
4107
  /* HERE IS WHERE YOU VALIDATE DATA */
3066
4108
  if (vm === undefined || vm === null || vm === '') {
3067
4109
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -3135,6 +4177,12 @@ class VmwareVCenter extends AdapterBaseCl {
3135
4177
  const origin = `${this.id}-${meth}`;
3136
4178
  log.trace(origin);
3137
4179
 
4180
+ if (this.suspended && this.suspendMode === 'error') {
4181
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
4182
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
4183
+ return callback(null, errorObj);
4184
+ }
4185
+
3138
4186
  /* HERE IS WHERE YOU VALIDATE DATA */
3139
4187
  if (vm === undefined || vm === null || vm === '') {
3140
4188
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -3204,6 +4252,12 @@ class VmwareVCenter extends AdapterBaseCl {
3204
4252
  const origin = `${this.id}-${meth}`;
3205
4253
  log.trace(origin);
3206
4254
 
4255
+ if (this.suspended && this.suspendMode === 'error') {
4256
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
4257
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
4258
+ return callback(null, errorObj);
4259
+ }
4260
+
3207
4261
  /* HERE IS WHERE YOU VALIDATE DATA */
3208
4262
  if (vm === undefined || vm === null || vm === '') {
3209
4263
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -3278,6 +4332,12 @@ class VmwareVCenter extends AdapterBaseCl {
3278
4332
  const origin = `${this.id}-${meth}`;
3279
4333
  log.trace(origin);
3280
4334
 
4335
+ if (this.suspended && this.suspendMode === 'error') {
4336
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
4337
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
4338
+ return callback(null, errorObj);
4339
+ }
4340
+
3281
4341
  /* HERE IS WHERE YOU VALIDATE DATA */
3282
4342
  if (vm === undefined || vm === null || vm === '') {
3283
4343
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -3351,6 +4411,12 @@ class VmwareVCenter extends AdapterBaseCl {
3351
4411
  const origin = `${this.id}-${meth}`;
3352
4412
  log.trace(origin);
3353
4413
 
4414
+ if (this.suspended && this.suspendMode === 'error') {
4415
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
4416
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
4417
+ return callback(null, errorObj);
4418
+ }
4419
+
3354
4420
  /* HERE IS WHERE YOU VALIDATE DATA */
3355
4421
  if (vm === undefined || vm === null || vm === '') {
3356
4422
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -3420,6 +4486,12 @@ class VmwareVCenter extends AdapterBaseCl {
3420
4486
  const origin = `${this.id}-${meth}`;
3421
4487
  log.trace(origin);
3422
4488
 
4489
+ if (this.suspended && this.suspendMode === 'error') {
4490
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
4491
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
4492
+ return callback(null, errorObj);
4493
+ }
4494
+
3423
4495
  /* HERE IS WHERE YOU VALIDATE DATA */
3424
4496
  if (vm === undefined || vm === null || vm === '') {
3425
4497
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -3493,6 +4565,12 @@ class VmwareVCenter extends AdapterBaseCl {
3493
4565
  const origin = `${this.id}-${meth}`;
3494
4566
  log.trace(origin);
3495
4567
 
4568
+ if (this.suspended && this.suspendMode === 'error') {
4569
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
4570
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
4571
+ return callback(null, errorObj);
4572
+ }
4573
+
3496
4574
  /* HERE IS WHERE YOU VALIDATE DATA */
3497
4575
  if (vm === undefined || vm === null || vm === '') {
3498
4576
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -3563,6 +4641,12 @@ class VmwareVCenter extends AdapterBaseCl {
3563
4641
  const origin = `${this.id}-${meth}`;
3564
4642
  log.trace(origin);
3565
4643
 
4644
+ if (this.suspended && this.suspendMode === 'error') {
4645
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
4646
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
4647
+ return callback(null, errorObj);
4648
+ }
4649
+
3566
4650
  /* HERE IS WHERE YOU VALIDATE DATA */
3567
4651
  if (vm === undefined || vm === null || vm === '') {
3568
4652
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -3642,6 +4726,12 @@ class VmwareVCenter extends AdapterBaseCl {
3642
4726
  const origin = `${this.id}-${meth}`;
3643
4727
  log.trace(origin);
3644
4728
 
4729
+ if (this.suspended && this.suspendMode === 'error') {
4730
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
4731
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
4732
+ return callback(null, errorObj);
4733
+ }
4734
+
3645
4735
  /* HERE IS WHERE YOU VALIDATE DATA */
3646
4736
  if (vm === undefined || vm === null || vm === '') {
3647
4737
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -3716,6 +4806,12 @@ class VmwareVCenter extends AdapterBaseCl {
3716
4806
  const origin = `${this.id}-${meth}`;
3717
4807
  log.trace(origin);
3718
4808
 
4809
+ if (this.suspended && this.suspendMode === 'error') {
4810
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
4811
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
4812
+ return callback(null, errorObj);
4813
+ }
4814
+
3719
4815
  /* HERE IS WHERE YOU VALIDATE DATA */
3720
4816
  if (vm === undefined || vm === null || vm === '') {
3721
4817
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -3790,6 +4886,12 @@ class VmwareVCenter extends AdapterBaseCl {
3790
4886
  const origin = `${this.id}-${meth}`;
3791
4887
  log.trace(origin);
3792
4888
 
4889
+ if (this.suspended && this.suspendMode === 'error') {
4890
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
4891
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
4892
+ return callback(null, errorObj);
4893
+ }
4894
+
3793
4895
  /* HERE IS WHERE YOU VALIDATE DATA */
3794
4896
  if (vm === undefined || vm === null || vm === '') {
3795
4897
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -3864,6 +4966,12 @@ class VmwareVCenter extends AdapterBaseCl {
3864
4966
  const origin = `${this.id}-${meth}`;
3865
4967
  log.trace(origin);
3866
4968
 
4969
+ if (this.suspended && this.suspendMode === 'error') {
4970
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
4971
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
4972
+ return callback(null, errorObj);
4973
+ }
4974
+
3867
4975
  /* HERE IS WHERE YOU VALIDATE DATA */
3868
4976
  if (vm === undefined || vm === null || vm === '') {
3869
4977
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -3937,6 +5045,12 @@ class VmwareVCenter extends AdapterBaseCl {
3937
5045
  const origin = `${this.id}-${meth}`;
3938
5046
  log.trace(origin);
3939
5047
 
5048
+ if (this.suspended && this.suspendMode === 'error') {
5049
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
5050
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
5051
+ return callback(null, errorObj);
5052
+ }
5053
+
3940
5054
  /* HERE IS WHERE YOU VALIDATE DATA */
3941
5055
  if (vm === undefined || vm === null || vm === '') {
3942
5056
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -4006,6 +5120,12 @@ class VmwareVCenter extends AdapterBaseCl {
4006
5120
  const origin = `${this.id}-${meth}`;
4007
5121
  log.trace(origin);
4008
5122
 
5123
+ if (this.suspended && this.suspendMode === 'error') {
5124
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
5125
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
5126
+ return callback(null, errorObj);
5127
+ }
5128
+
4009
5129
  /* HERE IS WHERE YOU VALIDATE DATA */
4010
5130
  if (vm === undefined || vm === null || vm === '') {
4011
5131
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -4080,6 +5200,12 @@ class VmwareVCenter extends AdapterBaseCl {
4080
5200
  const origin = `${this.id}-${meth}`;
4081
5201
  log.trace(origin);
4082
5202
 
5203
+ if (this.suspended && this.suspendMode === 'error') {
5204
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
5205
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
5206
+ return callback(null, errorObj);
5207
+ }
5208
+
4083
5209
  /* HERE IS WHERE YOU VALIDATE DATA */
4084
5210
  if (vm === undefined || vm === null || vm === '') {
4085
5211
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -4153,6 +5279,12 @@ class VmwareVCenter extends AdapterBaseCl {
4153
5279
  const origin = `${this.id}-${meth}`;
4154
5280
  log.trace(origin);
4155
5281
 
5282
+ if (this.suspended && this.suspendMode === 'error') {
5283
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
5284
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
5285
+ return callback(null, errorObj);
5286
+ }
5287
+
4156
5288
  /* HERE IS WHERE YOU VALIDATE DATA */
4157
5289
  if (vm === undefined || vm === null || vm === '') {
4158
5290
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -4222,6 +5354,12 @@ class VmwareVCenter extends AdapterBaseCl {
4222
5354
  const origin = `${this.id}-${meth}`;
4223
5355
  log.trace(origin);
4224
5356
 
5357
+ if (this.suspended && this.suspendMode === 'error') {
5358
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
5359
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
5360
+ return callback(null, errorObj);
5361
+ }
5362
+
4225
5363
  /* HERE IS WHERE YOU VALIDATE DATA */
4226
5364
  if (vm === undefined || vm === null || vm === '') {
4227
5365
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -4296,6 +5434,12 @@ class VmwareVCenter extends AdapterBaseCl {
4296
5434
  const origin = `${this.id}-${meth}`;
4297
5435
  log.trace(origin);
4298
5436
 
5437
+ if (this.suspended && this.suspendMode === 'error') {
5438
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
5439
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
5440
+ return callback(null, errorObj);
5441
+ }
5442
+
4299
5443
  /* HERE IS WHERE YOU VALIDATE DATA */
4300
5444
  if (vm === undefined || vm === null || vm === '') {
4301
5445
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -4371,6 +5515,12 @@ class VmwareVCenter extends AdapterBaseCl {
4371
5515
  const origin = `${this.id}-${meth}`;
4372
5516
  log.trace(origin);
4373
5517
 
5518
+ if (this.suspended && this.suspendMode === 'error') {
5519
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
5520
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
5521
+ return callback(null, errorObj);
5522
+ }
5523
+
4374
5524
  /* HERE IS WHERE YOU VALIDATE DATA */
4375
5525
  if (vm === undefined || vm === null || vm === '') {
4376
5526
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -4450,6 +5600,12 @@ class VmwareVCenter extends AdapterBaseCl {
4450
5600
  const origin = `${this.id}-${meth}`;
4451
5601
  log.trace(origin);
4452
5602
 
5603
+ if (this.suspended && this.suspendMode === 'error') {
5604
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
5605
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
5606
+ return callback(null, errorObj);
5607
+ }
5608
+
4453
5609
  /* HERE IS WHERE YOU VALIDATE DATA */
4454
5610
  if (vm === undefined || vm === null || vm === '') {
4455
5611
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -4523,6 +5679,12 @@ class VmwareVCenter extends AdapterBaseCl {
4523
5679
  const origin = `${this.id}-${meth}`;
4524
5680
  log.trace(origin);
4525
5681
 
5682
+ if (this.suspended && this.suspendMode === 'error') {
5683
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
5684
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
5685
+ return callback(null, errorObj);
5686
+ }
5687
+
4526
5688
  /* HERE IS WHERE YOU VALIDATE DATA */
4527
5689
  if (vm === undefined || vm === null || vm === '') {
4528
5690
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -4593,6 +5755,12 @@ class VmwareVCenter extends AdapterBaseCl {
4593
5755
  const origin = `${this.id}-${meth}`;
4594
5756
  log.trace(origin);
4595
5757
 
5758
+ if (this.suspended && this.suspendMode === 'error') {
5759
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
5760
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
5761
+ return callback(null, errorObj);
5762
+ }
5763
+
4596
5764
  /* HERE IS WHERE YOU VALIDATE DATA */
4597
5765
  if (vm === undefined || vm === null || vm === '') {
4598
5766
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -4672,6 +5840,12 @@ class VmwareVCenter extends AdapterBaseCl {
4672
5840
  const origin = `${this.id}-${meth}`;
4673
5841
  log.trace(origin);
4674
5842
 
5843
+ if (this.suspended && this.suspendMode === 'error') {
5844
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
5845
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
5846
+ return callback(null, errorObj);
5847
+ }
5848
+
4675
5849
  /* HERE IS WHERE YOU VALIDATE DATA */
4676
5850
  if (vm === undefined || vm === null || vm === '') {
4677
5851
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -4746,6 +5920,12 @@ class VmwareVCenter extends AdapterBaseCl {
4746
5920
  const origin = `${this.id}-${meth}`;
4747
5921
  log.trace(origin);
4748
5922
 
5923
+ if (this.suspended && this.suspendMode === 'error') {
5924
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
5925
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
5926
+ return callback(null, errorObj);
5927
+ }
5928
+
4749
5929
  /* HERE IS WHERE YOU VALIDATE DATA */
4750
5930
  if (vm === undefined || vm === null || vm === '') {
4751
5931
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -4820,6 +6000,12 @@ class VmwareVCenter extends AdapterBaseCl {
4820
6000
  const origin = `${this.id}-${meth}`;
4821
6001
  log.trace(origin);
4822
6002
 
6003
+ if (this.suspended && this.suspendMode === 'error') {
6004
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
6005
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
6006
+ return callback(null, errorObj);
6007
+ }
6008
+
4823
6009
  /* HERE IS WHERE YOU VALIDATE DATA */
4824
6010
  if (vm === undefined || vm === null || vm === '') {
4825
6011
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -4894,6 +6080,12 @@ class VmwareVCenter extends AdapterBaseCl {
4894
6080
  const origin = `${this.id}-${meth}`;
4895
6081
  log.trace(origin);
4896
6082
 
6083
+ if (this.suspended && this.suspendMode === 'error') {
6084
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
6085
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
6086
+ return callback(null, errorObj);
6087
+ }
6088
+
4897
6089
  /* HERE IS WHERE YOU VALIDATE DATA */
4898
6090
  if (vm === undefined || vm === null || vm === '') {
4899
6091
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -4968,6 +6160,12 @@ class VmwareVCenter extends AdapterBaseCl {
4968
6160
  const origin = `${this.id}-${meth}`;
4969
6161
  log.trace(origin);
4970
6162
 
6163
+ if (this.suspended && this.suspendMode === 'error') {
6164
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
6165
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
6166
+ return callback(null, errorObj);
6167
+ }
6168
+
4971
6169
  /* HERE IS WHERE YOU VALIDATE DATA */
4972
6170
  if (vm === undefined || vm === null || vm === '') {
4973
6171
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -5041,6 +6239,12 @@ class VmwareVCenter extends AdapterBaseCl {
5041
6239
  const origin = `${this.id}-${meth}`;
5042
6240
  log.trace(origin);
5043
6241
 
6242
+ if (this.suspended && this.suspendMode === 'error') {
6243
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
6244
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
6245
+ return callback(null, errorObj);
6246
+ }
6247
+
5044
6248
  /* HERE IS WHERE YOU VALIDATE DATA */
5045
6249
  if (vm === undefined || vm === null || vm === '') {
5046
6250
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -5110,6 +6314,12 @@ class VmwareVCenter extends AdapterBaseCl {
5110
6314
  const origin = `${this.id}-${meth}`;
5111
6315
  log.trace(origin);
5112
6316
 
6317
+ if (this.suspended && this.suspendMode === 'error') {
6318
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
6319
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
6320
+ return callback(null, errorObj);
6321
+ }
6322
+
5113
6323
  /* HERE IS WHERE YOU VALIDATE DATA */
5114
6324
  if (vm === undefined || vm === null || vm === '') {
5115
6325
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -5185,6 +6395,12 @@ class VmwareVCenter extends AdapterBaseCl {
5185
6395
  const origin = `${this.id}-${meth}`;
5186
6396
  log.trace(origin);
5187
6397
 
6398
+ if (this.suspended && this.suspendMode === 'error') {
6399
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
6400
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
6401
+ return callback(null, errorObj);
6402
+ }
6403
+
5188
6404
  /* HERE IS WHERE YOU VALIDATE DATA */
5189
6405
  if (vm === undefined || vm === null || vm === '') {
5190
6406
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -5264,6 +6480,12 @@ class VmwareVCenter extends AdapterBaseCl {
5264
6480
  const origin = `${this.id}-${meth}`;
5265
6481
  log.trace(origin);
5266
6482
 
6483
+ if (this.suspended && this.suspendMode === 'error') {
6484
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
6485
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
6486
+ return callback(null, errorObj);
6487
+ }
6488
+
5267
6489
  /* HERE IS WHERE YOU VALIDATE DATA */
5268
6490
  if (vm === undefined || vm === null || vm === '') {
5269
6491
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -5338,6 +6560,12 @@ class VmwareVCenter extends AdapterBaseCl {
5338
6560
  const origin = `${this.id}-${meth}`;
5339
6561
  log.trace(origin);
5340
6562
 
6563
+ if (this.suspended && this.suspendMode === 'error') {
6564
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
6565
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
6566
+ return callback(null, errorObj);
6567
+ }
6568
+
5341
6569
  /* HERE IS WHERE YOU VALIDATE DATA */
5342
6570
  if (vm === undefined || vm === null || vm === '') {
5343
6571
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -5412,6 +6640,12 @@ class VmwareVCenter extends AdapterBaseCl {
5412
6640
  const origin = `${this.id}-${meth}`;
5413
6641
  log.trace(origin);
5414
6642
 
6643
+ if (this.suspended && this.suspendMode === 'error') {
6644
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
6645
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
6646
+ return callback(null, errorObj);
6647
+ }
6648
+
5415
6649
  /* HERE IS WHERE YOU VALIDATE DATA */
5416
6650
  if (vm === undefined || vm === null || vm === '') {
5417
6651
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -5486,6 +6720,12 @@ class VmwareVCenter extends AdapterBaseCl {
5486
6720
  const origin = `${this.id}-${meth}`;
5487
6721
  log.trace(origin);
5488
6722
 
6723
+ if (this.suspended && this.suspendMode === 'error') {
6724
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
6725
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
6726
+ return callback(null, errorObj);
6727
+ }
6728
+
5489
6729
  /* HERE IS WHERE YOU VALIDATE DATA */
5490
6730
  if (vm === undefined || vm === null || vm === '') {
5491
6731
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -5559,6 +6799,12 @@ class VmwareVCenter extends AdapterBaseCl {
5559
6799
  const origin = `${this.id}-${meth}`;
5560
6800
  log.trace(origin);
5561
6801
 
6802
+ if (this.suspended && this.suspendMode === 'error') {
6803
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
6804
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
6805
+ return callback(null, errorObj);
6806
+ }
6807
+
5562
6808
  /* HERE IS WHERE YOU VALIDATE DATA */
5563
6809
  if (vm === undefined || vm === null || vm === '') {
5564
6810
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -5628,6 +6874,12 @@ class VmwareVCenter extends AdapterBaseCl {
5628
6874
  const origin = `${this.id}-${meth}`;
5629
6875
  log.trace(origin);
5630
6876
 
6877
+ if (this.suspended && this.suspendMode === 'error') {
6878
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
6879
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
6880
+ return callback(null, errorObj);
6881
+ }
6882
+
5631
6883
  /* HERE IS WHERE YOU VALIDATE DATA */
5632
6884
  if (vm === undefined || vm === null || vm === '') {
5633
6885
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -5701,6 +6953,12 @@ class VmwareVCenter extends AdapterBaseCl {
5701
6953
  const origin = `${this.id}-${meth}`;
5702
6954
  log.trace(origin);
5703
6955
 
6956
+ if (this.suspended && this.suspendMode === 'error') {
6957
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
6958
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
6959
+ return callback(null, errorObj);
6960
+ }
6961
+
5704
6962
  /* HERE IS WHERE YOU VALIDATE DATA */
5705
6963
  if (vm === undefined || vm === null || vm === '') {
5706
6964
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -5770,6 +7028,12 @@ class VmwareVCenter extends AdapterBaseCl {
5770
7028
  const origin = `${this.id}-${meth}`;
5771
7029
  log.trace(origin);
5772
7030
 
7031
+ if (this.suspended && this.suspendMode === 'error') {
7032
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
7033
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
7034
+ return callback(null, errorObj);
7035
+ }
7036
+
5773
7037
  /* HERE IS WHERE YOU VALIDATE DATA */
5774
7038
  if (vm === undefined || vm === null || vm === '') {
5775
7039
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -5845,6 +7109,12 @@ class VmwareVCenter extends AdapterBaseCl {
5845
7109
  const origin = `${this.id}-${meth}`;
5846
7110
  log.trace(origin);
5847
7111
 
7112
+ if (this.suspended && this.suspendMode === 'error') {
7113
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
7114
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
7115
+ return callback(null, errorObj);
7116
+ }
7117
+
5848
7118
  /* HERE IS WHERE YOU VALIDATE DATA */
5849
7119
  if (vm === undefined || vm === null || vm === '') {
5850
7120
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -5924,6 +7194,12 @@ class VmwareVCenter extends AdapterBaseCl {
5924
7194
  const origin = `${this.id}-${meth}`;
5925
7195
  log.trace(origin);
5926
7196
 
7197
+ if (this.suspended && this.suspendMode === 'error') {
7198
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
7199
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
7200
+ return callback(null, errorObj);
7201
+ }
7202
+
5927
7203
  /* HERE IS WHERE YOU VALIDATE DATA */
5928
7204
  if (vm === undefined || vm === null || vm === '') {
5929
7205
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -5998,6 +7274,12 @@ class VmwareVCenter extends AdapterBaseCl {
5998
7274
  const origin = `${this.id}-${meth}`;
5999
7275
  log.trace(origin);
6000
7276
 
7277
+ if (this.suspended && this.suspendMode === 'error') {
7278
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
7279
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
7280
+ return callback(null, errorObj);
7281
+ }
7282
+
6001
7283
  /* HERE IS WHERE YOU VALIDATE DATA */
6002
7284
  if (vm === undefined || vm === null || vm === '') {
6003
7285
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -6072,6 +7354,12 @@ class VmwareVCenter extends AdapterBaseCl {
6072
7354
  const origin = `${this.id}-${meth}`;
6073
7355
  log.trace(origin);
6074
7356
 
7357
+ if (this.suspended && this.suspendMode === 'error') {
7358
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
7359
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
7360
+ return callback(null, errorObj);
7361
+ }
7362
+
6075
7363
  /* HERE IS WHERE YOU VALIDATE DATA */
6076
7364
  if (vm === undefined || vm === null || vm === '') {
6077
7365
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -6146,6 +7434,12 @@ class VmwareVCenter extends AdapterBaseCl {
6146
7434
  const origin = `${this.id}-${meth}`;
6147
7435
  log.trace(origin);
6148
7436
 
7437
+ if (this.suspended && this.suspendMode === 'error') {
7438
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
7439
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
7440
+ return callback(null, errorObj);
7441
+ }
7442
+
6149
7443
  /* HERE IS WHERE YOU VALIDATE DATA */
6150
7444
  if (vm === undefined || vm === null || vm === '') {
6151
7445
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -6219,6 +7513,12 @@ class VmwareVCenter extends AdapterBaseCl {
6219
7513
  const origin = `${this.id}-${meth}`;
6220
7514
  log.trace(origin);
6221
7515
 
7516
+ if (this.suspended && this.suspendMode === 'error') {
7517
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
7518
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
7519
+ return callback(null, errorObj);
7520
+ }
7521
+
6222
7522
  /* HERE IS WHERE YOU VALIDATE DATA */
6223
7523
  if (vm === undefined || vm === null || vm === '') {
6224
7524
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -6289,6 +7589,12 @@ class VmwareVCenter extends AdapterBaseCl {
6289
7589
  const origin = `${this.id}-${meth}`;
6290
7590
  log.trace(origin);
6291
7591
 
7592
+ if (this.suspended && this.suspendMode === 'error') {
7593
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
7594
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
7595
+ return callback(null, errorObj);
7596
+ }
7597
+
6292
7598
  /* HERE IS WHERE YOU VALIDATE DATA */
6293
7599
  if (vm === undefined || vm === null || vm === '') {
6294
7600
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -6368,6 +7674,12 @@ class VmwareVCenter extends AdapterBaseCl {
6368
7674
  const origin = `${this.id}-${meth}`;
6369
7675
  log.trace(origin);
6370
7676
 
7677
+ if (this.suspended && this.suspendMode === 'error') {
7678
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
7679
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
7680
+ return callback(null, errorObj);
7681
+ }
7682
+
6371
7683
  /* HERE IS WHERE YOU VALIDATE DATA */
6372
7684
  if (vm === undefined || vm === null || vm === '') {
6373
7685
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -6442,6 +7754,12 @@ class VmwareVCenter extends AdapterBaseCl {
6442
7754
  const origin = `${this.id}-${meth}`;
6443
7755
  log.trace(origin);
6444
7756
 
7757
+ if (this.suspended && this.suspendMode === 'error') {
7758
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
7759
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
7760
+ return callback(null, errorObj);
7761
+ }
7762
+
6445
7763
  /* HERE IS WHERE YOU VALIDATE DATA */
6446
7764
  if (vm === undefined || vm === null || vm === '') {
6447
7765
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -6516,6 +7834,12 @@ class VmwareVCenter extends AdapterBaseCl {
6516
7834
  const origin = `${this.id}-${meth}`;
6517
7835
  log.trace(origin);
6518
7836
 
7837
+ if (this.suspended && this.suspendMode === 'error') {
7838
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
7839
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
7840
+ return callback(null, errorObj);
7841
+ }
7842
+
6519
7843
  /* HERE IS WHERE YOU VALIDATE DATA */
6520
7844
  if (vm === undefined || vm === null || vm === '') {
6521
7845
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -6590,6 +7914,12 @@ class VmwareVCenter extends AdapterBaseCl {
6590
7914
  const origin = `${this.id}-${meth}`;
6591
7915
  log.trace(origin);
6592
7916
 
7917
+ if (this.suspended && this.suspendMode === 'error') {
7918
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
7919
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
7920
+ return callback(null, errorObj);
7921
+ }
7922
+
6593
7923
  /* HERE IS WHERE YOU VALIDATE DATA */
6594
7924
  if (vm === undefined || vm === null || vm === '') {
6595
7925
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -6663,6 +7993,12 @@ class VmwareVCenter extends AdapterBaseCl {
6663
7993
  const origin = `${this.id}-${meth}`;
6664
7994
  log.trace(origin);
6665
7995
 
7996
+ if (this.suspended && this.suspendMode === 'error') {
7997
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
7998
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
7999
+ return callback(null, errorObj);
8000
+ }
8001
+
6666
8002
  /* HERE IS WHERE YOU VALIDATE DATA */
6667
8003
  if (vm === undefined || vm === null || vm === '') {
6668
8004
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -6731,6 +8067,12 @@ class VmwareVCenter extends AdapterBaseCl {
6731
8067
  const origin = `${this.id}-${meth}`;
6732
8068
  log.trace(origin);
6733
8069
 
8070
+ if (this.suspended && this.suspendMode === 'error') {
8071
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
8072
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
8073
+ return callback(null, errorObj);
8074
+ }
8075
+
6734
8076
  /* HERE IS WHERE YOU VALIDATE DATA */
6735
8077
  if (vm === undefined || vm === null || vm === '') {
6736
8078
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -6799,6 +8141,12 @@ class VmwareVCenter extends AdapterBaseCl {
6799
8141
  const origin = `${this.id}-${meth}`;
6800
8142
  log.trace(origin);
6801
8143
 
8144
+ if (this.suspended && this.suspendMode === 'error') {
8145
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
8146
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
8147
+ return callback(null, errorObj);
8148
+ }
8149
+
6802
8150
  /* HERE IS WHERE YOU VALIDATE DATA */
6803
8151
  if (vm === undefined || vm === null || vm === '') {
6804
8152
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -6867,6 +8215,12 @@ class VmwareVCenter extends AdapterBaseCl {
6867
8215
  const origin = `${this.id}-${meth}`;
6868
8216
  log.trace(origin);
6869
8217
 
8218
+ if (this.suspended && this.suspendMode === 'error') {
8219
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
8220
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
8221
+ return callback(null, errorObj);
8222
+ }
8223
+
6870
8224
  /* HERE IS WHERE YOU VALIDATE DATA */
6871
8225
  if (vm === undefined || vm === null || vm === '') {
6872
8226
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -6935,6 +8289,12 @@ class VmwareVCenter extends AdapterBaseCl {
6935
8289
  const origin = `${this.id}-${meth}`;
6936
8290
  log.trace(origin);
6937
8291
 
8292
+ if (this.suspended && this.suspendMode === 'error') {
8293
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
8294
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
8295
+ return callback(null, errorObj);
8296
+ }
8297
+
6938
8298
  /* HERE IS WHERE YOU VALIDATE DATA */
6939
8299
  if (vm === undefined || vm === null || vm === '') {
6940
8300
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['vm'], null, null, null);
@@ -6989,6 +8349,88 @@ class VmwareVCenter extends AdapterBaseCl {
6989
8349
  return callback(null, errorObj);
6990
8350
  }
6991
8351
  }
8352
+
8353
+ /**
8354
+ * @summary Creates a Virtual Machine from the template.
8355
+ *
8356
+ * @function postVcentervmtemplatedeploy
8357
+ * @param {string} item - The identifier of the library item having the ISO image to mount on the virtual machine.
8358
+ * @param {object} requestBody - Specs of the Virtual Machine.
8359
+ * @param {getCallback} callback - a callback function to return the result
8360
+ */
8361
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
8362
+ postVcentervmtemplatedeploy(item, requestBody, callback) {
8363
+ const meth = 'adapter-postVcentervmtemplatedeploy';
8364
+ const origin = `${this.id}-${meth}`;
8365
+ log.trace(origin);
8366
+
8367
+ if (this.suspended && this.suspendMode === 'error') {
8368
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
8369
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
8370
+ return callback(null, errorObj);
8371
+ }
8372
+
8373
+ /* HERE IS WHERE YOU VALIDATE DATA */
8374
+ if (item === undefined || item === null || item === '') {
8375
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['item'], null, null, null);
8376
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
8377
+ return callback(null, errorObj);
8378
+ }
8379
+ if (requestBody === undefined || requestBody === null || requestBody === '') {
8380
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['requestBody'], null, null, null);
8381
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
8382
+ return callback(null, errorObj);
8383
+ }
8384
+
8385
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
8386
+ const queryParamsAvailable = {};
8387
+ const queryParams = {};
8388
+ const pathVars = [item];
8389
+ const bodyVars = requestBody;
8390
+
8391
+ // loop in template. long callback arg name to avoid identifier conflicts
8392
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
8393
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
8394
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
8395
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
8396
+ }
8397
+ });
8398
+
8399
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
8400
+ const reqObj = {
8401
+ payload: bodyVars,
8402
+ uriPathVars: pathVars,
8403
+ uriQuery: queryParams,
8404
+ uriOptions: {}
8405
+ };
8406
+ reqObj.uriOptions.action = 'deploy';
8407
+
8408
+ try {
8409
+ // Make the call -
8410
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
8411
+ return this.requestHandlerInst.identifyRequest('Vmtemplatelibraryitems', 'postVcentervmtemplatedeploy', reqObj, true, (irReturnData, irReturnError) => {
8412
+ // if we received an error or their is no response on the results
8413
+ // return an error
8414
+ if (irReturnError) {
8415
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
8416
+ return callback(null, irReturnError);
8417
+ }
8418
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
8419
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postVcentervmtemplatedeploy'], null, null, null);
8420
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
8421
+ return callback(null, errorObj);
8422
+ }
8423
+
8424
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
8425
+ // return the response
8426
+ return callback(irReturnData, null);
8427
+ });
8428
+ } catch (ex) {
8429
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
8430
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
8431
+ return callback(null, errorObj);
8432
+ }
8433
+ }
6992
8434
  }
6993
8435
 
6994
8436
  module.exports = VmwareVCenter;