@opscompass/opscompass-cli 1.0.18 → 1.0.20

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,153 @@
1
+ const { readFile } = require("fs/promises");
2
+
3
+ /**
4
+ * @typedef {object} ResourceMetric
5
+ * @property {Date} time
6
+ * @property {string} counter
7
+ * @property {string} unit
8
+ * @property {number} value
9
+ */
10
+
11
+ /**
12
+ * Logs a problem with a line to stderr (console.error).
13
+ * In the message, it converts the index from the 0-based
14
+ * array index to a 1-based line number.
15
+ *
16
+ * @param problem {string} The problem with the line to log
17
+ * @param index {number} The array index for the line
18
+ */
19
+ function warnLineProblem(problem, index) {
20
+ console.error(`${problem} on line ${index + 1}`);
21
+ }
22
+
23
+ /**
24
+ * Splits a string on line endings, no matter which line ending
25
+ * pattern is used (\r\n for Windows, \n for *nix, and \r for legacy Mac)
26
+ * @param fileContent {string} The file to split
27
+ * @returns {string[]} The lines of the file
28
+ */
29
+ function splitOnLines(fileContent) {
30
+ return fileContent.replace(/[\r\n]/g, '\n').replace(/[\r]/g, '\n').split('\n');
31
+ }
32
+
33
+ /**
34
+ * Determines if a line is valid: that it has at least 4 data elements,
35
+ * the first element is a date, the second and third elements are present,
36
+ * and the fourth element is a number.
37
+ *
38
+ * @param lineContent {string} The line to consider
39
+ * @param index {number} The line number in the file
40
+ * @returns {boolean} Whether the line content contains at least 3 commas
41
+ */
42
+ function hasValidData(lineContent, index) {
43
+ const hasEnoughData = lineContent.match(/,/g)?.length >= 3;
44
+
45
+ // warn unless blank
46
+ if (!hasEnoughData && hasContent(lineContent)) {
47
+ warnLineProblem("Insufficient data", index);
48
+ }
49
+
50
+ if (!hasEnoughData) {
51
+ return false;
52
+ }
53
+
54
+ const [ timeCandidate, counterCandidate, unitCandidate, valueCandidate ] = lineContent.split(',');
55
+
56
+ const isTimeValid = (new Date(timeCandidate.trim()).toString() !== "Invalid Date");
57
+ const isCounterValid = counterCandidate.trim() !== "";
58
+ const isUnitValid = unitCandidate.trim() !== "";
59
+ const isValueValid = valueCandidate.trim() !== "" && !isNaN(valueCandidate.trim());
60
+
61
+ if (!isTimeValid) {
62
+ warnLineProblem("Invalid time", index);
63
+ }
64
+
65
+ if (!isCounterValid) {
66
+ warnLineProblem("Invalid counter", index);
67
+ }
68
+
69
+ if (!isUnitValid) {
70
+ warnLineProblem("Invalid unit", index);
71
+ }
72
+
73
+ if (!isValueValid) {
74
+ warnLineProblem("Invalid value", index);
75
+ }
76
+
77
+ return isTimeValid && isCounterValid && isUnitValid && isValueValid;
78
+ }
79
+
80
+ /**
81
+ * Determines if a line is blank or not after trimming whitespace.
82
+ * @param lineContent {string} The line to consider
83
+ * @returns {boolean} Whether the line is blank
84
+ */
85
+ function hasContent(lineContent) {
86
+ return lineContent.trim() !== "";
87
+ }
88
+
89
+ /**
90
+ * Parses the four data values out of a valid line into
91
+ * a ResourceMetric object
92
+ * @param lineContent {string} The line to read
93
+ * @returns {ResourceMetric} The parsed resource metric
94
+ */
95
+ function parseLine(lineContent) {
96
+ const [ time, counter, unit, value ] = lineContent.split(',');
97
+
98
+ return {
99
+ time: new Date(time.trim()),
100
+ counter: counter.trim(),
101
+ unit: unit.trim(),
102
+ value: Number(value),
103
+ };
104
+ }
105
+
106
+ /**
107
+ * Parses metrics from a given path after validating the file exists.
108
+ *
109
+ * Makes strong assumptions about the file being UTF-8-encoded and
110
+ * following a limited CSV format with no header row or support for
111
+ * escaping data with commas. It does support surrounding whitespace.
112
+ *
113
+ * Each row contains exactly the data elements in order:
114
+ *
115
+ * Metric Date, Metric Name, Metric Unit, Metric Value
116
+ *
117
+ * Metric Date is a JavaScript-parsable date.
118
+ * Metric Name is the name of the metric (such as CPU).
119
+ * Metric Unit is the unit of the metric (such as Percent).
120
+ * Metric Value is a number.
121
+ *
122
+ * Any row with fewer than 4 data elements is skipped.
123
+ * Any row with more than 4 data elements ignores all elements beyond the fourth.
124
+ * Any row with an unparsable date or a non-numeric value is skipped with a warning printed.
125
+ * The first row is treated as a data row.
126
+ *
127
+ * @param file {string} The path to the file
128
+ * @returns { Promise<ResourceMetric[] | undefined> } The parsed metrics if they were parsable
129
+ */
130
+ async function parseMetrics(file) {
131
+ let fileData;
132
+ try {
133
+ fileData = await readFile(file);
134
+ } catch (err) {
135
+ console.error("failed to read metrics file", err);
136
+ return;
137
+ }
138
+
139
+ const fileContent = fileData.toString();
140
+ const fileLines = splitOnLines(fileContent).
141
+ // filter valid data (also warns with the line number)
142
+ filter(hasValidData).
143
+ // filter away the blank lines
144
+ filter(hasContent).
145
+ // parse valid lines into expected objects
146
+ map(parseLine);
147
+
148
+ return fileLines;
149
+ }
150
+
151
+ module.exports = {
152
+ parseMetrics,
153
+ };
@@ -419,6 +419,22 @@ 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
+ }
437
+
422
438
 
