@opscompass/opscompass-cli 1.0.40 → 1.0.42

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.
@@ -2,61 +2,69 @@ const { setArgumentArrays } = require("../lib/cliHelpers.js");
2
2
  const { getOpsCompassClient } = require("../opscompass.js");
3
3
  const { utilsModule: utils } = require("../lib/utils.js");
4
4
  const maskValues = require("../lib/maskValues.js");
5
- const { config } = require("openpgp");
6
5
 
7
- /**
8
- * Create a masked configuration to prevent it from being sent to OpsCompass in the clear
9
- *
10
- * @param {string} funcName
11
- * @param {string} configurationName - Name for the specific configuration object
12
- * @param {object} optionalParams - values to send (and potentially mask)
13
- */
14
- async function createMaskedConfig(funcName, configurationName, optionalParams) {
15
- const client = await getOpsCompassClient();
16
-
17
- // Make sure we have a valid function name
18
- if (!funcName || !client.licenseManager[funcName]) {
19
- throw new Error("Invalid function name");
20
- }
21
- // Mask the data
22
- await maskValues.maskObjValues(optionalParams);
23
-
24
- // Call the API
25
- const monitoringConfiguration = await client.licenseManager[funcName](
26
- global.monitoringConfig,
27
- configurationName,
28
- optionalParams
29
- );
30
-
31
- return monitoringConfiguration;
32
- }
6
+ const {
7
+ licenseManagerConfigurationTypes,
8
+ } = require("../environment/current.js");
9
+
10
+ // Masked configurations
11
+ const {
12
+ createMaskedConfig,
13
+ updateMaskedConfig,
14
+ } = require("./license-manager/maskedConfig.js");
15
+
16
+ // Microsoft SQL Server functions
17
+ const {
18
+ printMssqlHelp,
19
+ deleteMssqlEntitlements,
20
+ createMssqlEntitlement,
21
+ updateMssqlEntitlement,
22
+ getMssqlEntitlements,
23
+ getMssqlEntitlementComponents,
24
+ listMssqlAssessments,
25
+ getMssqlAssessment,
26
+ getMssqlAssessmentEntitlements,
27
+ getMssqlAssessmentLicenseUsageMaps,
28
+ getMssqlAssessmentResources,
29
+ checkMssqlConfigMetadata,
30
+ listMssqlConfigurations,
31
+ getMssqlDefaultCredential,
32
+ createMssqlSharedCredential,
33
+ deleteMssqlSharedCredential,
34
+ updateMssqlSharedCredential,
35
+ getMssqlConfiguration,
36
+ createMssqlConfiguration,
37
+ updateMssqlConfiguration,
38
+ updateMssqlConfigurations,
39
+ deleteMssqlConfiguration,
40
+ } = require("./license-manager/microsoft.js");
41
+
42
+ // Vcenter configuration functions
43
+ const {
44
+ printVcenterHelp,
45
+ createVcenterConfiguration,
46
+ deleteVcenterConfiguration,
47
+ listVcenterConfigurations,
48
+ getVcenterConfiguration,
49
+ updateVcenterConfiguration,
50
+ updateVcenterConfigurations,
51
+ } = require("./license-manager/vcenter.js");
52
+
53
+ // Nutanix configuration functions
54
+ const {
55
+ printNutanixHelp,
56
+ createNutanixConfiguration,
57
+ deleteNutanixConfiguration,
58
+ listNutanixConfigurations,
59
+ getNutanixConfiguration,
60
+ updateNutanixConfiguration,
61
+ updateNutanixConfigurations,
62
+ } = require("./license-manager/nutanix.js");
33
63
 
34
64
  /**
35
- * Update a masked configuration to prevent it from being sent to OpsCompass in the clear
36
- *
37
- * @param {string} funcName
38
- * @param {string} configurationId - ID of the configuration to be updated
39
- * @param {object} optionalParams - values to send (and potentially mask)
65
+ * @module license-manager
66
+ * @description License Manager module for OpsCompass CLI
40
67
  */
41
- async function updateMaskedConfig(funcName, configurationId, optionalParams) {
42
- const client = await getOpsCompassClient();
43
-
44
- // Make sure we have a valid function name
45
- if (!funcName || !client.licenseManager[funcName]) {
46
- throw new Error("Invalid function name");
47
- }
48
-
49
- // Mask the data
50
- await maskValues.maskObjValues(optionalParams);
51
-
52
- // Call the API
53
- const targetConfiguration = await client.licenseManager[funcName](
54
- configurationId,
55
- optionalParams
56
- );
57
-
58
- return targetConfiguration;
59
- }
60
68
 
