@opscompass/opscompass-cli 1.0.12 → 1.0.13

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.
@@ -45,16 +45,78 @@ const { getCredentials } = require("../credentials.js");
45
45
 
46
46
  async function listComplianceExceptions(args) {
47
47
  let company = undefined;
48
+ let optionalParams = {
49
+ fromIndex: undefined,
50
+ numberOfRecords: undefined,
51
+ complianceExceptionSort: undefined,
52
+ complianceExceptionSortDirection: undefined,
53
+ searchText: undefined,
54
+ typeFilter: undefined,
55
+ statusFilter: undefined,
56
+ expiresAtFrom: undefined,
57
+ expiresAtTo: undefined,
58
+ checkIdsFilter: undefined,
59
+ resourceIdsFilter: undefined,
60
+ creatorIdsFilter: undefined
61
+ };
48
62
  for (let i = 0; i < args.length - 1; i++) {
49
63
  switch (args[i].toLowerCase()) {
50
64
  case "--company":
51
65
  company = args[++i];
52
66
  break;
53
- }
67
+ case "--from-index":
68
+ case "--fromindex":
69
+ optionalParams.fromIndex = args[++i];
70
+ break;
71
+ case "--number-of-records":
72
+ case "--numberofrecords":
73
+ optionalParams.numberOfRecords = args[++i];
74
+ break;
75
+ case "--compliance-exception-sort":
76
+ case "--complianceexceptionsort":
77
+ optionalParams.complianceExceptionSort = args[++i];
78
+ break;
79
+ case "--compliance-exception-sort-direction":
80
+ case "--complianceexceptionsortdirection":
81
+ optionalParams.complianceExceptionSortDirection = args[++i];
82
+ break;
83
+ case "--search-text":
84
+ case "--searchtext":
85
+ optionalParams.searchText = args[++i];
86
+ break;
87
+ case "--type-filter":
88
+ case "--typefilter":
89
+ optionalParams.typeFilter = args[++i];
90
+ break;
91
+ case "--status-filter":
92
+ case "--statusfilter":
93
+ optionalParams.statusFilter = args[++i];
94
+ break;
95
+ case "--expires-at-from":
96
+ case "--expiresatfrom":
97
+ optionalParams.expiresAtFrom = args[++i];
98
+ break;
99
+ case "--expires-at-to":
100
+ case "--expiresatto":
101
+ optionalParams.expiresAtTo = args[++i];
102
+ break;
103
+ case "--check-ids-filter":
104
+ case "--checkidsfilter":
105
+ optionalParams.checkIdsFilter = args[++i];
106
+ break;
107
+ case "--resource-ids-filter":
108
+ case "--resourceidsfilter":
109
+ optionalParams.resourceIdsFilter = args[++i];
110
+ break;
111
+ case "--creator-ids-filter":
112
+ case "--creatoridsfilter":
113
+ optionalParams.creatorIdsFilter = args[++i];
114
+ break;
115
+ }
54
116
  }
55
117
 
56
118
  const client = await getOpsCompassClient();
57
- const complianceExceptions = await client.compliance.getComplianceExceptions(company);
119
+ const complianceExceptions = await client.compliance.getComplianceExceptions(company, optionalParams);
58
120
 
59
121
  console.log(JSON.stringify(complianceExceptions, null, 2));
60
122
  }
@@ -185,6 +247,20 @@ const { getCredentials } = require("../credentials.js");
185
247
  console.log("list-compliance-exceptions", "Gets list of policy exceptions and mitigations");
186
248
  console.log("Parameters:");
187
249
  console.log("--company [company_slug]");
250
+ console.log("--from-index (optional) [number] the record index to start at when fetching the next round of records (helps with fetching all records over multiple requests)");
251
+ console.log("--number-of-records (optional) [number] the number of records to fetch with one request");
252
+ console.log("--compliance-exception-sort: (optional) [resource | check | type | created-at | expires-at | reason] the column on which to sort records by");
253
+ console.log("--compliance-exception-sort-direction: (optional) [asc | desc] the direction to sort records by");
254
+ console.log("--search-text: (optional) [string] search columns by this text");
255
+ console.log('--type-filter: (optional) [mitigation and/or policy_exception] filter results by type. Ex: --type-filter "policy_exception, mitigation"');
256
+ console.log('--status-filter: (optional) [active and/or expired] filter results by status. Ex: --status-filter "expired, active"');
257
+ console.log("--expires-at-from: (optional) [string] the date at which to not show records before.");
258
+ console.log("Format: UTC, example: '2022-08-23T17:00:00Z' to filter by August 8th, 2022 at 17:00 UTC.");
259
+ console.log("--expires-at-to: (optional) [string] the date at which to not show records after.");
260
+ console.log("Format: UTC, example: '2022-08-23T17:00:00Z' to filter by August 8th, 2022 at 17:00 UTC.");
261
+ console.log('--check-ids-filter: (optional) [string] check ids to filter records by. Ex: --check-ids-filter "123, 456, 789"');
262
+ console.log('--resource-ids-filter: (optional) [string] resource ids to filter records by. Ex: --resource-ids-filter "123, 456, 789"');
263
+ console.log('--creator-ids-filter: (optional) [string] user ids to filter records by. Ex: --creator-ids-filter "123, 456, 789"');
188
264
  console.log();
189
265
  console.log("update-compliance-exception", "Updates single compliance exception record (i.e. mitigations and policy exceptions)");
190
266
  console.log("Parameters:");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opscompass/opscompass-cli",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
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.12",
18
+ "@opscompass/opscompass-api": "^1.0.13",
19
19
  "adm-zip": "^0.5.9",
20
20
  "axios": "^0.21.1",
21
21
  "fs-extra": "^10.1.0",