423
439
  async function printHelp() {
424
440
  console.log("Actions available for compliance:");
@@ -529,6 +545,10 @@ const { getCredentials } = require("../credentials.js");
529
545
  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.");
530
546
  console.log("Format: UTC, example: '2022-08-23T17:00:00Z' to expire August 8th, 2022 at 17:00 UTC.");
531
547
  console.log();
548
+ console.log("list-breaches", "Retrieves the list of breaches company emails have been involved in");
549
+ console.log("Parameters:");
550
+ console.log("--company [company_slug]");
551
+ console.log();
532
552
  }
533
553
 
534
554
 
@@ -562,8 +582,10 @@ const { getCredentials } = require("../credentials.js");
562
582
  return updateComplianceException(args);
563
583
  case "update-compliance-exceptions":
564
584
  return updateComplianceExceptions(args);
565
- case "create-compliance-resource-check-exception":
566
- return createComplianceResourceCheckException(args);
585
+ case "create-compliance-resource-check-exception":
586
+ return createComplianceResourceCheckException(args);
587
+ case "list-breaches":
588
+ return listBreaches(args);
567
589
  case "help":
568
590
  case "":
569
591
  return printHelp();
@@ -155,6 +155,22 @@ async function getSecretForConfiguration(args){
155
155
  console.log(JSON.stringify(monitoringConfig, null, 2));
156
156
  }
157
157
 