61
69
  async function createOracleSharedCredential(args) {
62
70
  let optionalParams = {};
@@ -146,100 +154,6 @@ async function updateOracleSharedCredential(args) {
146
154
  console.log(JSON.stringify(updateResponse, null, 2));
147
155
  }
148
156
 
149
- async function getMsqlDefaultCredential(args) {
150
- const client = await getOpsCompassClient();
151
- const getResponse = await client.licenseManager.getMsqlDefaultCredential(
152
- global.monitoringConfig
153
- );
154
-
155
- console.log(JSON.stringify(getResponse, null, 2));
156
- }
157
-
158
- async function createMsqlSharedCredential(args) {
159
- let optionalParams = {};
160
- for (let i = 0; i < args.length - 1; i++) {
161
- switch (args[i].toLowerCase()) {
162
- case "--user":
163
- optionalParams.user = args[++i];
164
- break;
165
- case "--password":
166
- optionalParams.password = args[++i];
167
- break;
168
- case "--credential-name":
169
- case "--credentialname":
170
- optionalParams.credentialName = args[++i];
171
- break;
172
- case "--directory-auth":
173
- optionalParams.directory_auth = args[++i];
174
- break;
175
- }
176
- }
177
-
178
- try {
179
- const client = await getOpsCompassClient();
180
- const createResponse =
181
- await client.licenseManager.createMsqlSharedCredential(
182
- global.monitoringConfig,
183
- optionalParams
184
- );
185
-
186
- console.log(JSON.stringify(createResponse, null, 2));
187
- } catch (err) {
188
- console.error(JSON.stringify(err.message, null, 2));
189
- console.error("It is likely the default credential already exists\n");
190
- }
191
- }
192
-
193
- async function deleteMsqlSharedCredential(args) {
194
- let id = undefined;
195
- for (let i = 0; i < args.length - 1; i++) {
196
- switch (args[i].toLowerCase()) {
197
- case "--id":
198
- id = args[++i];
199
- break;
200
- }
201
- }
202
-
203
- const client = await getOpsCompassClient();
204
- const deleteResponse = await client.licenseManager.deleteMsqlSharedCredential(
205
- id
206
- );
207
-
208
- console.log(JSON.stringify(deleteResponse, null, 2));
209
- }
210
-
211
- async function updateMsqlSharedCredential(args) {
212
- let id = undefined;
213
- let optionalParams = {};
214
- for (let i = 0; i < args.length - 1; i++) {
215
- switch (args[i].toLowerCase()) {
216
- case "--id":
217
- id = args[++i];
218
- break;
219
- case "--user":
220
- optionalParams.user = args[++i];
221
- break;
222
- case "--password":
223
- optionalParams.password = args[++i];
224
- break;
225
- case "--credential-name":
226
- case "--credentialname":
227
- optionalParams.credentialName = args[++i];
228
- break;
229
- case "--directory-auth":
230
- optionalParams.directory_auth = args[++i];
231
- break;
232
- }
233
- }
234
- const client = await getOpsCompassClient();
235
- const updateResponse = await client.licenseManager.updateMsqlSharedCredential(
236
- id,
237
- optionalParams
238
- );
239
-
240
- console.log(JSON.stringify(updateResponse, null, 2));
241
- }
242
-
243
157
  async function listMonitoringConfigurations(args) {
244
158
  const client = await getOpsCompassClient();
245
159
  const monitoringConfigs =
@@ -253,38 +167,6 @@ async function maskMonitoringConfigurations(args) {
253
167
  maskValues(action, ...args);
254
168
  }
255
169
 
256
- async function deleteVCenterConfiguration(args) {
257
- let id = undefined;
258
- for (let i = 0; i < args.length - 1; i++) {
259
- switch (args[i].toLowerCase()) {
260
- case "--id":
261
- id = args[++i];
262
- break;
263
- }
264
- }
265
-
266
- const client = await getOpsCompassClient();
267
- const response = await client.licenseManager.deleteVCenterConfiguration(id);
268
-
269
- console.log(JSON.stringify(response, null, 2));
270
- }
271
-
272
- async function deleteMsqlConfiguration(args) {
273
- let id = undefined;
274
- for (let i = 0; i < args.length - 1; i++) {
275
- switch (args[i].toLowerCase()) {
276
- case "--id":
277
- id = args[++i];
278
- break;
279
- }
280
- }
281
-
282
- const client = await getOpsCompassClient();
283
- const response = await client.licenseManager.deleteMsqlConfiguration(id);
284
-
285
- console.log(JSON.stringify(response, null, 2));
286
- }
287
-
288
170
  async function deleteMonitoringConfiguration(args) {
289
171
  let id = undefined;
290
172
  for (let i = 0; i < args.length - 1; i++) {
@@ -320,26 +202,6 @@ async function deleteOracleDatabaseConfiguration(args) {
320
202
  console.log(JSON.stringify(response, null, 2));
321
203
  }
322
204
 
323
- async function deleteMssqlEntitlements(args) {
324
- args = setArgumentArrays(["--id"], args);
325
-
326
- let recordIds = undefined;
327
- for (let i = 0; i < args.length - 1; i++) {
328
- switch (args[i].toLowerCase()) {
329
- case "--id":
330
- recordIds = args[++i];
331
- break;
332
- }
333
- }
334
-
335
- const client = await getOpsCompassClient();
336
- const response = await client.licenseManager.deleteMssqlEntitlements(
337
- global.company,
338
- recordIds
339
- );
340
- console.log(JSON.stringify(response, null, 2));
341
- }
342
-
343
205
  async function listOracleDatabaseConfigurations(args) {
344
206
  const client = await getOpsCompassClient();
345
207
  const monitoringConfigs =
@@ -421,6 +283,9 @@ async function getMonitoringConfiguration(args) {
421
283
  case "--asfile":
422
284
  case "--as-file":
423
285
  optionalParams.asFile = args[++i];
286
+ if (!optionalParams.asFile.match(/^(false)$/i)) {
287
+ optionalParams.asFile = true;
288
+ } else saveFile = false;
424
289
  break;
425
290
  }
426
291
  }
@@ -437,10 +302,7 @@ async function getMonitoringConfiguration(args) {
437
302
  }
438
303
 
439
304
  // Here we have to resolve any locally masked values
440
- if (
441
- optionalParams.hasOwnProperty("asFile") &&
442
- optionalParams.asFile === "true"
443
- ) {
305
+ if (optionalParams.asFile) {
444
306
  await maskValues.unmaskObjValues(monitoringConfiguration);
445
307
  // console.error(
446
308
  // "Unmasked values in the configuration file.",
@@ -478,7 +340,20 @@ async function readMonitoringConfiguration(args) {
478
340
  // If all they want is the details, then just return them
479
341
  if (getPath === true) {
480
342
  const cfgFile = utils.getConfigFilePath(args);
481
- console.log(JSON.stringify(cfgFile, null, 2));
343
+ if (cfgFile) {
344
+ console.log(
345
+ JSON.stringify(
346
+ {
347
+ CUST_NAME: cfgFile.CUST_NAME,
348
+ CUST_TOKEN: cfgFile.CUST_TOKEN,
349
+ configurationId: cfgFile.configurationId,
350
+ filePath: cfgFile.filePath,
351
+ },
352
+ null,
353
+ 2
354
+ )
355
+ );
356
+ } else console.log("undefined");
482
357
  return;
483
358
  }
484
359
  const monitoringConfig = utils.readConfigFile(args);
@@ -522,42 +397,9 @@ async function createMonitoringConfiguration(args) {
522
397
  console.log(JSON.stringify(monitoringConfiguration, null, 2));
523
398
  }
524
399
 
525
- async function listVCenterConfigurations(args) {
526
- const client = await getOpsCompassClient();
527
- const listVCenterConfigs =
528
- await client.licenseManager.listVCenterConfigurations(
529
- global.monitoringConfig
530
- );
531
-
532
- console.log(JSON.stringify(listVCenterConfigs, null, 2));
533
- }
534
-
535
- async function getVCenterConfiguration(args) {
536
- let id = undefined;
537
- for (let i = 0; i < args.length - 1; i++) {
538
- switch (args[i].toLowerCase()) {
539
- case "--id":
540
- id = args[++i];
541
- break;
542
- }
543
- }
544
-
545
- const client = await getOpsCompassClient();
546
- const getVCenterConfig = await client.licenseManager.getVCenterConfiguration(
547
- id
548
- );
549
-
550
- console.log(JSON.stringify(getVCenterConfig, null, 2));
551
- }
552
-
553
- async function createVCenterConfiguration(args) {
400
+ async function createOracleDatabaseConfiguration(args) {
554
401
  let configurationName = undefined;
555
- let optionalParams = {
556
- actions: undefined,
557
- connection: undefined,
558
- user: undefined,
559
- password: undefined,
560
- };
402
+ let optionalParams = {};
561
403
  for (let i = 0; i < args.length - 1; i++) {
562
404
  switch (args[i].toLowerCase()) {
563
405
  case "--name":
@@ -569,237 +411,94 @@ async function createVCenterConfiguration(args) {
569
411
  if (optionalParams.actions === undefined) optionalParams.actions = [];
570
412
  optionalParams.actions.push(args[++i]);
571
413
  break;
572
- case "--connection":
573
- optionalParams.connection = args[++i];
414
+ case "--password":
415
+ optionalParams.password = args[++i];
574
416
  break;
575
417
  case "--user":
576
418
  optionalParams.user = args[++i];
577
419
  break;
578
- case "--password":
579
- optionalParams.password = args[++i];
420
+ case "--server":
421
+ optionalParams.server = args[++i];
580
422
  break;
581
423
  }
582
424
  }
583
425
 
584
- const vCenterConfiguration = await createMaskedConfig(
426
+ const oracleDatabaseConfiguration = await createMaskedConfig(
585
427
  arguments.callee.name,
586
428
  configurationName,
587
429
  optionalParams
588
430
  );
589
- console.log(JSON.stringify(vCenterConfiguration, null, 2));
590
- }
591
-
592
- async function listMsqlConfigurations(args) {
593
- const client = await getOpsCompassClient();
594
- const listMsqlConfigs = await client.licenseManager.listMsqlConfigurations(
595
- global.monitoringConfig
596
- );
597
-
598
- console.log(JSON.stringify(listMsqlConfigs, null, 2));
431
+ console.log(JSON.stringify(oracleDatabaseConfiguration, null, 2));
599
432
  }
600
433
 
601
- async function createMsqlConfiguration(args) {
602
- let configurationName = undefined;
603
- let optionalParams = {
604
- actions: undefined,
605
- server: undefined,
606
- user: undefined,
607
- password: undefined,
608
- directory_auth: undefined,
609
- };
434
+ async function updateMonitoringConfiguration(args) {
435
+ // Prep any arguments that are arrays
436
+ args = setArgumentArrays(["--emailTo", "--notificationEmailTo"], args);
610
437
 
438
+ callParams.id = global.monitoringConfig;
611
439
  for (let i = 0; i < args.length - 1; i++) {
612
440
  switch (args[i].toLowerCase()) {
441
+ case "--id":
442
+ callParams.id = args[++i];
443
+ break;
613
444
  case "--name":
614
- case "--configuration-name":
615
445
  case "--configurationname":
616
- configurationName = args[++i];
446
+ case "--configuration-name":
447
+ callParams.configurationName = args[++i];
617
448
  break;
618
- case "--action":
619
- if (optionalParams.actions === undefined) optionalParams.actions = [];
620
- optionalParams.actions.push(args[++i]);
449
+ case "--autoupdateconfigurations":
450
+ case "--auto-update-configurations":
451
+ callParams.autoUpdateConfigurations = args[++i];
621
452
  break;
622
- case "--server":
623
- optionalParams.server = args[++i];
453
+ case "--autoupdatescripts":
454
+ case "--auto-update-scripts":
455
+ callParams.autoUpdateScripts = args[++i];
624
456
  break;
625
- case "--user":
626
- optionalParams.user = args[++i];
457
+ case "--datafileretaindays":
458
+ callParams.dataFileRetainDays = args[++i];
627
459
  break;
628
- case "--password":
629
- optionalParams.password = args[++i];
460
+ case "--datafileretaintextdays":
461
+ callParams.dataFileRetainTextDays = args[++i];
630
462
  break;
631
- case "--directory-auth":
632
- authArg = args[++i];
633
- if (authArg.toLowerCase === "null") {
634
- optionalParams.directory_auth = null;
635
- } else {
636
- optionalParams.directory_auth = "SESSION";
637
- }
463
+ case "--forcefileencryption":
464
+ callParams.forceFileEncryption = args[++i];
465
+ break;
466
+ case "--datafiletag":
467
+ callParams.dataFileTag = args[++i];
468
+ break;
469
+ case "--mailfrom":
470
+ callParams.mailFrom = args[++i];
471
+ break;
472
+ case "--emailto":
473
+ callParams.emailTo = args[++i];
474
+ break;
475
+ case "--notificationemailto":
476
+ callParams.notificationEmailTo = args[++i];
477
+ break;
478
+ case "--logfileretaindays":
479
+ callParams.logFileRetainDays = args[++i];
480
+ break;
481
+ case "--logfiletag":
482
+ callParams.logFileTag = args[++i];
638
483
  break;
639
484
  }
640
485
  }
641
486
 
642
- const msqlConfiguration = await createMaskedConfig(
643
- arguments.callee.name,
644
- configurationName,
645
- optionalParams
646
- );
647
- console.log(JSON.stringify(msqlConfiguration, null, 2));
487
+ const client = await getOpsCompassClient();
488
+ const monitoringConfiguration =
489
+ await client.licenseManager.updateMonitoringConfiguration(
490
+ callParams.id,
491
+ callParams
492
+ );
493
+
494
+ console.log(JSON.stringify(monitoringConfiguration, null, 2));
648
495
  }
649
496
 
650
- async function getMsqlConfiguration(args) {
651
- let id = undefined;
497
+ async function updateOracleDatabaseConfiguration(args) {
652
498
  for (let i = 0; i < args.length - 1; i++) {
653
499
  switch (args[i].toLowerCase()) {
654
500
  case "--id":
655
- id = args[++i];
656
- break;
657
- }
658
- }
659
-
660
- const client = await getOpsCompassClient();
661
- const getMsqlConfig = await client.licenseManager.getMsqlConfiguration(id);
662
-
663
- console.log(JSON.stringify(getMsqlConfig, null, 2));
664
- }
665
-
666
- async function getMssqlEntitlements(args) {
667
- const client = await getOpsCompassClient();
668
- const mssqlEntitlements = await client.licenseManager.getMssqlEntitlements(
669
- global.company
670
- );
671
-
672
- console.log(JSON.stringify(mssqlEntitlements, null, 2));
673
- }
674
-
675
- async function createOracleDatabaseConfiguration(args) {
676
- let configurationName = undefined;
677
- let optionalParams = {};
678
- for (let i = 0; i < args.length - 1; i++) {
679
- switch (args[i].toLowerCase()) {
680
- case "--name":
681
- case "--configuration-name":
682
- case "--configurationname":
683
- configurationName = args[++i];
684
- break;
685
- case "--action":
686
- if (optionalParams.actions === undefined) optionalParams.actions = [];
687
- optionalParams.actions.push(args[++i]);
688
- break;
689
- case "--password":
690
- optionalParams.password = args[++i];
691
- break;
692
- case "--user":
693
- optionalParams.user = args[++i];
694
- break;
695
- case "--server":
696
- optionalParams.server = args[++i];
697
- break;
698
- }
699
- }
700
-
701
- const oracleDatabaseConfiguration = await createMaskedConfig(
702
- arguments.callee.name,
703
- configurationName,
704
- optionalParams
705
- );
706
- console.log(JSON.stringify(oracleDatabaseConfiguration, null, 2));
707
- }
708
-
709
- /**
710
- * Parse a configuration JSON string
711
- * @param {*} jsonString
712
- * @returns any
713
- */
714
- function parseConfigurationJson(jsonString) {
715
- let obj = JSON.parse("{}");
716
- try {
717
- obj = JSON.parse(jsonString);
718
- if (!Array.isArray(obj)) {
719
- obj = [obj];
720
- }
721
- // If configId (as in data gathering config file), replace with just "id"
722
- for (let i = 0; i < obj.length; i++) {
723
- if (obj[i].config_id && !obj[i].id) {
724
- obj[i].id = obj[i].config_id;
725
- delete obj[i].config_id;
726
- }
727
- }
728
- } catch (err) {
729
- console.error("Invalid JSON string provided.");
730
- return null;
731
- }
732
- return obj;
733
- }
734
-
735
- async function updateMonitoringConfiguration(args) {
736
- // Prep any arguments that are arrays
737
- args = setArgumentArrays(["--emailTo", "--notificationEmailTo"], args);
738
-
739
- callParams.id = global.monitoringConfig;
740
- for (let i = 0; i < args.length - 1; i++) {
741
- switch (args[i].toLowerCase()) {
742
- case "--id":
743
- callParams.id = args[++i];
744
- break;
745
- case "--name":
746
- case "--configurationname":
747
- case "--configuration-name":
748
- callParams.configurationName = args[++i];
749
- break;
750
- case "--autoupdateconfigurations":
751
- case "--auto-update-configurations":
752
- callParams.autoUpdateConfigurations = args[++i];
753
- break;
754
- case "--autoupdatescripts":
755
- case "--auto-update-scripts":
756
- callParams.autoUpdateScripts = args[++i];
757
- break;
758
- case "--datafileretaindays":
759
- callParams.dataFileRetainDays = args[++i];
760
- break;
761
- case "--datafileretaintextdays":
762
- callParams.dataFileRetainTextDays = args[++i];
763
- break;
764
- case "--forcefileencryption":
765
- callParams.forceFileEncryption = args[++i];
766
- break;
767
- case "--datafiletag":
768
- callParams.dataFileTag = args[++i];
769
- break;
770
- case "--mailfrom":
771
- callParams.mailFrom = args[++i];
772
- break;
773
- case "--emailto":
774
- callParams.emailTo = args[++i];
775
- break;
776
- case "--notificationemailto":
777
- callParams.notificationEmailTo = args[++i];
778
- break;
779
- case "--logfileretaindays":
780
- callParams.logFileRetainDays = args[++i];
781
- break;
782
- case "--logfiletag":
783
- callParams.logFileTag = args[++i];
784
- break;
785
- }
786
- }
787
-
788
- const client = await getOpsCompassClient();
789
- const monitoringConfiguration =
790
- await client.licenseManager.updateMonitoringConfiguration(
791
- callParams.id,
792
- callParams
793
- );
794
-
795
- console.log(JSON.stringify(monitoringConfiguration, null, 2));
796
- }
797
-
798
- async function updateOracleDatabaseConfiguration(args) {
799
- for (let i = 0; i < args.length - 1; i++) {
800
- switch (args[i].toLowerCase()) {
801
- case "--id":
802
- callParams.id = args[++i];
501
+ callParams.id = args[++i];
803
502
  break;
804
503
  case "--name":
805
504
  case "--configurationname":
@@ -838,14 +537,14 @@ async function updateOracleDatabaseConfigurations(args) {
838
537
 
839
538
  /* Process bulk update with JSON */
840
539
  if (jsonIndex !== -1) {
841
- const jsonString = args[jsonIndex + 1] || (await utils.readStdin());
540
+ const jsonString = args[jsonIndex + 1] || (await utils.readFromStdinSync());
842
541
  if (!jsonString) {
843
542
  if (process.stdin.isTTY) {
844
543
  console.error("No JSON Oracle DB string provided as argument or stdin");
845
544
  return console.log("");
846
545
  }
847
546
  }
848
- callParamsArray = parseConfigurationJson(jsonString);
547
+ callParamsArray = utils.parseConfigurationJson(jsonString);
849
548
  } else if (idIndex !== -1) {
850
549
  /* If no '--json-update' flag, process bulk update with parameter flags (e.g. --id, --name, etc.) */
851
550
  for (let i = 0; i < args.length - 1; i++) {
@@ -880,6 +579,12 @@ async function updateOracleDatabaseConfigurations(args) {
880
579
  // In case the cut/paste from an local config with values hashed
881
580
  utils.decryptValues(callParamsArray);
882
581
 
582
+ // If the callParamsArray is empty, we have nothing to mask
583
+ if (!callParamsArray) {
584
+ console.warn("No Oracle database configurations provided to update.");
585
+ return console.log("");
586
+ }
587
+
883
588
  // Here we need to mask the callParamsArray object
884
589
  await maskValues.maskObjValues(callParamsArray);
885
590
 
@@ -892,220 +597,6 @@ async function updateOracleDatabaseConfigurations(args) {
892
597
  console.log(JSON.stringify(oracleDatabaseConfigurations, null, 2));
893
598
  }
894
599
 
895
- async function updateVCenterConfiguration(args) {
896
- for (let i = 0; i < args.length - 1; i++) {
897
- switch (args[i].toLowerCase()) {
898
- case "--id":
899
- callParams.id = args[++i];
900
- break;
901
- case "--name":
902
- case "--configurationname":
903
- case "--configuration-name":
904
- callParams.configurationName = args[++i];
905
- break;
906
- case "--action":
907
- if (callParams.actions === undefined) callParams.actions = [];
908
- callParams.actions.push(args[++i]);
909
- break;
910
- case "--connection":
911
- callParams.connection = args[++i];
912
- break;
913
- case "--user":
914
- callParams.user = args[++i];
915
- break;
916
- case "--password":
917
- callParams.password = args[++i];
918
- break;
919
- }
920
- }
921
-
922
- const vCenterConfiguration = await updateMaskedConfig(
923
- arguments.callee.name,
924
- callParams.id,
925
- callParams
926
- );
927
- console.log(JSON.stringify(vCenterConfiguration, null, 2));
928
- }
929
-
930
- async function updateVCenterConfigurations(args) {
931
- let callParamsArray = [];
932
- let jsonIndex = args.indexOf("--json-updates");
933
- let idIndex = args.indexOf("--id");
934
- let callParams = {};
935
-
936
- /* Process bulk update with JSON */
937
- if (jsonIndex !== -1) {
938
- const jsonString = args[jsonIndex + 1] || (await utils.readStdin());
939
- if (!jsonString) {
940
- if (process.stdin.isTTY) {
941
- console.error("No JSON vCenter string provided as argument or stdin");
942
- return console.log("");
943
- }
944
- }
945
- callParamsArray = parseConfigurationJson(jsonString);
946
- } else if (idIndex !== -1) {
947
- /* If no '--json-update' flag, process bulk update with parameter flags (e.g. --id, --name, etc.) */
948
- for (let i = 0; i < args.length - 1; i++) {
949
- if (args[i] === "--id") {
950
- /* Reset callParams object when a second id is encountered */
951
- callParams = {};
952
- /* if theres an existing callParams object, toss it into the array and move on. */
953
- callParamsArray.push(callParams);
954
- /* Create the object's properties based on the index (e.g. if the index is --id, you'll find the value at the next index */
955
- callParams.id = args[i + 1];
956
- } else if (
957
- args[i].toLowerCase() === "--configurationname" ||
958
- args[i].toLowerCase() === "--configuration-name" ||
959
- args[i].toLowerCase() === "--name"
960
- ) {
961
- callParams.configurationName = args[i + 1];
962
- } else if (args[i].toLowerCase() === "--action") {
963
- if (callParams.actions === undefined) callParams.actions = [];
964
- callParams.actions.push(args[i + 1]);
965
- } else if (args[i.toLowerCase] === "--connection") {
966
- callParams.connection = args[i + 1];
967
- } else if (args[i.toLowerCase] === "--user") {
968
- callParams.user = args[i + 1];
969
- } else if (args[i.toLowerCase] === "--password") {
970
- callParams.password = args[i + 1];
971
- }
972
- }
973
- } else {
974
- console.warn("Invalid input, please see help for examples.");
975
- return console.log("");
976
- }
977
- // In case the cut/paste from an local config with values hashed
978
- utils.decryptValues(callParamsArray);
979
-
980
- // Here we need to mask the callParamsArray object
981
- await maskValues.maskObjValues(callParamsArray);
982
-
983
- /* Call the API and print to console */
984
- const client = await getOpsCompassClient();
985
- const vCenterConfigurations =
986
- await client.licenseManager.updateVCenterConfigurations(callParamsArray);
987
- console.log(JSON.stringify(vCenterConfigurations, null, 2));
988
- }
989
-
990
- async function updateMsqlConfiguration(args) {
991
- for (let i = 0; i < args.length - 1; i++) {
992
- switch (args[i].toLowerCase()) {
993
- case "--id":
994
- callParams.id = args[++i];
995
- break;
996
- case "--name":
997
- case "--configurationname":
998
- case "--configuration-name":
999
- callParams.configurationName = args[++i];
1000
- break;
1001
- case "--action":
1002
- if (callParams.actions === undefined) callParams.actions = [];
1003
- callParams.actions.push(args[++i]);
1004
- break;
1005
- case "--server":
1006
- callParams.server = args[++i];
1007
- break;
1008
- case "--user":
1009
- callParams.user = args[++i];
1010
- break;
1011
- case "--password":
1012
- callParams.password = args[++i];
1013
- break;
1014
- case "--directory-auth":
1015
- authArg = args[++i];
1016
- if (authArg.toLowerCase === "null") {
1017
- callParams.directory_auth = null;
1018
- } else {
1019
- callParams.directory_auth = "SESSION";
1020
- }
1021
- break;
1022
- }
1023
- }
1024
-
1025
- const msqlConfiguration = await updateMaskedConfig(
1026
- arguments.callee.name,
1027
- callParams.id,
1028
- callParams
1029
- );
1030
- console.log(JSON.stringify(msqlConfiguration, null, 2));
1031
- }
1032
-
1033
- async function updateMsqlConfigurations(args) {
1034
- let callParamsArray = [];
1035
- let jsonIndex = args.indexOf("--json-updates");
1036
- let idIndex = args.indexOf("--id");
1037
- let callParams = {};
1038
-
1039
- /* Process bulk update with JSON */
1040
- if (jsonIndex !== -1) {
1041
- const jsonString = args[jsonIndex + 1] || (await utils.readStdin());
1042
- if (!jsonString) {
1043
- if (process.stdin.isTTY) {
1044
- console.error(
1045
- "No JSON Microsoft DB string provided as argument or stdin"
1046
- );
1047
- return console.log("");
1048
- }
1049
- }
1050
- callParamsArray = parseConfigurationJson(jsonString);
1051
- /* If no '--json-updates' flag, process bulk update with parameter flags (e.g. --id, --name, etc.) */
1052
- } else if (idIndex !== -1) {
1053
- for (let i = 0; i < args.length - 1; i++) {
1054
- if (args[i] === "--id") {
1055
- /* Reset callParams object when a second id is encountered */
1056
- callParams = {};
1057
- /* if theres an existing callParams object, toss it into the array and move on. */
1058
- callParamsArray.push(callParams);
1059
- /* Create the object's properties based on the index (e.g. if the index is --id, you'll find the value at the next index */
1060
- callParams.id = args[i + 1];
1061
- } else if (
1062
- args[i].toLowerCase() === "--configurationname" ||
1063
- args[i].toLowerCase() === "--configuration-name" ||
1064
- args[i].toLowerCase() === "--name"
1065
- ) {
1066
- callParams.configurationName = args[i + 1];
1067
- } else if (args[i].toLowerCase() === "--action") {
1068
- if (callParams.actions === undefined) callParams.actions = [];
1069
- callParams.actions.push(args[i + 1]);
1070
- } else if (args[i].toLowerCase() === "--server") {
1071
- callParams.server = args[i + 1];
1072
- } else if (args[i].toLowerCase() === "--user") {
1073
- callParams.user = args[i + 1];
1074
- } else if (args[i].toLowerCase() === "--password") {
1075
- callParams.password = args[i + 1];
1076
- } else if (args[i].toLowerCase() === "--directory-auth") {
1077
- authArg = args[i + 1];
1078
- if (authArg.toLowerCase === "null") {
1079
- callParams.directory_auth = null;
1080
- } else {
1081
- callParams.directory_auth = "SESSION";
1082
- }
1083
- }
1084
- }
1085
- } else {
1086
- console.warn("Invalid input, please see help for examples.");
1087
- return console.log("");
1088
- }
1089
- // In case the cut/paste from an local config with values hashed
1090
- utils.decryptValues(callParamsArray);
1091
-
1092
- // Here we need to mask the callParamsArray object
1093
- await maskValues.maskObjValues(callParamsArray);
1094
-
1095
- /* Call the API and print to console */
1096
- const client = await getOpsCompassClient();
1097
- const msqlConfigurations =
1098
- await client.licenseManager.updateMsqlConfigurations(callParamsArray);
1099
- console.log(JSON.stringify(msqlConfigurations, null, 2));
1100
- }
1101
-
1102
- async function getMssqlEntitlementComponents(args) {
1103
- const client = await getOpsCompassClient();
1104
- const entitlementComponents =
1105
- await client.licenseManager.getMssqlEntitlementComponents(global.company);
1106
- console.log(JSON.stringify(entitlementComponents, null, 2));
1107
- }
1108
-
1109
600
  async function deleteNetworkDiscoveryConfiguration(args) {
1110
601
  let id = undefined;
1111
602
  for (let i = 0; i < args.length - 1; i++) {
@@ -1220,258 +711,33 @@ async function createNetworkDiscoveryConfiguration(args) {
1220
711
  break;
1221
712
  case "--subnet-name":
1222
713
  case "--subnetname":
1223
- currentSubnet["name"] = args[++i];
1224
- if (currentSubnet["subnet"] && currentSubnet["name"]) {
1225
- subnets.push(currentSubnet);
1226
- currentSubnet = {};
1227
- }
1228
- break;
1229
- }
1230
- }
1231
-
1232
- const networkDiscoveryConfig = {
1233
- subnets: subnets || undefined,
1234
- dns_servers: dns_servers || undefined,
1235
- ports: ports || undefined,
1236
- };
1237
-
1238
- // Mask the data
1239
- await maskValues.maskObjValues(networkDiscoveryConfig);
1240
-
1241
- const client = await getOpsCompassClient();
1242
- const createdDiscoveryConfig =
1243
- await client.licenseManager.createNetworkDiscoveryConfiguration(
1244
- global.monitoringConfig,
1245
- networkDiscoveryConfig.subnets,
1246
- networkDiscoveryConfig.dns_servers,
1247
- networkDiscoveryConfig.ports
1248
- );
1249
- console.log(JSON.stringify(createdDiscoveryConfig, null, 2));
1250
- }
1251
-
1252
- async function createMssqlEntitlement(args) {
1253
- let newRecord = {
1254
- purchaseDate: undefined,
1255
- quantity: undefined,
1256
- supportStart: undefined,
1257
- supportEnd: undefined,
1258
- msqlProduct: undefined,
1259
- msqlEdition: undefined,
1260
- msqlVersion: undefined,
1261
- msqlMetric: undefined,
1262
- };
1263
- for (let i = 0; i < args.length - 1; i++) {
1264
- switch (args[i].toLowerCase()) {
1265
- case "--purchase-date":
1266
- case "--purchasedate":
1267
- newRecord.purchaseDate = args[++i];
1268
- break;
1269
- case "--quantity":
1270
- newRecord.quantity = args[++i];
1271
- break;
1272
- case "--support-start":
1273
- case "--supportstart":
1274
- newRecord.supportStart = args[++i];
1275
- break;
1276
- case "--support-end":
1277
- case "--supportend":
1278
- newRecord.supportEnd = args[++i];
1279
- break;
1280
- case "--mssql-product":
1281
- case "--mssqlproduct":
1282
- newRecord.msqlProduct = args[++i];
1283
- break;
1284
- case "--mssql-edition":
1285
- case "--mssqledition":
1286
- newRecord.msqlEdition = args[++i];
1287
- break;
1288
- case "--mssql-version":
1289
- case "--mssqlversion":
1290
- newRecord.msqlVersion = args[++i];
1291
- break;
1292
- case "--mssql-metric":
1293
- case "--mssqlmetric":
1294
- newRecord.msqlMetric = args[++i];
1295
- break;
1296
- }
1297
- }
1298
-
1299
- const client = await getOpsCompassClient();
1300
- const response = await client.licenseManager.createMssqlEntitlements(
1301
- global.company,
1302
- [newRecord]
1303
- );
1304
- console.log(JSON.stringify(response, null, 2));
1305
- }
1306
-
1307
- async function updateMssqlEntitlement(args) {
1308
- let updateRecord = {
1309
- id: undefined,
1310
- purchaseDate: undefined,
1311
- quantity: undefined,
1312
- supportStart: undefined,
1313
- supportEnd: undefined,
1314
- msqlProduct: undefined,
1315
- msqlEdition: undefined,
1316
- msqlVersion: undefined,
1317
- msqlMetric: undefined,
1318
- };
1319
- for (let i = 0; i < args.length - 1; i++) {
1320
- switch (args[i].toLowerCase()) {
1321
- case "--id":
1322
- updateRecord.id = args[++i];
1323
- break;
1324
- case "--purchase-date":
1325
- case "--purchasedate":
1326
- updateRecord.purchaseDate = args[++i];
1327
- break;
1328
- case "--quantity":
1329
- updateRecord.quantity = args[++i];
1330
- break;
1331
- case "--support-start":
1332
- case "--supportstart":
1333
- updateRecord.supportStart = args[++i];
1334
- break;
1335
- case "--support-end":
1336
- case "--supportend":
1337
- updateRecord.supportEnd = args[++i];
1338
- break;
1339
- case "--mssql-product":
1340
- case "--mssqlproduct":
1341
- updateRecord.msqlProduct = args[++i];
1342
- break;
1343
- case "--mssql-edition":
1344
- case "--mssqledition":
1345
- updateRecord.msqlEdition = args[++i];
1346
- break;
1347
- case "--mssql-version":
1348
- case "--mssqlversion":
1349
- updateRecord.msqlVersion = args[++i];
1350
- break;
1351
- case "--mssql-metric":
1352
- case "--mssqlmetric":
1353
- updateRecord.msqlMetric = args[++i];
1354
- break;
1355
- }
1356
- }
1357
-
1358
- const client = await getOpsCompassClient();
1359
- const response = await client.licenseManager.updateMssqlEntitlements(
1360
- global.company,
1361
- [updateRecord]
1362
- );
1363
- console.log(JSON.stringify(response, null, 2));
1364
- }
1365
-
1366
- async function listMssqlAssessments(args) {
1367
- const client = await getOpsCompassClient();
1368
- const response = await client.licenseManager.listMssqlAssessments(
1369
- global.company
1370
- );
1371
-
1372
- console.log(JSON.stringify(response, null, 2));
1373
- }
1374
-
1375
- async function getMssqlAssessment(args) {
1376
- let assessmentId = undefined;
1377
- for (let i = 0; i < args.length - 1; i++) {
1378
- switch (args[i].toLowerCase()) {
1379
- case "--assessmentId":
1380
- case "--id":
1381
- case "--assessmentid":
1382
- assessmentId = args[++i];
1383
- break;
1384
- }
1385
- }
1386
-
1387
- const client = await getOpsCompassClient();
1388
- const response = await client.licenseManager.getMssqlAssessment(assessmentId);
1389
-
1390
- console.log(JSON.stringify(response, null, 2));
1391
- }
1392
-
1393
- async function getMssqlAssessmentEntitlements(args) {
1394
- let assessmentId = undefined;
1395
- for (let i = 0; i < args.length - 1; i++) {
1396
- switch (args[i].toLowerCase()) {
1397
- case "--assessmentId":
1398
- case "--id":
1399
- case "--assessmentid":
1400
- assessmentId = args[++i];
1401
- break;
1402
- }
1403
- }
1404
-
1405
- const client = await getOpsCompassClient();
1406
- const response = await client.licenseManager.getMssqlAssessmentEntitlements(
1407
- assessmentId
1408
- );
1409
-
1410
- console.log(JSON.stringify(response, null, 2));
1411
- }
1412
-
1413
- async function getMssqlAssessmentLicenseUsageMaps(args) {
1414
- let assessmentId = undefined;
1415
- for (let i = 0; i < args.length - 1; i++) {
1416
- switch (args[i].toLowerCase()) {
1417
- case "--assessmentId":
1418
- case "--id":
1419
- case "--assessmentid":
1420
- assessmentId = args[++i];
1421
- break;
1422
- }
1423
- }
1424
-
1425
- const client = await getOpsCompassClient();
1426
- const response =
1427
- await client.licenseManager.getMssqlAssessmentLicenseUsageMaps(
1428
- assessmentId
1429
- );
1430
-
1431
- console.log(JSON.stringify(response, null, 2));
1432
- }
1433
-
1434
- async function getMssqlAssessmentResources(args) {
1435
- let assessmentId = undefined;
1436
- for (let i = 0; i < args.length - 1; i++) {
1437
- switch (args[i].toLowerCase()) {
1438
- case "--assessmentId":
1439
- case "--id":
1440
- case "--assessmentid":
1441
- assessmentId = args[++i];
714
+ currentSubnet["name"] = args[++i];
715
+ if (currentSubnet["subnet"] && currentSubnet["name"]) {
716
+ subnets.push(currentSubnet);
717
+ currentSubnet = {};
718
+ }
1442
719
  break;
1443
720
  }
1444
721
  }
1445
722
 
1446
- const client = await getOpsCompassClient();
1447
- const response = await client.licenseManager.getMssqlAssessmentResources(
1448
- assessmentId
1449
- );
1450
-
1451
- console.log(JSON.stringify(response, null, 2));
1452
- }
723
+ const networkDiscoveryConfig = {
724
+ subnets: subnets || undefined,
725
+ dns_servers: dns_servers || undefined,
726
+ ports: ports || undefined,
727
+ };
1453
728
 
1454
- async function checkMssqlConfigMetadata(args) {
1455
- for (let i = 0; i < args.length - 1; i++) {
1456
- switch (args[i].toLowerCase()) {
1457
- case "--account-id":
1458
- case "--accountid":
1459
- callParams.accountId = args[++i];
1460
- break;
1461
- case "--last-collected-before":
1462
- case "--lastcollectedbefore":
1463
- callParams.lastCollectedBefore = args[++i];
1464
- break;
1465
- }
1466
- }
729
+ // Mask the data
730
+ await maskValues.maskObjValues(networkDiscoveryConfig);
1467
731
 
1468
732
  const client = await getOpsCompassClient();
1469
- const response = await client.licenseManager.checkMssqlConfigMetadata(
1470
- callParams.accountId,
1471
- global.company,
1472
- callParams.lastCollectedBefore
1473
- );
1474
- console.log(JSON.stringify(response, null, 2));
733
+ const createdDiscoveryConfig =
734
+ await client.licenseManager.createNetworkDiscoveryConfiguration(
735
+ global.monitoringConfig,
736
+ networkDiscoveryConfig.subnets,
737
+ networkDiscoveryConfig.dns_servers,
738
+ networkDiscoveryConfig.ports
739
+ );
740
+ console.log(JSON.stringify(createdDiscoveryConfig, null, 2));
1475
741
  }
1476
742
 
1477
743
  async function checkOracleConfigMetadata(args) {
@@ -1506,10 +772,11 @@ async function printHelp() {
1506
772
  );
1507
773
  console.log("Parameters:");
1508
774
  console.log(
1509
- "--id [vcenter_configuration_id | oracle_database_configuration_id | mssql_configuration_id | mssql_default_credential_id | oracle_default_credential_id]"
775
+ "--id [{data gathering}_configuration_id] (e.g. oracle, mssql, vcenter, ...)"
1510
776
  );
1511
777
  console.log(
1512
- "--record-type ['oracle_database_configuration' | 'vcenter_configuration' | 'mssql_configuration' | 'mssql_shared_monitoring_credential' | 'oracle_shared_monitoring_credential'"
778
+ "--record-type [%s]",
779
+ licenseManagerConfigurationTypes.join(" | ")
1513
780
  );
1514
781
  console.log();
1515
782
  console.log(
@@ -1544,40 +811,6 @@ async function printHelp() {
1544
811
  console.log("--user (optional) [string]");
1545
812
  console.log("--password (optional) [string]");
1546
813
  console.log();
1547
- console.log(
1548
- "create-mssql-shared-credential",
1549
- "Creates MS SQL shared credentials"
1550
- );
1551
- console.log(
1552
- "--monitoring-configuration-id monitoring configuration ID to make the shared credentials for"
1553
- );
1554
- console.log("--user (optional) [string]");
1555
- console.log("--password (optional) [string]");
1556
- console.log("--directory-auth (optional) 'SESSION' | null");
1557
- console.log();
1558
- console.log(
1559
- "delete-mssql-shared-credential",
1560
- "Delete a MS SQL shared credential"
1561
- );
1562
- console.log("--id ID of the mssql shared credential to delete");
1563
- console.log();
1564
- console.log(
1565
- "get-mssql-default-credential",
1566
- "Get MS SQL default credential record"
1567
- );
1568
- console.log(
1569
- "--monitoring-configuration-id monitoring configuration ID to get the default credentials for"
1570
- );
1571
- console.log();
1572
- console.log(
1573
- "update-mssql-shared-credential",
1574
- "Update MS SQL shared credential record"
1575
- );
1576
- console.log("--id ID of the mssql shared credential to update");
1577
- console.log("--user (optional) [string]");
1578
- console.log("--password (optional) [string]");
1579
- console.log("--directory-auth (optional) 'SESSION' | null");
1580
- console.log();
1581
814
  console.log(
1582
815
  "list-monitoring-configurations",
1583
816
  "Lists all of the monitoring configurations associated with the given company."
@@ -1602,7 +835,7 @@ async function printHelp() {
1602
835
  "--asFile (optional) {true|false} - fetch configuration as a file"
1603
836
  );
1604
837
  console.log(
1605
- "--saveFile (optional) {true|false} [save-path] - save configuration (implies asFile)"
838
+ "--saveFile (optional) {true|false|{save-path}} - save configuration (implies asFile)"
1606
839
  );
1607
840
  console.log();
1608
841
  console.log(
@@ -1698,77 +931,6 @@ async function printHelp() {
1698
931
  console.log("Parameters:");
1699
932
  console.log("--id [oracle_database_configuration_id]");
1700
933
  console.log();
1701
- console.log(
1702
- "list-vcenter-configurations",
1703
- "Lists all of the vcenter configurations associated with the given monitoring configuration"
1704
- );
1705
- console.log("Parameters:");
1706
- console.log("--monitoring-configuration-id [monitoring_configuration_id]");
1707
- console.log();
1708
- console.log(
1709
- "get-vcenter-configuration",
1710
- "Get a single vcenter configuration associated with the given monitoring configuration"
1711
- );
1712
- console.log("Parameters:");
1713
- console.log("--id [vcenter_configuration_id]");
1714
- console.log();
1715
- console.log(
1716
- "create-vcenter-configuration",
1717
- "Create a single vcenter configuration associated with the given monitoring configuration."
1718
- );
1719
- console.log("Parameters:");
1720
- console.log("--monitoring-configuration-id [monitoring_configuration_id]");
1721
- console.log("--name [unique name]");
1722
- console.log(
1723
- `--action (optional) pass multiple times to define which actions this connection can take e.g. --action "skip" --action "vmotion"`
1724
- );
1725
- console.log("--connection (optional) [the hostname or ip address]");
1726
- console.log("--user (optional) [connection username]");
1727
- console.log("--password (optional) [connection password]");
1728
- console.log();
1729
- console.log(
1730
- "list-mssql-configurations",
1731
- "Lists all of the mssql configurations associated with the given monitoring configuration"
1732
- );
1733
- console.log("Parameters:");
1734
- console.log("--monitoring-configuration-id [monitoring_configuration_id]");
1735
- console.log();
1736
- console.log(
1737
- "create-mssql-configuration",
1738
- "Create a single mssql configuration associated with the given monitoring configuration."
1739
- );
1740
- console.log("Parameters:");
1741
- console.log("--monitoring-configuration-id [monitoring_configuration_id]");
1742
- console.log("--name or --configuration-name [unique name]");
1743
- console.log(
1744
- `--action (optional) pass multiple times to define which actions this connection can take e.g. --action "skip" --action "dbcompliance"`
1745
- );
1746
- console.log("--server (optional) [the hostname or ip address]");
1747
- console.log("--user (optional) [connection username]");
1748
- console.log("--password (optional) [connection password]");
1749
- console.log("--directory-auth (optional) ['SESSION' or NULL]");
1750
- console.log();
1751
- console.log(
1752
- "get-mssql-configuration",
1753
- "Get a single mssql configuration associated with the given monitoring configuration"
1754
- );
1755
- console.log("Parameters:");
1756
- console.log("--id [mssql_configuration_id]");
1757
- console.log();
1758
- console.log(
1759
- "create-oracle-database-configuration",
1760
- "Create a single oracle database configuration associated with the given monitoring configuration."
1761
- );
1762
- console.log("Parameters:");
1763
- console.log("--monitoring-configuration-id [monitoring_configuration_id]");
1764
- console.log("--configuration-name [unique name]");
1765
- console.log(
1766
- `--action (optional) pass multiple times to define which actions this connection can take e.g. --action "skip" --action "dbcompliance"`
1767
- );
1768
- console.log("--user (optional) [user to use for connection]");
1769
- console.log("--password (optional) [password to use for connection]");
1770
- console.log("--server (optional) [server to use for connection]");
1771
- console.log();
1772
934
  console.log(
1773
935
  "update-monitoring-configuration",
1774
936
  "Update a single monitoring configuration."
@@ -1814,7 +976,7 @@ async function printHelp() {
1814
976
  console.log("--id [configuration id]");
1815
977
  console.log("--name or --configuration-name (optional) [unique name]");
1816
978
  console.log(
1817
- `--action (optional) pass multiple times to define which actions this connection can take --action "skip" --action "dbcompliance"`
979
+ `--action (optional) pass multiple times to define which actions this configuration can take --action "skip" --action "dbcompliance"`
1818
980
  );
1819
981
  console.log("--user (optional) [user to use for connection]");
1820
982
  console.log("--password (optional) [password to use for connection]");
@@ -1828,7 +990,7 @@ async function printHelp() {
1828
990
  console.log("--id [configuration id]");
1829
991
  console.log("--name or --configuration-name (optional) [unique name]");
1830
992
  console.log(
1831
- `--action (optional) pass multiple times to define which actions this connection can take e.g. --action "skip" --action "dbcompliance"`
993
+ `--action (optional) pass multiple times to define which actions this configuration can take e.g. --action "skip" --action "dbcompliance"`
1832
994
  );
1833
995
  console.log("--user (optional) [the user to use for the connection]");
1834
996
  console.log("--password (optional) [the password to use for the connection]");
@@ -1845,45 +1007,6 @@ async function printHelp() {
1845
1007
  `e.g. opscompass license-manager update-oracle-database-configurations --json-updates '[{\"id\":\"57\",\"configurationName\":\"updatedName\"},{\"id\":\"77\", \"configurationName\":\"otherUpdatedName\", \"action\":\"null\"},{\"id\":\"79\", \"configurationName\":\"lastUpdatedName\"}]'`
1846
1008
  );
1847
1009
  console.log();
1848
- console.log(
1849
- "update-vcenter-configuration",
1850
- "Update a single vcenter configuration."
1851
- );
1852
- console.log("Parameters:");
1853
- console.log("--id [configuration id]");
1854
- console.log("--name or --configuration-name (optional) [unique name]");
1855
- console.log(
1856
- "--action (optional) pass multiple times to define which actions this connection can take e.g. --action 'skip' --action 'vmotion']"
1857
- );
1858
- console.log("--connection (optional) [the hostname or ip address]");
1859
- console.log("--user (optional) [connection username]");
1860
- console.log("--password (optional) [connection password]");
1861
- console.log();
1862
- console.log(
1863
- "update-vcenter-configurations",
1864
- "Bulk Update vcenter configurations."
1865
- );
1866
- console.log("Parameters:");
1867
- console.log("--id [configuration id]");
1868
- console.log("--name or --configuration-name (optional) [unique name]");
1869
- console.log(
1870
- `--action (optional) pass multiple times to define which actions this connection can take e.g. --action "skip" --action "vmotion"`
1871
- );
1872
- console.log("--connection (optional) [the hostname or ip address]");
1873
- console.log("--user (optional) [connection username]");
1874
- console.log("--password (optional) [connection password]");
1875
- console.log("OR --json-updates [stringified json objects with your updates]");
1876
- console.log("For quick updates, you may use the above parameters");
1877
- console.log(
1878
- `e.g. opscompass license-manager update-vcenter-configurations --id 137 --name "updatedName" --id 138 --name "otherUpdatedName" --id 144 --name "lastUpdatedName" --action "skip" --action "vmotion";`
1879
- );
1880
- console.log(
1881
- "For larger updates, JavaScript Object Notation (JSON) may be used with the --json-updates flag"
1882
- );
1883
- console.log(
1884
- `e.g. opscompass license-manager update-vcenter-configurations --json-updates '[{\"id\":\"137\",\"configurationName\":\"updatedName\"},{\"id\":\"138\",\"configurationName\":\"otherUpdatedName\"},{\"id\":\"144\",\"configurationName\":\"lastUpdatedName\", \"actions\":[\"skip\", \"vmotion\"]}]'`
1885
- );
1886
- console.log();
1887
1010
  console.log(
1888
1011
  "delete-monitoring-configuration",
1889
1012
  "Delete a monitoring configuration"
@@ -1905,182 +1028,6 @@ async function printHelp() {
1905
1028
  console.log("Parameters:");
1906
1029
  console.log("--id [oracle_database_configuration_id]");
1907
1030
  console.log();
1908
- console.log("delete-vcenter-configuration", "Delete a vcenter configuration");
1909
- console.log("Parameters:");
1910
- console.log("--id [vcenter_configuration_id]");
1911
- console.log();
1912
- console.log("delete-mssql-configuration", "Delete a mssql configuration");
1913
- console.log("Parameters:");
1914
- console.log("--id [mssql_configuration_id]");
1915
- console.log();
1916
- console.log(
1917
- "update-mssql-configuration",
1918
- "Update a single mssql configuration."
1919
- );
1920
- console.log("Parameters:");
1921
- console.log("--id [configuration id]");
1922
- console.log("--name or --configuration-name (optional) [unique name]");
1923
- console.log(
1924
- "--action (optional) pass multiple times to define which actions this connection can take e.g. --action 'skip' --action 'dblicensing'"
1925
- );
1926
- console.log("--server (optional) [the server]");
1927
- console.log("--user (optional) [connection username]");
1928
- console.log("--password (optional) [connection password]");
1929
- console.log("--directory-auth (optional) ['SESSION' or NULL]");
1930
- console.log();
1931
- console.log();
1932
- console.log(
1933
- "update-mssql-configurations",
1934
- "Bulk Update MS SQL Configurations."
1935
- );
1936
- console.log("Parameters:");
1937
- console.log("--id [configuration id]");
1938
- console.log("--name or --configuration-name (optional) [unique name]");
1939
- console.log(
1940
- "--action (optional) pass multiple times to define which actions this connection can take e.g. --action 'skip' --action 'dblicensing'"
1941
- );
1942
- console.log("--server (optional) [the server]");
1943
- console.log("--user (optional) [connection username]");
1944
- console.log("--password (optional) [connection password]");
1945
- console.log("--directory-auth (optional) ['SESSION' or NULL]");
1946
- console.log("OR --json-updates [stringified json objects with your updates]");
1947
- console.log("For quick updates, you may use the above parameters");
1948
- console.log(
1949
- `e.g. opscompass license-manager update-mssql-configurations --id 31 --name "newname" --server "233.533.343" --user "joe" --action "skip" --id 25 --name "secondname" --action "skip" --action "dblicensing"`
1950
- );
1951
- console.log(
1952
- "For larger updates, JavaScript Object Notation (JSON) may be used with the --json-updates flag"
1953
- );
1954
- console.log(
1955
- `e.g. opscompass license-manager update-mssql-configurations --json-updates '[{\"id\":\"25\",\"configurationName\":\"25\", \"server\":\"100.232.2423\", \"user\":\"tony\", \"actions\":[\"skip\", \"dblicensing\"]}, {\"id\":\"31\",\"configurationName\":\"31\", \"server\":\"100.232.2423\", \"user\":\"tony\", \"actions\":[\"skip\", \"dblicensing\"]}]'`
1956
- );
1957
- console.log();
1958
- console.log(
1959
- "get-mssql-entitlement-components",
1960
- "Gets the components that can be used to build MSSql entitlement objects."
1961
- );
1962
- console.log("Parameters:");
1963
- console.log(`--company [company_slug] (default: ${global.company})\n`);
1964
- console.log();
1965
- console.log(
1966
- "create-mssql-entitlement",
1967
- "Creates a Mssql Entitlement record."
1968
- );
1969
- console.log("Parameters:");
1970
- console.log(`--company [company_slug] (default: ${global.company})\n`);
1971
- console.log("--purchase-date [Date] the date of purchase.");
1972
- console.log(
1973
- "Format: UTC, example: '2022-08-23T17:00:00Z' to set August 8th, 2022 at 17:00 UTC."
1974
- );
1975
- console.log("--quantity [number] the number for this entry");
1976
- console.log(
1977
- "--support-start (optional) [Date] the date when support started"
1978
- );
1979
- console.log(
1980
- "Format: UTC, example: '2022-08-23T17:00:00Z' to set August 8th, 2022 at 17:00 UTC."
1981
- );
1982
- console.log("--support-end (optional) [Date] the date when support ended");
1983
- console.log(
1984
- "Format: UTC, example: '2022-08-23T17:00:00Z' to set August 8th, 2022 at 17:00 UTC."
1985
- );
1986
- console.log(
1987
- "--mssql-product [string] the slug of the associated mssql product"
1988
- );
1989
- console.log(
1990
- "--mssql-edition [string] the slug of the associated mssql edition"
1991
- );
1992
- console.log(
1993
- "--mssql-version [string] the slug of the associated mssql version"
1994
- );
1995
- console.log(
1996
- "--mssql-metric [string] the slug of the associated mssql metric"
1997
- );
1998
- console.log();
1999
- console.log(
2000
- "update-mssql-entitlement",
2001
- "Creates a Mssql Entitlement record."
2002
- );
2003
- console.log("Parameters:");
2004
- console.log(`--company [company_slug] (default: ${global.company})\n`);
2005
- console.log("--id [number] the mssql entitlement record id");
2006
- console.log("--purchase-date [Date] the date of purchase.");
2007
- console.log(
2008
- "Format: UTC, example: '2022-08-23T17:00:00Z' to set August 8th, 2022 at 17:00 UTC."
2009
- );
2010
- console.log("--quantity [number] the number for this entry");
2011
- console.log(
2012
- "--support-start (optional) [Date] the date when support started"
2013
- );
2014
- console.log(
2015
- "Format: UTC, example: '2022-08-23T17:00:00Z' to set August 8th, 2022 at 17:00 UTC."
2016
- );
2017
- console.log("--support-end (optional) [Date] the date when support ended");
2018
- console.log(
2019
- "Format: UTC, example: '2022-08-23T17:00:00Z' to set August 8th, 2022 at 17:00 UTC."
2020
- );
2021
- console.log(
2022
- "--mssql-product [string] the slug of the associated mssql product"
2023
- );
2024
- console.log(
2025
- "--mssql-edition [string] the slug of the associated mssql edition"
2026
- );
2027
- console.log(
2028
- "--mssql-version [string] the slug of the associated mssql version"
2029
- );
2030
- console.log(
2031
- "--mssql-metric [string] the slug of the associated mssql metric"
2032
- );
2033
- console.log();
2034
- console.log(
2035
- "delete-mssql-entitlements",
2036
- "Deletes Mssql Entitlement records."
2037
- );
2038
- console.log("Parameters:");
2039
- console.log(`--company [company_slug] (default: ${global.company})\n`);
2040
- console.log(
2041
- "--id [string] Use parameter multiple times to delete multiple records."
2042
- );
2043
- console.log();
2044
- console.log("list-mssql-assessments", "Lists MSSQL Assessments");
2045
- console.log("Parameters:");
2046
- console.log(`--company [company_slug] (default: ${global.company})\n`);
2047
- console.log();
2048
- console.log("get-mssql-assessment", "Get Full MSSQL Assessment");
2049
- console.log("Parameters:");
2050
- console.log("--assessmentId [number] The id of the assessment to retrieve.");
2051
- console.log();
2052
- console.log(
2053
- "get-mssql-assessment-entitlements",
2054
- "Gets Entitlements for an MSSQL Assessment"
2055
- );
2056
- console.log("Parameters:");
2057
- console.log("--assessmentId [number] The id of the assessment to retrieve.");
2058
- console.log();
2059
- console.log(
2060
- "(DEPRECATED) get-mssql-assessment-license-usage-maps",
2061
- "Gets LicenseUsageMaps for an MSSQL Assessment"
2062
- );
2063
- console.log("Parameters:");
2064
- console.log("--assessmentId [number] The id of the assessment to retrieve.");
2065
- console.log();
2066
- console.log(
2067
- "(DEPRECATED) get-mssql-assessment-resources",
2068
- "Gets Resources for an MSSQL Assessment"
2069
- );
2070
- console.log("Parameters:");
2071
- console.log("--assessmentId [number] The id of the assessment to retrieve.");
2072
- console.log();
2073
- console.log(
2074
- "check-mssql-config-metadata",
2075
- "Checks the mssql configuration metadata for a company."
2076
- );
2077
- console.log("Parameters:");
2078
- console.log("--accountId [string] The account id for the company.");
2079
- console.log(`--company [company_slug] (default: ${global.company})\n`);
2080
- console.log(
2081
- "--lastCollectedBefore [string] (optional) Only returns records that have not been collected since the given date. Format: UTC, example: '2022-08-23T17:00:00Z'"
2082
- );
2083
- console.log();
2084
1031
  console.log(
2085
1032
  "check-oracle-config-metadata",
2086
1033
  "Checks the oracle configuration metadata for a company."
@@ -2092,6 +1039,15 @@ async function printHelp() {
2092
1039
  "--lastCollectedBefore [string] (optional) Only returns records that have not been collected since the given date. Format: UTC, example: '2022-08-23T17:00:00Z'"
2093
1040
  );
2094
1041
  console.log();
1042
+
1043
+ // Add Mssql help
1044
+ printMssqlHelp();
1045
+
1046
+ // Add Vcenter help
1047
+ printVcenterHelp();
1048
+
1049
+ // Add Nutanix help
1050
+ printNutanixHelp();
2095
1051
  }
2096
1052
 
2097
1053
  const licenseManagerModule = (action, ...args) => {
@@ -2107,16 +1063,16 @@ const licenseManagerModule = (action, ...args) => {
2107
1063
  return updateOracleSharedCredential(args);
2108
1064
  case "create-msql-shared-credential":
2109
1065
  case "create-mssql-shared-credential":
2110
- return createMsqlSharedCredential(args);
1066
+ return createMssqlSharedCredential(args);
2111
1067
  case "delete-msql-shared-credential":
2112
1068
  case "delete-mssql-shared-credential":
2113
- return deleteMsqlSharedCredential(args);
1069
+ return deleteMssqlSharedCredential(args);
2114
1070
  case "get-msql-default-credential":
2115
1071
  case "get-mssql-default-credential":
2116
- return getMsqlDefaultCredential(args);
1072
+ return getMssqlDefaultCredential(args);
2117
1073
  case "update-msql-shared-credential":
2118
1074
  case "update-mssql-shared-credential":
2119
- return updateMsqlSharedCredential(args);
1075
+ return updateMssqlSharedCredential(args);
2120
1076
  case "create-network-discovery-configuration":
2121
1077
  return createNetworkDiscoveryConfiguration(args);
2122
1078
  case "update-network-discovery-configuration":
@@ -2143,21 +1099,15 @@ const licenseManagerModule = (action, ...args) => {
2143
1099
  return readMonitoringConfiguration(args);
2144
1100
  case "create-monitoring-configuration":
2145
1101
  return createMonitoringConfiguration(args);
2146
- case "list-vcenter-configurations":
2147
- return listVCenterConfigurations(args);
2148
- case "get-vcenter-configuration":
2149
- return getVCenterConfiguration(args);
2150
- case "create-vcenter-configuration":
2151
- return createVCenterConfiguration(args);
2152
1102
  case "list-msql-configurations":
2153
1103
  case "list-mssql-configurations":
2154
- return listMsqlConfigurations(args);
1104
+ return listMssqlConfigurations(args);
2155
1105
  case "create-msql-configuration":
2156
1106
  case "create-mssql-configuration":
2157
- return createMsqlConfiguration(args);
1107
+ return createMssqlConfiguration(args);
2158
1108
  case "get-msql-configuration":
2159
1109
  case "get-mssql-configuration":
2160
- return getMsqlConfiguration(args);
1110
+ return getMssqlConfiguration(args);
2161
1111
  case "get-network-discovery-configuration":
2162
1112
  return getNetworkDiscoveryConfiguration(args);
2163
1113
  case "get-mssql-entitlements":
@@ -2174,27 +1124,21 @@ const licenseManagerModule = (action, ...args) => {
2174
1124
  return updateOracleDatabaseConfiguration(args);
2175
1125
  case "update-oracle-database-configurations":
2176
1126
  return updateOracleDatabaseConfigurations(args);
2177
- case "update-vcenter-configuration":
2178
- return updateVCenterConfiguration(args);
2179
- case "update-vcenter-configurations":
2180
- return updateVCenterConfigurations(args);
2181
1127
  case "delete-network-discovery-configuration":
2182
1128
  return deleteNetworkDiscoveryConfiguration(args);
2183
1129
  case "delete-monitoring-configuration":
2184
1130
  return deleteMonitoringConfiguration(args);
2185
1131
  case "delete-oracle-database-configuration":
2186
1132
  return deleteOracleDatabaseConfiguration(args);
2187
- case "delete-vcenter-configuration":
2188
- return deleteVCenterConfiguration(args);
2189
1133
  case "delete-msql-configuration":
2190
1134
  case "delete-mssql-configuration":
2191
- return deleteMsqlConfiguration(args);
1135
+ return deleteMssqlConfiguration(args);
2192
1136
  case "update-msql-configuration":
2193
1137
  case "update-mssql-configuration":
2194
- return updateMsqlConfiguration(args);
1138
+ return updateMssqlConfiguration(args);
2195
1139
  case "update-msql-configurations":
2196
1140
  case "update-mssql-configurations":
2197
- return updateMsqlConfigurations(args);
1141
+ return updateMssqlConfigurations(args);
2198
1142
  case "get-mssql-entitlement-components":
2199
1143
  return getMssqlEntitlementComponents(args);
2200
1144
  case "create-mssql-entitlement":
@@ -2207,6 +1151,30 @@ const licenseManagerModule = (action, ...args) => {
2207
1151
  return checkMssqlConfigMetadata(args);
2208
1152
  case "check-oracle-config-metadata":
2209
1153
  return checkOracleConfigMetadata(args);
1154
+ case "list-vcenter-configurations":
1155
+ return listVcenterConfigurations(args);
1156
+ case "get-vcenter-configuration":
1157
+ return getVcenterConfiguration(args);
1158
+ case "create-vcenter-configuration":
1159
+ return createVcenterConfiguration(args);
1160
+ case "update-vcenter-configuration":
1161
+ return updateVcenterConfiguration(args);
1162
+ case "update-vcenter-configurations":
1163
+ return updateVcenterConfigurations(args);
1164
+ case "delete-vcenter-configuration":
1165
+ return deleteVcenterConfiguration(args);
1166
+ case "list-nutanix-configurations":
1167
+ return listNutanixConfigurations(args);
1168
+ case "get-nutanix-configuration":
1169
+ return getNutanixConfiguration(args);
1170
+ case "create-nutanix-configuration":
1171
+ return createNutanixConfiguration(args);
1172
+ case "update-nutanix-configuration":
1173
+ return updateNutanixConfiguration(args);
1174
+ case "update-nutanix-configurations":
1175
+ return updateNutanixConfigurations(args);
1176
+ case "delete-nutanix-configuration":
1177
+ return deleteNutanixConfiguration(args);
2210
1178
  case "help":
2211
1179
  case "":
2212
1180
  return printHelp();