@opscompass/opscompass-cli 1.0.19 → 1.0.21

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.
@@ -419,21 +419,53 @@ const { getCredentials } = require("../credentials.js");
419
419
  console.log();
420
420
  }
421
421
 
422
- async function listBreaches(args) {
423
- for (let i = 0; i < args.length; i++) {
424
- switch (args[i].toLowerCase()) {
425
- case "--company":
426
- callParams.company = args[i+1];
427
- break;
428
- }
429
- }
430
-
431
-
432
- const client = await getOpsCompassClient();
433
- const response = await client.compliance.listBreaches(callParams.company);
434
-
435
- console.log(JSON.stringify(response, null, 2));
436
- }
422
+ async function listBreaches(args) {
423
+ for (let i = 0; i < args.length; i++) {
424
+ switch (args[i].toLowerCase()) {
425
+ case "--company":
426
+ callParams.company = args[i+1];
427
+ break;
428
+ }
429
+ }
430
+
431
+
432
+ const client = await getOpsCompassClient();
433
+ const response = await client.compliance.listBreaches(callParams.company);
434
+
435
+ console.log(JSON.stringify(response, null, 2));
436
+ }
437
+
438
+ async function listBreachedEmails(args) {
439
+ for (let i = 0; i < args.length; i++) {
440
+ switch (args[i].toLowerCase()) {
441
+ case "--company":
442
+ callParams.company = args[i+1];
443
+ break;
444
+ }
445
+ }
446
+
447
+
448
+ const client = await getOpsCompassClient();
449
+ const response = await client.compliance.listBreachedEmails(callParams.company);
450
+
451
+ console.log(JSON.stringify(response, null, 2));
452
+ }
453
+
454
+ async function listBreachedEmailsOfConcern(args) {
455
+ for (let i = 0; i < args.length; i++) {
456
+ switch (args[i].toLowerCase()) {
457
+ case "--company":
458
+ callParams.company = args[i+1];
459
+ break;
460
+ }
461
+ }
462
+
463
+
464
+ const client = await getOpsCompassClient();
465
+ const response = await client.compliance.listBreachedEmailsOfConcern(callParams.company);
466
+
467
+ console.log(JSON.stringify(response, null, 2));
468
+ }
437
469
 
438
470
 
439
471
  async function printHelp() {
@@ -545,7 +577,15 @@ const { getCredentials } = require("../credentials.js");
545
577
  console.log("--expires-at (optional) [string] the date at which to expire. If you want to remove a compliance exception from the list, set the expiresAt to todays date.");
546
578
  console.log("Format: UTC, example: '2022-08-23T17:00:00Z' to expire August 8th, 2022 at 17:00 UTC.");
547
579
  console.log();
548
- console.log("list-breaches", "Retrieves the list of breaches company emails have been involved in");
580
+ console.log("list-breaches", "Retrieves the list of breaches company emails have been involved in.");
581
+ console.log("Parameters:");
582
+ console.log("--company [company_slug]");
583
+ console.log();
584
+ console.log("list-breached-emails", "Retrieves the list of breached emails associated with a provided company");
585
+ console.log("Parameters:");
586
+ console.log("--company [company_slug]");
587
+ console.log();
588
+ console.log("list-breached-emails-of-concern", "Retrieves the list of breached emails that have not performed a password reset since a data breach.");
549
589
  console.log("Parameters:");
550
590
  console.log("--company [company_slug]");
551
591
  console.log();
@@ -586,6 +626,10 @@ const { getCredentials } = require("../credentials.js");
586
626
  return createComplianceResourceCheckException(args);
587
627
  case "list-breaches":
588
628
  return listBreaches(args);
629
+ case "list-breached-emails":
630
+ return listBreachedEmails(args);
631
+ case "list-breached-emails-of-concern":
632
+ return listBreachedEmailsOfConcern(args);
589
633
  case "help":
590
634
  case "":
591
635
  return printHelp();
@@ -292,6 +292,28 @@ async function getMetricNamesForResourceType(args) {
292
292
  console.log(JSON.stringify(usageAnalytics, null, 2));
293
293
  }
294
294
 
295
+ async function getMetricNames(args) {
296
+ const callParams = {};
297
+ for (let i = 0; i < args.length - 1; i++) {
298
+ switch (args[i].toLowerCase()) {
299
+ case "--company":
300
+ callParams.company = args[++i];
301
+ break;
302
+ case "--resource-id":
303
+ case "--resourceid":
304
+ callParams.resourceId = args[++i];
305
+ break;
306
+ case "--id":
307
+ callParams.id = args[++i];
308
+ break;
309
+ }
310
+ }
311
+
312
+ const client = await getOpsCompassClient();
313
+ const metricNames = await client.resources.getMetricNamesForResource(callParams);
314
+
315
+ console.log(JSON.stringify(metricNames, null, 2));
316
+ }
295
317
 
296
318
  async function uploadMetrics(args) {
297
319
  const callData = {};
@@ -344,6 +366,12 @@ async function printHelp() {
344
366
  console.log("--concern \"concern name\"");
345
367
  console.log("--type [configuration_alert | security_alert]");
346
368
  console.log();
369
+ console.log("get-metric-names", "Fetches metric names for a resource.");
370
+ console.log("Parameters:");
371
+ console.log("--company [company slug]");
372
+ console.log("--id [12345]");
373
+ console.log("--resource-id [cloud-resource-id]");
374
+ console.log();
347
375
  console.log("get-tags", "Gets tags attached to a resource.");
348
376
  console.log("Parameters:");
349
377
  console.log("--company [company_id]");
@@ -418,6 +446,8 @@ const resourcesModule = (action, ...args) => {
418
446
  case "get-drift":
419
447
  case "get-tags":
420
448
  return get(action, args);
449
+ case "get-metric-names":
450
+ return getMetricNames(args);
421
451
  case "add-tags":
422
452
  case "remove-tags":
423
453
  return tags(action, args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opscompass/opscompass-cli",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "Calls OpsCompass's APIs",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,7 +15,7 @@
15
15
  "author": "opscompass",
16
16
  "license": "SEE LICENSE IN license.txt",
17
17
  "dependencies": {
18
- "@opscompass/opscompass-api": "^1.0.19",
18
+ "@opscompass/opscompass-api": "^1.0.21",
19
19
  "adm-zip": "^0.5.9",
20
20
  "axios": "^0.21.1",
21
21
  "fs-extra": "^10.1.0",