@opscompass/opscompass-cli 1.0.17 → 1.0.18

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.
@@ -144,6 +144,61 @@ const { getCredentials } = require("../credentials.js");
144
144
  console.log(JSON.stringify(response, null, 2));
145
145
  }
146
146
 
147
+
148
+ async function listChecksWithDetails(args) {
149
+ for (let i = 0; i < args.length; i++) {
150
+ switch (args[i].toLowerCase()) {
151
+ case "--company":
152
+ callParams.company = args[i+1];
153
+ break;
154
+ case "--accounts":
155
+ if (typeof callParams.accounts === "string") {
156
+ callParams.accounts = [callParams.accounts];
157
+ }
158
+ if (Array.isArray(callParams.accounts)) {
159
+ callParams.accounts.push(args[++i]);
160
+ } else {
161
+ callParams.accounts = args[++i];
162
+ }
163
+ break;
164
+ }
165
+ }
166
+
167
+
168
+ const client = await getOpsCompassClient();
169
+ const response = await client.compliance.listChecksWithDetails(callParams.company, callParams.accounts);
170
+
171
+
172
+ console.log(JSON.stringify(response, null, 2));
173
+ }
174
+
175
+ async function listDisabledChecks(args) {
176
+ for (let i = 0; i < args.length; i++) {
177
+ switch (args[i].toLowerCase()) {
178
+ case "--company":
179
+ callParams.company = args[i+1];
180
+ break;
181
+ case "--accounts":
182
+ if (typeof callParams.accounts === "string") {
183
+ callParams.accounts = [callParams.accounts];
184
+ }
185
+ if (Array.isArray(callParams.accounts)) {
186
+ callParams.accounts.push(args[++i]);
187
+ } else {
188
+ callParams.accounts = args[++i];
189
+ }
190
+ break;
191
+ }
192
+ }
193
+
194
+
195
+ const client = await getOpsCompassClient();
196
+ const response = await client.compliance.listDisabledChecks(callParams.company, callParams.accounts);
197
+
198
+
199
+ console.log(JSON.stringify(response, null, 2));
200
+ }
201
+
147
202
  async function transferVMwareVsphereMetadata(args) {
148
203
  const callParams = genericMetadataTrasfer(args);
149
204
  const client = await getOpsCompassClient();
@@ -368,6 +423,16 @@ const { getCredentials } = require("../credentials.js");
368
423
  async function printHelp() {
369
424
  console.log("Actions available for compliance:");
370
425
  console.log();
426
+ console.log("list-checks-with-details", "Retrieves the list of compliance checks for the specified company, with the amount of active resource problems and compliance score impact for each check");
427
+ console.log("Parameters:");
428
+ console.log("--company [company_slug]");
429
+ console.log("--accounts (optional) [account_id]");
430
+ console.log();
431
+ console.log("list-disabled-checks", "Retrieves the list of disabled compliance checks for the specified company, with the amount of resources that each check is not scanning against.");
432
+ console.log("Parameters:");
433
+ console.log("--company [company_slug]");
434
+ console.log("--accounts (optional) [account_id]");
435
+ console.log();
371
436
  console.log("list-frameworks", "Retrieves the list of compliance frameworks available for the specified company");
372
437
  console.log("Parameters:");
373
438
  console.log("--company [company_slug]");
@@ -469,6 +534,10 @@ const { getCredentials } = require("../credentials.js");
469
534
 
470
535
  const complianceModule = (action, ...args) => {
471
536
  switch (action?.toLowerCase() ?? "") {
537
+ case "list-checks-with-details":
538
+ return listChecksWithDetails(args);
539
+ case "list-disabled-checks":
540
+ return listDisabledChecks(args);
472
541
  case "list-frameworks-with-details":
473
542
  return listFrameworksWithDetails(args);
474
543
  case "list-frameworks":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opscompass/opscompass-cli",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
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.17",
18
+ "@opscompass/opscompass-api": "^1.0.18",
19
19
  "adm-zip": "^0.5.9",
20
20
  "axios": "^0.21.1",
21
21
  "fs-extra": "^10.1.0",