158
+ async function getNetworkDiscoveryConfiguration(args) {
159
+ let id = undefined;
160
+ for (let i = 0; i < args.length - 1; i++) {
161
+ switch (args[i].toLowerCase()) {
162
+ case "--id":
163
+ id = args[++i];
164
+ break;
165
+ }
166
+ }
167
+
168
+ const client = await getOpsCompassClient();
169
+ const networkConfig = await client.licenseManager.getNetworkDiscoveryConfiguration(id);
170
+
171
+ console.log(JSON.stringify(networkConfig, null, 2));
172
+ }
173
+
158
174
  async function getMonitoringConfiguration(args) {
159
175
  let id = undefined;
160
176
  let optionalParams = { asFile: undefined }
@@ -665,6 +681,126 @@ async function getMssqlEntitlementComponents(args) {
665
681
  console.log(JSON.stringify(entitlementComponents, null, 2));
666
682
  }
667
683
 
684
+ async function deleteNetworkDiscoveryConfiguration(args) {
685
+ let id = undefined;
686
+ for (let i = 0; i < args.length - 1; i++) {
687
+ switch(args[i].toLowerCase()) {
688
+ case "--id":
689
+ id = args[++i];
690
+ break;
691
+ }
692
+ }
693
+
694
+ const client = await getOpsCompassClient();
695
+ const deleteResponse = await client.licenseManager.deleteNetworkDiscoveryConfiguration(id);
696
+ console.log(JSON.stringify(deleteResponse, null, 2));
697
+ }
698
+
699
+ async function updateNetworkDiscoveryConfiguration(args) {
700
+ let id = undefined;
701
+ let currentSubnet = {};
702
+ let subnets = [];
703
+ let dns_servers = [];
704
+ let ports = {};
705
+ for (let i = 0; i < args.length - 1; i++) {
706
+ switch (args[i].toLowerCase()) {
707
+ case "--id":
708
+ id = args[++i];
709
+ break;
710
+ case "--oracle-ports":
711
+ case "--oracleports":
712
+ ports["oracle_ports"] = args[++i];
713
+ break;
714
+ case "--other-ports":
715
+ case "--otherports":
716
+ ports["other_ports"] = args[++i];
717
+ break;
718
+ case "--mssql-ports":
719
+ case "--mssqlports":
720
+ ports["mssql_ports"] = args[++i];
721
+ break;
722
+ case "--dns-servers":
723
+ case "--dnsservers":
724
+ dns_servers.push(args[++i]);
725
+ break;
726
+ case "--subnet":
727
+ currentSubnet["subnet"] = args[++i];
728
+ if (currentSubnet["subnet"] && currentSubnet["name"]) {
729
+ subnets.push(currentSubnet);
730
+ currentSubnet = {};
731
+ }
732
+ break;
733
+ case "--subnet-name":
734
+ case "--subnetname":
735
+ currentSubnet["name"] = args[++i];
736
+ if (currentSubnet["subnet"] && currentSubnet["name"]) {
737
+ subnets.push(currentSubnet);
738
+ currentSubnet = {};
739
+ }
740
+ break;
741
+ }
742
+ }
743
+
744
+ const client = await getOpsCompassClient();
745
+
746
+ const networkDiscoveryConfig = await client.licenseManager.updateNetworkDiscoveryConfiguration(id, subnets || undefined, dns_servers || undefined, ports || undefined);
747
+
748
+ console.log(JSON.stringify(networkDiscoveryConfig, null, 2));
749
+ }
750
+
751
+ async function createNetworkDiscoveryConfiguration(args) {
752
+ let id = undefined;
753
+ let currentSubnet = {};
754
+ let subnets = [];
755
+ let dns_servers = [];
756
+ let ports = {};
757
+ for (let i = 0; i < args.length - 1; i++) {
758
+ switch (args[i].toLowerCase()) {
759
+ case "--monitoringconfigurationid":
760
+ case "--monitoring-configuration-id":
761
+ id = args[++i];
762
+ break;
763
+ case "--oracle-ports":
764
+ case "--oracleports":
765
+ ports["oracle_ports"] = args[++i];
766
+ break;
767
+ case "--other-ports":
768
+ case "--otherports":
769
+ ports["other_ports"] = args[++i];
770
+ break;
771
+ case "--mssql-ports":
772
+ case "--mssqlports":
773
+ ports["mssql_ports"] = args[++i];
774
+ break;
775
+ case "--dns-servers":
776
+ case "--dnsservers":
777
+ dns_servers.push(args[++i]);
778
+ break;
779
+ case "--subnet":
780
+ currentSubnet["subnet"] = args[++i];
781
+ if (currentSubnet["subnet"] && currentSubnet["name"]) {
782
+ subnets.push(currentSubnet);
783
+ currentSubnet = {};
784
+ }
785
+ break;
786
+ case "--subnet-name":
787
+ case "--subnetname":
788
+ currentSubnet["name"] = args[++i];
789
+ if (currentSubnet["subnet"] && currentSubnet["name"]) {
790
+ subnets.push(currentSubnet);
791
+ currentSubnet = {};
792
+ }
793
+ break;
794
+ }
795
+ }
796
+
797
+ const client = await getOpsCompassClient();
798
+
799
+ const networkDiscoveryConfig = await client.licenseManager.createNetworkDiscoveryConfiguration(id, subnets || undefined, dns_servers || undefined, ports || undefined);
800
+
801
+ console.log(JSON.stringify(networkDiscoveryConfig, null, 2));
802
+ }
803
+
668
804
  async function createMssqlEntitlement(args) {
669
805
  let company = undefined;
670
806
  let newRecord = {
@@ -886,11 +1022,35 @@ async function printHelp() {
886
1022
  console.log("--id [monitoring_configuration_id]");
887
1023
  console.log("--asFile (optional) [true | false]");
888
1024
  console.log();
1025
+ console.log("get-network-discovery-configuration", "Get a single network discovery configuration.");
1026
+ console.log("Parameters:");
1027
+ console.log("--id [network_discovery_configuration_id]");
1028
+ console.log();
889
1029
  console.log("create-monitoring-configuration", "Create a single monitoring configuration associated with the given company.");
890
1030
  console.log("Parameters:");
891
1031
  console.log("--company [company_slug]");
892
1032
  console.log("--configurationName [configuration name]");
893
1033
  console.log();
1034
+ console.log("create-network-discovery-configuration", "Creates a new networking discovery configuration associated with the given monitoring configuration.")
1035
+ console.log("Parameters:");
1036
+ console.log("--monitoring-configuration-id [monitoring_configuration_id]");
1037
+ console.log("--oracle-ports (optional) comma seperated list of valid port numbers to look for oracle connections");
1038
+ console.log("--mssql-ports (optional) comma seperated list of valid port numbers to look for mssql connections");
1039
+ console.log("--other-ports (optional) comma seperated list of valid port numbers to look for misc connections");
1040
+ console.log("--dns-servers (optional) comma seperated list of valid IPV4 DNS servers to use for DNS resolution. Can be specified multiple times");
1041
+ console.log("--subnet (optional) If supplied --subnet-name is also required. Valid IPV4 CIDR block as an input. Can be supplied multiple times");
1042
+ console.log("--subnet-name (optional) If supplied --subnet is also required. Name for the next/last subnet block provided. Can be supplied multiple times.")
1043
+ console.log();
1044
+ console.log("update-network-discovery-configuration", "Updates an existing networking discovery configuration. If an optional parameter is not provided, it is assumed that the field should be set to undefined.")
1045
+ console.log("Parameters:");
1046
+ console.log("--id [network_discovery_configuration_id]");
1047
+ console.log("--oracle-ports (optional) comma seperated list of valid port numbers to look for oracle connections");
1048
+ console.log("--mssql-ports (optional) comma seperated list of valid port numbers to look for mssql connections");
1049
+ console.log("--other-ports (optional) comma seperated list of valid port numbers to look for misc connections");
1050
+ console.log("--dns-servers (optional) comma seperated list of valid IPV4 DNS servers to use for DNS resolution. Can be specified multiple times");
1051
+ console.log("--subnet (optional) If supplied --subnet-name is also required. Valid IPV4 CIDR block as an input. Can be supplied multiple times");
1052
+ console.log("--subnet-name (optional) If supplied --subnet is also required. Name for the next/last subnet block provided. Can be supplied multiple times.")
1053
+ console.log();
894
1054
  console.log("list-oracle-database-configurations", "Lists all of the oracle database configurations associated with the given monitoring configuration");
895
1055
  console.log("Parameters:");
896
1056
  console.log("--monitoring-configuration-id [monitoring_configuration_id]");
@@ -999,6 +1159,10 @@ async function printHelp() {
999
1159
  console.log("Parameters:");
1000
1160
  console.log("--id [monitoring_configuration_id]");
1001
1161
  console.log();
1162
+ console.log("delete-network-discovery-configuration", "Delete a network discovery configuration");
1163
+ console.log("Parameters:");
1164
+ console.log("--id [network_discovery_configuration_id]");
1165
+ console.log();
1002
1166
  console.log("delete-oracle-database-configuration", "Delete a oracle database configuration");
1003
1167
  console.log("Parameters:");
1004
1168
  console.log("--id [oracle_database_configuration_id]");
@@ -1099,6 +1263,10 @@ async function printHelp() {
1099
1263
 
1100
1264
  const licenseManagerModule = (action, ...args) => {
1101
1265
  switch (action?.toLowerCase() ?? "") {
1266
+ case 'create-network-discovery-configuration':
1267
+ return createNetworkDiscoveryConfiguration(args);
1268
+ case 'update-network-discovery-configuration':
1269
+ return updateNetworkDiscoveryConfiguration(args);
1102
1270
  case 'list-mssql-assessments':
1103
1271
  return listMssqlAssessments(args);
1104
1272
  case 'get-mssql-assessment':
@@ -1129,6 +1297,8 @@ const licenseManagerModule = (action, ...args) => {
1129
1297
  return createMsqlConfiguration(args);
1130
1298
  case "get-msql-configuration":
1131
1299
  return getMsqlConfiguration(args);
1300
+ case "get-network-discovery-configuration":
1301
+ return getNetworkDiscoveryConfiguration(args);
1132
1302
  case "get-mssql-entitlements":
1133
1303
  return getMssqlEntitlements(args);
1134
1304
  case "get-oracle-database-configuration":
@@ -1147,6 +1317,8 @@ const licenseManagerModule = (action, ...args) => {
1147
1317
  return updateVCenterConfiguration(args);
1148
1318
  case "update-vcenter-configurations":
1149
1319
  return updateVCenterConfigurations(args);
1320
+ case "delete-network-discovery-configuration":
1321
+ return deleteNetworkDiscoveryConfiguration(args);
1150
1322
  case "delete-monitoring-configuration":
1151
1323
  return deleteMonitoringConfiguration(args);
1152
1324
  case "delete-oracle-database-configuration":
@@ -1,4 +1,5 @@
1
1
  const { getOpsCompassClient } = require("../opscompass.js");
2
+ const { parseMetrics } = require("../lib/parseMetrics.js");
2
3
 
3
4
  const actionMap = {
4
5
  "get": "get",
@@ -10,6 +11,63 @@ const actionMap = {
10
11
  "list": "list",
11
12
  };
12
13
 
14
+ async function scan(args) {
15
+ for (let i = 0; i < args.length - 1; i++) {
16
+ switch (args[i].toLowerCase()) {
17
+ case "--company":
18
+ callParams.company = args[++i];
19
+ break;
20
+ case "--account":
21
+ callParams.account = args[++i];
22
+ break;
23
+ case "--resourcetags":
24
+ case "--resource-tags":
25
+ if (typeof callParams.resourceTags === "string") {
26
+ callParams.resourceTags = [callParams.resourceTags];
27
+ }
28
+ if (Array.isArray(callParams.resourceTags)) {
29
+ callParams.resourceTags.push(args[++i]);
30
+ } else {
31
+ callParams.resourceTags = args[++i];
32
+ }
33
+ break;
34
+ case "--resource-ids":
35
+ case "--resourceids":
36
+ if (typeof callParams.resourceIds === "string") {
37
+ callParams.resourceIds = [callParams.resourceIds];
38
+ }
39
+ if (Array.isArray(callParams.resourceIds)) {
40
+ callParams.resourceIds.push(args[++i]);
41
+ } else {
42
+ callParams.resourceIds = args[++i];
43
+ }
44
+ break;
45
+ case "--ids":
46
+ if (typeof callParams.ids === "string") {
47
+ callParams.ids = [callParams.ids];
48
+ }
49
+ if (Array.isArray(callParams.ids)) {
50
+ callParams.ids.push(args[++i]);
51
+ } else {
52
+ callParams.ids = args[++i];
53
+ }
54
+ break;
55
+
56
+ }
57
+ }
58
+
59
+ const client = await getOpsCompassClient();
60
+ const optionalParams = {
61
+ ids: callParams.ids,
62
+ resourceIds: callParams.resourceIds,
63
+ resourceTags: callParams.resourceTags,
64
+ }
65
+
66
+ const resource = await client.resources.scan(callParams.company, callParams.account, optionalParams);
67
+
68
+ console.log(JSON.stringify(resource, null, 2));
69
+ }
70
+
13
71
  async function get(action, args) {
14
72
  for (let i = 0; i < args.length - 1; i++) {
15
73
  switch (args[i].toLowerCase()) {
@@ -234,6 +292,55 @@ async function getMetricNamesForResourceType(args) {
234
292
  console.log(JSON.stringify(usageAnalytics, null, 2));
235
293
  }
236
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
+ }
317
+
318
+ async function uploadMetrics(args) {
319
+ const callData = {};
320
+ for (let i = 0; i < args.length - 1; i++) {
321
+ switch (args[i].toLowerCase()) {
322
+ case "--company":
323
+ callData.company = args[++i];
324
+ break;
325
+ case "--account":
326
+ callData.account = args[++i];
327
+ break;
328
+ case "--resourceid":
329
+ case "--resource-id":
330
+ callData.resourceId = args[++i];
331
+ break;
332
+ case "--metrics":
333
+ callData.metrics = await parseMetrics(args[++i]);
334
+ break;
335
+ }
336
+ }
337
+
338
+ const client = await getOpsCompassClient();
339
+ const { message } = await client.resources.uploadMetrics(callData);
340
+ console.log(message);
341
+ }
342
+
343
+
237
344
  async function printHelp() {
238
345
  console.log("Actions available for resources:");
239
346
  console.log();
@@ -259,6 +366,12 @@ async function printHelp() {
259
366
  console.log("--concern \"concern name\"");
260
367
  console.log("--type [configuration_alert | security_alert]");
261
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();
262
375
  console.log("get-tags", "Gets tags attached to a resource.");
263
376
  console.log("Parameters:");
264
377
  console.log("--company [company_id]");
@@ -307,15 +420,34 @@ async function printHelp() {
307
420
  console.log("--company [company slug]");
308
421
  console.log("--resource-type [string]");
309
422
  console.log();
423
+ console.log("upload-metrics", "Uploads a file of metrics for a resource.");
424
+ console.log("Parameters:");
425
+ console.log("--company [company_id]");
426
+ console.log("--account [account_id]");
427
+ console.log("--resource-id [cloud-resource-id]");
428
+ console.log("--metrics [path to metrics file]");
429
+ console.log();
430
+ console.log("scan", "(beta)" , "Queues the requested resources / account for scanning. Currently only accessible through beta.");
431
+ console.log("Parameters:");
432
+ console.log("--company [company slug]");
433
+ console.log("--account [account_id]");
434
+ console.log("--ids (optional) [resource numeric id] Example: --ids 12345,56854,104455");
435
+ console.log("--resourceIds (optional) [resource cloud id] Example: --resourceIds arn:aws:ec2:us-east-1:444855252760:customer-gateway/1234")
436
+ console.log("--resourceTags (optional) [tag-value] ")
437
+ console.log();
310
438
  }
311
439
 
312
440
  const resourcesModule = (action, ...args) => {
313
441
  switch (action?.toLowerCase() ?? "") {
442
+ case "scan":
443
+ return scan(args);
314
444
  case "get":
315
445
  case "get-compliance":
316
446
  case "get-drift":
317
447
  case "get-tags":
318
448
  return get(action, args);
449
+ case "get-metric-names":
450
+ return getMetricNames(args);
319
451
  case "add-tags":
320
452
  case "remove-tags":
321
453
  return tags(action, args);
@@ -325,6 +457,8 @@ const resourcesModule = (action, ...args) => {
325
457
  return getUsageAnalytics(args);
326
458
  case "get-metric-names-for-resource-type":
327
459
  return getMetricNamesForResourceType(args);
460
+ case "upload-metrics":
461
+ return uploadMetrics(args);
328
462
  case "help":
329
463
  case "":
330
464
  return printHelp();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opscompass/opscompass-cli",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
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.18",
18
+ "@opscompass/opscompass-api": "^1.0.20",
19
19
  "adm-zip": "^0.5.9",
20
20
  "axios": "^0.21.1",
21
21
  "fs-extra": "^10.1.0",