@opscompass/opscompass-cli 1.0.7 → 1.0.10

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.
@@ -0,0 +1,607 @@
1
+
2
+ const { setArgumentArrays } = require("../lib/cliHelpers.js");
3
+ const { getOpsCompassClient } = require("../opscompass.js");
4
+
5
+ async function listMonitoringConfigurations(args) {
6
+ let company = undefined;
7
+ for (let i = 0; i < args.length - 1; i++) {
8
+ switch (args[i].toLowerCase()) {
9
+ case "--company":
10
+ company = args[++i];
11
+ break;
12
+ }
13
+ }
14
+
15
+ const client = await getOpsCompassClient();
16
+ const monitoringConfigs = await client.licenseManager.listMonitoringConfigurations(company);
17
+
18
+ console.log(JSON.stringify(monitoringConfigs, null, 2));
19
+ }
20
+
21
+ async function deleteVCenterConfiguration(args){
22
+ let id = undefined;
23
+ for (let i = 0; i < args.length - 1; i++) {
24
+ switch (args[i].toLowerCase()) {
25
+ case "--id":
26
+ id = args[++i];
27
+ break;
28
+ }
29
+ }
30
+
31
+ const client = await getOpsCompassClient();
32
+ const response = await client.licenseManager.deleteVCenterConfiguration(id);
33
+
34
+ console.log(JSON.stringify(response, null, 2));
35
+ }
36
+
37
+ async function deleteMonitoringConfiguration(args){
38
+ let id = undefined;
39
+ for (let i = 0; i < args.length - 1; i++) {
40
+ switch (args[i].toLowerCase()) {
41
+ case "--id":
42
+ id = args[++i];
43
+ break;
44
+ }
45
+ }
46
+
47
+ const client = await getOpsCompassClient();
48
+ const response = await client.licenseManager.deleteMonitoringConfiguration(id);
49
+
50
+ console.log(JSON.stringify(response, null, 2));
51
+ }
52
+
53
+ async function deleteOracleDatabaseConfiguration(args){
54
+ let id = undefined;
55
+ for (let i = 0; i < args.length - 1; i++) {
56
+ switch (args[i].toLowerCase()) {
57
+ case "--id":
58
+ id = args[++i];
59
+ break;
60
+ }
61
+ }
62
+
63
+ const client = await getOpsCompassClient();
64
+ const response = await client.licenseManager.deleteOracleDatabaseConfiguration(id);
65
+
66
+ console.log(JSON.stringify(response, null, 2));
67
+ }
68
+
69
+ async function listOracleDatabaseConfigurations(args) {
70
+ let monitoringConfigurationId = undefined;
71
+ for (let i = 0; i < args.length - 1; i++) {
72
+ switch (args[i].toLowerCase()) {
73
+ case "--monitoringconfigurationid":
74
+ monitoringConfigurationId = args[++i];
75
+ break;
76
+ }
77
+ }
78
+
79
+ const client = await getOpsCompassClient();
80
+ const monitoringConfigs = await client.licenseManager.listOracleDatabaseConfigurations(monitoringConfigurationId);
81
+
82
+ console.log(JSON.stringify(monitoringConfigs, null, 2));
83
+ }
84
+
85
+ async function getOracleDatabaseConfiguration(args) {
86
+ let id = undefined;
87
+ for (let i = 0; i < args.length - 1; i++) {
88
+ switch (args[i].toLowerCase()) {
89
+ case "--id":
90
+ id = args[++i];
91
+ break;
92
+ }
93
+ }
94
+
95
+ const client = await getOpsCompassClient();
96
+ const monitoringConfigs = await client.licenseManager.getOracleDatabaseConfiguration(id);
97
+
98
+ console.log(JSON.stringify(monitoringConfigs, null, 2));
99
+ }
100
+
101
+ async function getSecretForConfiguration(args){
102
+ let id = undefined;
103
+ let recordType = undefined;
104
+ for (let i = 0; i < args.length - 1; i++) {
105
+ switch (args[i].toLowerCase()) {
106
+ case "--id":
107
+ id = args[++i];
108
+ break;
109
+ case "--recordtype":
110
+ recordType = args[++i];
111
+ break;
112
+ }
113
+ }
114
+
115
+ const client = await getOpsCompassClient();
116
+ const monitoringConfig = await client.licenseManager.getSecretForConfiguration(id, recordType);
117
+
118
+ console.log(JSON.stringify(monitoringConfig, null, 2));
119
+ }
120
+
121
+ async function getMonitoringConfiguration(args) {
122
+ let id = undefined;
123
+ let optionalParams = { asFile: undefined }
124
+ for (let i = 0; i < args.length - 1; i++) {
125
+ switch (args[i].toLowerCase()) {
126
+ case "--id":
127
+ id = args[++i];
128
+ break;
129
+ case "--asfile":
130
+ optionalParams.asFile = args[++i];
131
+ break;
132
+ }
133
+ }
134
+
135
+ const client = await getOpsCompassClient();
136
+ const monitoringConfig = await client.licenseManager.getMonitoringConfiguration(id, optionalParams);
137
+
138
+ console.log(JSON.stringify(monitoringConfig, null, 2));
139
+ }
140
+
141
+ async function createMonitoringConfiguration(args) {
142
+ let company = undefined;
143
+ let name = undefined;
144
+ for (let i = 0; i < args.length - 1; i++) {
145
+ switch (args[i].toLowerCase()) {
146
+ case "--company":
147
+ company = args[++i];
148
+ break;
149
+ case "--configurationname":
150
+ name = args[++i];
151
+ break;
152
+ }
153
+ }
154
+
155
+ const client = await getOpsCompassClient();
156
+ const monitoringConfig = await client.licenseManager.createMonitoringConfiguration(company, name);
157
+
158
+ console.log(JSON.stringify(monitoringConfig, null, 2));
159
+ }
160
+
161
+ async function listVCenterConfigurations(args) {
162
+ let id = undefined;
163
+ for (let i = 0; i < args.length - 1; i++) {
164
+ switch (args[i].toLowerCase()) {
165
+ case "--monitoringconfigurationid":
166
+ id = args[++i];
167
+ break;
168
+ }
169
+ }
170
+
171
+ const client = await getOpsCompassClient();
172
+ const listVCenterConfigs = await client.licenseManager.listVCenterConfigurations(id);
173
+
174
+ console.log(JSON.stringify(listVCenterConfigs, null, 2));
175
+ }
176
+
177
+ async function getVCenterConfiguration(args) {
178
+ let id = undefined;
179
+ for (let i = 0; i < args.length - 1; i++) {
180
+ switch (args[i].toLowerCase()) {
181
+ case "--id":
182
+ id = args[++i];
183
+ break;
184
+ }
185
+ }
186
+
187
+ const client = await getOpsCompassClient();
188
+ const getVCenterConfig = await client.licenseManager.getVCenterConfiguration(id);
189
+
190
+ console.log(JSON.stringify(getVCenterConfig, null, 2));
191
+ }
192
+
193
+ async function createVCenterConfiguration(args) {
194
+ let id = undefined;
195
+ let name = undefined;
196
+ let optionalParams = { action: undefined, connection: undefined, user: undefined, password: undefined };
197
+ for (let i = 0; i < args.length - 1; i++) {
198
+ switch (args[i].toLowerCase()) {
199
+ case "--monitoringconfigurationid":
200
+ id = args[++i];
201
+ break;
202
+ case "--name":
203
+ name = args[++i];
204
+ break;
205
+ case "--action":
206
+ optionalParams.action = args[++i];
207
+ break;
208
+ case "--connection":
209
+ optionalParams.connection = args[++i];;
210
+ break;
211
+ case "--user":
212
+ optionalParams.user = args[++i];
213
+ break;
214
+ case "--password":
215
+ optionalParams.password = args[++i];
216
+ break;
217
+ }
218
+ }
219
+
220
+ const client = await getOpsCompassClient();
221
+ const monitoringConfig = await client.licenseManager.createVCenterConfiguration(id, name, optionalParams);
222
+
223
+ console.log(JSON.stringify(monitoringConfig, null, 2));
224
+ }
225
+
226
+ async function createOracleDatabaseConfiguration(args) {
227
+ let id = undefined;
228
+ let name = undefined;
229
+ let optionalParams = { action: undefined, connection: undefined };
230
+ for (let i = 0; i < args.length - 1; i++) {
231
+ switch (args[i].toLowerCase()) {
232
+ case "--monitoringconfigurationid":
233
+ id = args[++i];
234
+ break;
235
+ case "--name":
236
+ name = args[++i];
237
+ break;
238
+ case "--action":
239
+ optionalParams.action = args[++i];
240
+ break;
241
+ case "--connectionstring":
242
+ optionalParams.connection = args[++i];
243
+ break;
244
+ }
245
+ }
246
+
247
+ const client = await getOpsCompassClient();
248
+ const monitoringConfig = await client.licenseManager.createOracleDatabaseConfiguration(id, name, optionalParams);
249
+
250
+ console.log(JSON.stringify(monitoringConfig, null, 2));
251
+ }
252
+
253
+ async function updateMonitoringConfiguration(args) {
254
+ // Prep any arguments that are arrays
255
+ args = setArgumentArrays(["--mailFrom", "--emailTo"], args);
256
+
257
+ const callParams = {};
258
+ for (let i = 0; i < args.length - 1; i++) {
259
+ switch (args[i].toLowerCase()) {
260
+ case "--id":
261
+ callParams.id = args[++i];
262
+ break;
263
+ case "--configurationname":
264
+ callParams.configurationName = args[++i];
265
+ break;
266
+ case "--datafileretaindays":
267
+ callParams.dataFileRetainDays = args[++i];
268
+ break;
269
+ case "--datafileretaintextdays":
270
+ callParams.dataFileRetainTextDays = args[++i];
271
+ break;
272
+ case "--forcefileencryption":
273
+ callParams.forceFileEncryption = args[++i];
274
+ break;
275
+ case "--datafiletag":
276
+ callParams.dataFileTag = args[++i];
277
+ break;
278
+ case "--mailfrom":
279
+ callParams.mailFrom = args[++i];
280
+ break;
281
+ case "--emailto":
282
+ callParams.emailTo = args[++i];
283
+ break;
284
+ case "--logfileretaindays":
285
+ callParams.logFileRetainDays = args[++i];
286
+ break;
287
+ case "--logfiletag":
288
+ callParams.logFileTag = args[++i];
289
+ break;
290
+ }
291
+ }
292
+
293
+ const client = await getOpsCompassClient();
294
+ const monitoringConfig = await client.licenseManager.updateMonitoringConfiguration(callParams.id, callParams);
295
+
296
+ console.log(JSON.stringify(monitoringConfig, null, 2));
297
+ }
298
+
299
+ async function updateOracleDatabaseConfiguration(args) {
300
+ const callParams = {};
301
+ for (let i = 0; i < args.length - 1; i++) {
302
+ switch (args[i].toLowerCase()) {
303
+ case "--id":
304
+ callParams.id = args[++i];
305
+ break;
306
+ case "--name":
307
+ callParams.name = args[++i];
308
+ break;
309
+ case "--action":
310
+ callParams.action = args[++i];
311
+ break;
312
+ case "--connectionstring":
313
+ callParams.connectionString = args[++i];
314
+ break;
315
+ }
316
+ }
317
+
318
+ const client = await getOpsCompassClient();
319
+ const oracleDatabaseConfiguration = await client.licenseManager.updateOracleDatabaseConfiguration(callParams.id, callParams);
320
+
321
+ console.log(JSON.stringify(oracleDatabaseConfiguration, null, 2));
322
+ }
323
+
324
+ async function updateOracleDatabaseConfigurations(args) {
325
+
326
+ let callParamsArray = [];
327
+ let jsonIndex = args.indexOf('--json-updates')
328
+ let idIndex = args.indexOf('--id')
329
+ let callParams = {};
330
+
331
+ /* Process bulk update with JSON */
332
+ if (jsonIndex !== -1) {
333
+ callParamsArray = args[jsonIndex + 1]
334
+ } else if (idIndex !== -1) {
335
+ /* If no '--json-update' flag, process bulk update with parameter flags (e.g. --id, --name, etc.) */
336
+ for(let i = 0; i < args.length - 1; i++) {
337
+ if(args[i] === '--id') {
338
+ /* Reset callParams object when a second id is encountered */
339
+ callParams = {};
340
+ /* Push callParams into the array. */
341
+ callParamsArray.push(callParams)
342
+ /* 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 */
343
+ callParams.id = args[i + 1];
344
+ } else if(args[i] === '--configurationName') {
345
+ callParams.configurationName = args[i + 1];
346
+ } else if(args[i] === '--action') {
347
+ callParams.action = args[i + 1];
348
+ } else if(args[i] === '--connectionstring') {
349
+ callParams.connectionString = args[i + 1];
350
+ }
351
+ }
352
+ } else {
353
+ console.warn("Invalid input, please see help for examples.")
354
+ }
355
+ /* Call the API and print to console */
356
+ const client = await getOpsCompassClient();
357
+ const oracleDatabaseConfigurations = await client.licenseManager.updateOracleDatabaseConfigurations(callParamsArray);
358
+ console.log(JSON.stringify(oracleDatabaseConfigurations, null, 2));
359
+ }
360
+
361
+
362
+ async function updateVCenterConfiguration(args) {
363
+ const callParams = {};
364
+ for (let i = 0; i < args.length - 1; i++) {
365
+ switch (args[i].toLowerCase()) {
366
+ case "--id":
367
+ callParams.id = args[++i];
368
+ break;
369
+ case "--name":
370
+ callParams.name = args[++i];
371
+ break;
372
+ case "--action":
373
+ callParams.action = args[++i];
374
+ break;
375
+ case "--connection":
376
+ callParams.connection = args[++i];
377
+ break;
378
+ case "--user":
379
+ callParams.user = args[++i];
380
+ break;
381
+ case "--password":
382
+ callParams.password = args[++i];
383
+ break;
384
+ }
385
+ }
386
+
387
+ const client = await getOpsCompassClient();
388
+ const vCenterConfiguration = await client.licenseManager.updateVCenterConfiguration(callParams.id, callParams);
389
+ console.log(JSON.stringify(vCenterConfiguration, null, 2));
390
+ }
391
+
392
+ async function updateVCenterConfigurations(args) {
393
+
394
+ let callParamsArray = [];
395
+ let jsonIndex = args.indexOf('--json-updates')
396
+ let idIndex = args.indexOf('--id')
397
+ let callParams = {};
398
+
399
+ /* Process bulk update with JSON */
400
+ if (jsonIndex !== -1) {
401
+ callParamsArray = args[jsonIndex + 1]
402
+ } else if (idIndex !== -1) {
403
+ /* If no '--json-update' flag, process bulk update with parameter flags (e.g. --id, --name, etc.) */
404
+ for(let i = 0; i < args.length - 1; i++) {
405
+ if(args[i] === '--id') {
406
+ /* Reset callParams object when a second id is encountered */
407
+ callParams = {};
408
+ /* if theres an existing callParams object, toss it into the array and move on. */
409
+ callParamsArray.push(callParams)
410
+ /* 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 */
411
+ callParams.id = args[i + 1];
412
+ } else if(args[i] === '--configurationName') {
413
+ callParams.configurationName = args[i + 1];
414
+ } else if(args[i] === '--action') {
415
+ callParams.action = args[i + 1];
416
+ } else if(args[i] === '--connection') {
417
+ callParams.connection = args[i + 1];
418
+ } else if(args[i] === '--user') {
419
+ callParams.user = args[i + 1];
420
+ } else if(args[i] === '--password') {
421
+ callParams.password = args[i + 1];
422
+ }
423
+ }
424
+ } else {
425
+ console.warn("Invalid input, please see help for examples.")
426
+ }
427
+
428
+ /* Call the API and print to console */
429
+ const client = await getOpsCompassClient();
430
+ const vCenterConfigurations = await client.licenseManager.updateVCenterConfigurations(callParamsArray);
431
+ console.log(JSON.stringify(vCenterConfigurations, null, 2));
432
+ }
433
+
434
+ async function printHelp() {
435
+ console.log("Actions available for license-manager:");
436
+ console.log();
437
+ console.log("get-secret-for-configuration", "Gets a secret for a single configuration passed.");
438
+ console.log("Parameters:");
439
+ console.log("--id [vcenter_configuration_id | oracle_database_configuration_id]");
440
+ console.log("--recordType ['oracle_database_configuration' | 'vcenter_configuration'");
441
+ console.log();
442
+ console.log("list-monitoring-configurations", "Lists all of the monitoring configurations associated with the give company.");
443
+ console.log("Parameters:");
444
+ console.log("--company [company_slug]");
445
+ console.log();
446
+ console.log("get-monitoring-configuration", "Get a single monitoring configuration associated with the given company.");
447
+ console.log("Parameters:");
448
+ console.log("--id [monitoring_configuration_id]");
449
+ console.log("--asFile (optional) [true | false]");
450
+ console.log();
451
+ console.log("create-monitoring-configuration", "Create a single monitoring configuration associated with the given company.");
452
+ console.log("Parameters:");
453
+ console.log("--company [company_slug]");
454
+ console.log("--configurationName [configuration name]");
455
+ console.log();
456
+ console.log("list-oracle-database-configurations", "Lists all of the oracle database configurations associated with the given monitoring configuration");
457
+ console.log("Parameters:");
458
+ console.log("--monitoringConfigurationId [monitoring_configuration_id]");
459
+ console.log();
460
+ console.log("get-oracle-database-configuration", "Get a single oracle database configuration associated with the given monitoring configuration");
461
+ console.log("Parameters:");
462
+ console.log("--id [oracle_database_configuration_id]");
463
+ console.log();
464
+ console.log("list-vcenter-configurations", "Lists all of the vcenter configurations associated with the given monitoring configuration");
465
+ console.log("Parameters:");
466
+ console.log("--monitoringConfigurationId [monitoring_configuration_id]");
467
+ console.log();
468
+ console.log("get-vcenter-configuration", "Get a single vcenter configuration associated with the given monitoring configuration");
469
+ console.log("Parameters:");
470
+ console.log("--id [vcenter_configuration_id]");
471
+ console.log();
472
+ console.log("create-vcenter-configuration", "Create a single vcenter configuration associated with the given monitoring configuration.");
473
+ console.log("Parameters:");
474
+ console.log("--monitoringConfigurationId [monitoring_configuration_id]");
475
+ console.log("--name [unique name]");
476
+ console.log("--action (optional) [allowed actions: \"skip\"]");
477
+ console.log("--connection (optional) [the hostname or ip address]");
478
+ console.log("--user (optional) [connection username]");
479
+ console.log("--password (optional) [connection password]");
480
+ console.log();
481
+ console.log("create-oracle-database-configuration", "Create a single oracle database configuration associated with the given monitoring configuration.");
482
+ console.log("Parameters:");
483
+ console.log("--monitoringConfigurationId [monitoring_configuration_id]");
484
+ console.log("--name [unique name]");
485
+ console.log("--action (optional) [allowed actions: \"skip\"]");
486
+ console.log("--connectionString (optional) [the database connection string]");
487
+ console.log();
488
+ console.log("update-monitoring-configuration", "Update a single monitoring configuration.");
489
+ console.log("Parameters:");
490
+ console.log("--id [monitoring_configuration id]");
491
+ console.log("--configurationName (optional) [unique name]");
492
+ console.log("--dataFileRetainDays (optional) [determines how many days to retain encrypted output files locally]");
493
+ console.log("--dataFileRetainTextDays (optional) [determines how many days to retain individual script output files locally]");
494
+ console.log("--forceFileEncryption (optional) [enforce encryption of datafiles before being sent]");
495
+ console.log("--dataFileTag (optional) [used to help filename generation to prevent duplicate file names]");
496
+ console.log("--mailFrom (optional) [Use parameter multiple times to send multiple email addresses. Identifies sender's email addresses when file delivery is done through email.]");
497
+ console.log("--emailTo (optional) [Use parameter multiple times to send multiple email addresses. Identifies the destination email addresses when file delivery is done through email.]");
498
+ console.log("--logFileRetainDays (optional) [determines how many days to retain log files locally]");
499
+ console.log("--logFileTag (optional) [used to help filename generation to prevent duplicate file names]");
500
+ console.log();
501
+ console.log("update-oracle-database-configuration", "Update a single oracle database configuration.");
502
+ console.log("Parameters:");
503
+ console.log("--id [configuration id]");
504
+ console.log("--name (optional) [unique name]");
505
+ console.log("--action (optional) [allowed actions: \"skip\"]");
506
+ console.log("--connectionString (optional) [the database connection string]");
507
+ console.log();
508
+ console.log("update-oracle-database-configurations", "Bulk update oracle database configurations.");
509
+ console.log("Parameters:");
510
+ console.log("--id [configuration id]");
511
+ console.log("--name (optional) [unique name]");
512
+ console.log("--action (optional) [allowed actions: \"skip\"]");
513
+ console.log("--connectionString (optional) [the database connection string]");
514
+ console.log("OR --json-updates [stringified json objects with your updates]");
515
+ console.log("For quick updates, you may use the above parameters");
516
+ console.log(`e.g. opscompass license-manager update-oracle-database-configurations --id 57 --configurationName "updatedName" --id 62 --configurationName "otherUpdatedName" --id 77 --configurationName "lastUpdatedName";`);
517
+ console.log("For larger updates, JavaScript Object Notation (JSON) may be used with the --json-updates flag");
518
+ console.log(`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"}]'`);
519
+ console.log();
520
+ console.log("update-vcenter-configuration", "Update a single vcenter configuration.");
521
+ console.log("Parameters:");
522
+ console.log("--id [configuration id]");
523
+ console.log("--name (optional) [unique name]");
524
+ console.log("--action (optional) [allowed actions: \"skip\"]");
525
+ console.log("--connection (optional) [the hostname or ip address]");
526
+ console.log("--user (optional) [connection username]");
527
+ console.log("--password (optional) [connection password]");
528
+ console.log();
529
+ console.log("update-vcenter-configurations", "Bulk Update vcenter configurations.");
530
+ console.log("Parameters:");
531
+ console.log("--id [configuration id]");
532
+ console.log("--name (optional) [unique name]");
533
+ console.log("--action (optional) [allowed actions: \"skip\"]");
534
+ console.log("--connection (optional) [the hostname or ip address]");
535
+ console.log("--user (optional) [connection username]");
536
+ console.log("--password (optional) [connection password]");
537
+ console.log("OR --json-updates [stringified json objects with your updates]");
538
+ console.log("For quick updates, you may use the above parameters");
539
+ console.log(`e.g. opscompass license-manager update-vcenter-configurations --id 137 --configurationName "updatedName" --id 138 --configurationName "otherUpdatedName" --id 144 --configurationName "lastUpdatedName";`);
540
+ console.log("For larger updates, JavaScript Object Notation (JSON) may be used with the --json-updates flag");
541
+ console.log(`e.g. opscompass license-manager update-vcenter-configurations --json-updates '[{"id":"137","configurationName":"updatedName"},{"id":"138","configurationName":"otherUpdatedName"},{"id":"144","configurationName":"lastUpdatedName"}]'`);
542
+ console.log();
543
+ console.log("delete-monitoring-configuration", "Delete a monitoring configuration");
544
+ console.log("Parameters:");
545
+ console.log("--id [monitoring_configuration_id]");
546
+ console.log();
547
+ console.log("delete-oracle-database-configuration", "Delete a oracle database configuration");
548
+ console.log("Parameters:");
549
+ console.log("--id [oracle_database_configuration_id]");
550
+ console.log();
551
+ console.log("delete-vcenter-configuration", "Delete a vcenter configuration");
552
+ console.log("Parameters:");
553
+ console.log("--id [vcenter_configuration_id]");
554
+ console.log();
555
+ }
556
+
557
+ const licenseManagerModule = (action, ...args) => {
558
+ switch (action?.toLowerCase() ?? "") {
559
+ case "get-secret-for-configuration":
560
+ return getSecretForConfiguration(args);
561
+ case "list-monitoring-configurations":
562
+ return listMonitoringConfigurations(args);
563
+ case "get-monitoring-configuration":
564
+ return getMonitoringConfiguration(args);
565
+ case "create-monitoring-configuration":
566
+ return createMonitoringConfiguration(args);
567
+ case "list-vcenter-configurations":
568
+ return listVCenterConfigurations(args);
569
+ case "get-vcenter-configuration":
570
+ return getVCenterConfiguration(args);
571
+ case "create-vcenter-configuration":
572
+ return createVCenterConfiguration(args);
573
+ case "get-oracle-database-configuration":
574
+ return getOracleDatabaseConfiguration(args);
575
+ case "list-oracle-database-configurations":
576
+ return listOracleDatabaseConfigurations(args);
577
+ case "create-oracle-database-configuration":
578
+ return createOracleDatabaseConfiguration(args);
579
+ case "update-monitoring-configuration":
580
+ return updateMonitoringConfiguration(args);
581
+ case "update-oracle-database-configuration":
582
+ return updateOracleDatabaseConfiguration(args);
583
+ case "update-oracle-database-configurations":
584
+ return updateOracleDatabaseConfigurations(args);
585
+ case "update-vcenter-configuration":
586
+ return updateVCenterConfiguration(args);
587
+ case "update-vcenter-configurations":
588
+ return updateVCenterConfigurations(args);
589
+ case "delete-monitoring-configuration":
590
+ return deleteMonitoringConfiguration(args);
591
+ case "delete-oracle-database-configuration":
592
+ return deleteOracleDatabaseConfiguration(args);
593
+ case "delete-vcenter-configuration":
594
+ return deleteVCenterConfiguration(args);
595
+ case "help":
596
+ case "":
597
+ return printHelp();
598
+ default:
599
+ console.log("Unknown command:", action);
600
+ return printHelp();
601
+ }
602
+ };
603
+
604
+ licenseManagerModule.requiresLogin = true;
605
+ licenseManagerModule.description = "Provides access to details about License Management in OpsCompass.";
606
+
607
+ module.exports = licenseManagerModule;
package/modules.js CHANGED
@@ -1,5 +1,9 @@
1
1
  const resources = require("./modules/resources.js");
2
2
  const accounts = require("./modules/accounts.js");
3
+ const licenseManager = require("./modules/license-manager.js");
4
+ const compliance = require("./modules/compliance.js");
5
+ const dataGatheringScripts = require("./modules/data-gathering-scripts.js");
6
+
3
7
 
4
8
  /* login acts like a module, even though it's special */
5
9
  const login = require("./login.js");
@@ -8,4 +12,7 @@ module.exports = {
8
12
  login,
9
13
  resources,
10
14
  accounts,
15
+ compliance,
16
+ "license-manager": licenseManager,
17
+ "data-gathering-scripts": dataGatheringScripts
11
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opscompass/opscompass-cli",
3
- "version": "1.0.7",
3
+ "version": "1.0.10",
4
4
  "description": "Calls OpsCompass's APIs",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,11 +13,14 @@
13
13
  "opscompass"
14
14
  ],
15
15
  "author": "opscompass",
16
- "license": "UNLICENSED",
16
+ "license": "SEE LICENSE IN license.txt",
17
17
  "dependencies": {
18
- "@opscompass/opscompass-api": "file:../api",
18
+ "@opscompass/opscompass-api": "^1.0.10",
19
+ "adm-zip": "^0.5.9",
19
20
  "axios": "^0.21.1",
20
- "open": "^8.2.1"
21
+ "fs-extra": "^10.1.0",
22
+ "open": "^8.2.1",
23
+ "semver": "^7.3.7"
21
24
  },
22
25
  "bin": {
23
26
  "opscompass": "index.js"
package/updates.js ADDED
@@ -0,0 +1,33 @@
1
+ const pkg = require("./package.json");
2
+ const semver = require("semver");
3
+ const { exec } = require("child_process");
4
+ const { greenText, yellowText } = require("./colors.js");
5
+
6
+ /* versionCheck sends a command to the terminal to check the latest package version and compares it to the current version specified in package.json, prompting the user to upgrade if it is out of date. */
7
+ /* This is turned off by default when using the local environment. To turn it on for dev purposes, comment out isLocal check in index.js */
8
+
9
+ function versionCheck() {
10
+
11
+ const environmentSpecificPackageVersion = `npm view ${pkg.name} version`
12
+ /* latestVersion is the standard output(stdout), which is read and compared to current package version */
13
+ exec(environmentSpecificPackageVersion, (error, latestVersion, stderr) => {
14
+ if (error) {
15
+ console.log(`error: ${error.message}`);
16
+ return;
17
+ }
18
+ if (stderr) {
19
+ console.log(`stderr: ${stderr}`);
20
+ };
21
+ /* Semver used to semantically compare version numbers */
22
+ if (semver.gt(latestVersion, pkg.version)) {
23
+ console.error(yellowText, `\nWarning! You are using CLI version ${pkg.version}, but the latest version is ${latestVersion}. To upgrade to the latest version, please run:`);
24
+ /* Prompt user to upgrade to the correct package based on their current environment */
25
+ console.error(greenText, `\nnpm install -g ${pkg.name}@${latestVersion}\n`);
26
+ return;
27
+ }
28
+ });
29
+ };
30
+
31
+ module.exports = {
32
+ versionCheck
33
+ };