@opscompass/opscompass-cli 1.0.29 → 1.0.31
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.
- package/modules/compliance.js +0 -1
- package/modules/expiration-info.js +185 -0
- package/modules/license-manager.js +87 -1
- package/modules.js +2 -0
- package/package.json +2 -2
package/modules/compliance.js
CHANGED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
const { getOpsCompassClient } = require("../opscompass.js");
|
|
2
|
+
|
|
3
|
+
async function listExpirationComponents(args) {
|
|
4
|
+
for (let i = 0; i < args.length; i++) {
|
|
5
|
+
switch (args[i].toLowerCase()) {
|
|
6
|
+
case "--company":
|
|
7
|
+
callParams.company = args[++i];
|
|
8
|
+
break;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
const client = await getOpsCompassClient();
|
|
14
|
+
const response = await client.expirationInfo.listExpirationComponents(callParams);
|
|
15
|
+
|
|
16
|
+
console.log(JSON.stringify(response, null, 2));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function listExpirationComponentVersions(args) {
|
|
20
|
+
for (let i = 0; i < args.length; i++) {
|
|
21
|
+
switch (args[i].toLowerCase()) {
|
|
22
|
+
case "--company":
|
|
23
|
+
callParams.company = args[++i];
|
|
24
|
+
break;
|
|
25
|
+
case "--componentslug":
|
|
26
|
+
case "--component-slug":
|
|
27
|
+
callParams.componentSlug = args[++i];
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
const client = await getOpsCompassClient();
|
|
34
|
+
const response = await client.expirationInfo.listExpirationComponentVersions(callParams);
|
|
35
|
+
|
|
36
|
+
console.log(JSON.stringify(response, null, 2));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function saveExpirationComponentVersion(args) {
|
|
40
|
+
for (let i = 0; i < args.length - 1; i++) {
|
|
41
|
+
switch (args[i].toLowerCase()) {
|
|
42
|
+
case "--company":
|
|
43
|
+
callParams.company = args[++i];
|
|
44
|
+
break;
|
|
45
|
+
case "--component-version":
|
|
46
|
+
case "--componentversion":
|
|
47
|
+
callParams.componentVersion = args[++i];
|
|
48
|
+
break;
|
|
49
|
+
case "--resource-id":
|
|
50
|
+
case "--resourceid":
|
|
51
|
+
callParams.resourceId = args[++i];
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const client = await getOpsCompassClient();
|
|
57
|
+
const response = await client.expirationInfo.saveExpirationComponentVersion(callParams);
|
|
58
|
+
|
|
59
|
+
console.log(JSON.stringify(response, null, 2));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function deleteExpirationComponentVersion(args) {
|
|
63
|
+
for (let i = 0; i < args.length - 1; i++) {
|
|
64
|
+
switch (args[i].toLowerCase()) {
|
|
65
|
+
case "--company":
|
|
66
|
+
callParams.company = args[++i];
|
|
67
|
+
break;
|
|
68
|
+
case "--component-version":
|
|
69
|
+
case "--componentversion":
|
|
70
|
+
callParams.componentVersion = args[++i];
|
|
71
|
+
break;
|
|
72
|
+
case "--resource-id":
|
|
73
|
+
case "--resourceid":
|
|
74
|
+
callParams.resourceId = args[++i];
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const client = await getOpsCompassClient();
|
|
80
|
+
const response = await client.expirationInfo.deleteExpirationComponentVersion(callParams);
|
|
81
|
+
|
|
82
|
+
console.log(JSON.stringify(response, null, 2));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function listExpirations(args) {
|
|
86
|
+
for (let i = 0; i < args.length - 1; i++) {
|
|
87
|
+
switch (args[i].toLowerCase()) {
|
|
88
|
+
case "--company":
|
|
89
|
+
callParams.company = args[++i];
|
|
90
|
+
break;
|
|
91
|
+
case "--from-date":
|
|
92
|
+
case "--fromdate":
|
|
93
|
+
callParams.fromDate = args[++i];
|
|
94
|
+
break;
|
|
95
|
+
case "--to-date":
|
|
96
|
+
case "--todate":
|
|
97
|
+
callParams.toDate = args[++i];
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const client = await getOpsCompassClient();
|
|
103
|
+
const response = await client.expirationInfo.listExpirations(callParams);
|
|
104
|
+
|
|
105
|
+
console.log(JSON.stringify(response, null, 2));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async function listTracked(args) {
|
|
109
|
+
for (let i = 0; i < args.length - 1; i++) {
|
|
110
|
+
switch (args[i].toLowerCase()) {
|
|
111
|
+
case "--company":
|
|
112
|
+
callParams.company = args[++i];
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const client = await getOpsCompassClient();
|
|
118
|
+
const response = await client.expirationInfo.listTracked(callParams);
|
|
119
|
+
|
|
120
|
+
console.log(JSON.stringify(response, null, 2));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async function printHelp() {
|
|
124
|
+
console.log("Actions available for expiration info:");
|
|
125
|
+
console.log();
|
|
126
|
+
console.log("list-expiration-components", "Retrieves the list of available expiration components for a company.");
|
|
127
|
+
console.log("Parameters:");
|
|
128
|
+
console.log("--company [company_slug]");
|
|
129
|
+
console.log();
|
|
130
|
+
console.log("list-expiration-component-versions", "Retrieves the list of available expiration component versions for a company.");
|
|
131
|
+
console.log("Parameters:");
|
|
132
|
+
console.log("--company [company_slug]");
|
|
133
|
+
console.log("--component-slug [component_slug]");
|
|
134
|
+
console.log();
|
|
135
|
+
console.log("list-expirations", "Retrieves the list of expirations for a company.");
|
|
136
|
+
console.log("Parameters:");
|
|
137
|
+
console.log("--company [company_slug]");
|
|
138
|
+
console.log("--from-date (optional) [string] Example: '2021-01-01T00:00:00.000Z'");
|
|
139
|
+
console.log("--to-date (optional) [string] Example: '2021-12-31T00:00:00.000Z'");
|
|
140
|
+
console.log();
|
|
141
|
+
console.log("list-tracked", "Retrieves the list of tracked expirations for a company.");
|
|
142
|
+
console.log("Parameters:");
|
|
143
|
+
console.log("--company [company_slug]");
|
|
144
|
+
console.log();
|
|
145
|
+
console.log("save-expiration-component-version", "Saves the expiration component version for a company.");
|
|
146
|
+
console.log("Parameters:");
|
|
147
|
+
console.log("--company [company_slug]");
|
|
148
|
+
console.log("--component-version [component_version] Example: 'vue/2'");
|
|
149
|
+
console.log("--resource-id (optional) [string] a resource cloud_id. include if you want to tie this component version to a resource");
|
|
150
|
+
console.log();
|
|
151
|
+
console.log("delete-expiration-component-version", "Deletes the expiration component version for a company.");
|
|
152
|
+
console.log("Parameters:");
|
|
153
|
+
console.log("--company [company_slug]");
|
|
154
|
+
console.log("--component-version [component_version] Example: 'vue/2'");
|
|
155
|
+
console.log("--resource-id (optional) [string] a resource cloud_id. include if you want to delete the tie between this component version and this resource");
|
|
156
|
+
console.log();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const expirationInfoModule = (action, ...args) => {
|
|
160
|
+
switch (action?.toLowerCase() ?? "") {
|
|
161
|
+
case "list-expiration-components":
|
|
162
|
+
return listExpirationComponents(args);
|
|
163
|
+
case "list-expiration-component-versions":
|
|
164
|
+
return listExpirationComponentVersions(args);
|
|
165
|
+
case "list-expirations":
|
|
166
|
+
return listExpirations(args);
|
|
167
|
+
case "list-tracked":
|
|
168
|
+
return listTracked(args);
|
|
169
|
+
case "save-expiration-component-version":
|
|
170
|
+
return saveExpirationComponentVersion(args);
|
|
171
|
+
case "delete-expiration-component-version":
|
|
172
|
+
return deleteExpirationComponentVersion(args);
|
|
173
|
+
case "help":
|
|
174
|
+
case "":
|
|
175
|
+
return printHelp();
|
|
176
|
+
default:
|
|
177
|
+
console.log("Unknown command:", action);
|
|
178
|
+
return printHelp();
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
expirationInfoModule.requiresLogin = true;
|
|
183
|
+
expirationInfoModule.description = "Provides access to details about expirations tracked OpsCompass.";
|
|
184
|
+
|
|
185
|
+
module.exports = expirationInfoModule;
|
|
@@ -417,20 +417,33 @@ async function getMonitoringConfiguration(args) {
|
|
|
417
417
|
|
|
418
418
|
async function createMonitoringConfiguration(args) {
|
|
419
419
|
let name = undefined;
|
|
420
|
+
let optionalParams = {
|
|
421
|
+
autoUpdateScripts: undefined,
|
|
422
|
+
autoUpdateConfigurations: undefined,
|
|
423
|
+
};
|
|
420
424
|
for (let i = 0; i < args.length - 1; i++) {
|
|
421
425
|
switch (args[i].toLowerCase()) {
|
|
422
426
|
case "--company":
|
|
423
427
|
company = args[++i];
|
|
424
428
|
break;
|
|
425
429
|
case "--configurationname":
|
|
430
|
+
case "--configuration-name":
|
|
426
431
|
name = args[++i];
|
|
427
432
|
break;
|
|
433
|
+
case "--autoupdatescripts":
|
|
434
|
+
case "--auto-update-scripts":
|
|
435
|
+
optionalParams.autoUpdateScripts = args[++i] === "true";
|
|
436
|
+
break;
|
|
437
|
+
case "--autoupdateconfigurations":
|
|
438
|
+
case "--auto-update-configurations":
|
|
439
|
+
optionalParams.autoUpdateConfigurations = args[++i] === "true";
|
|
440
|
+
break;
|
|
428
441
|
}
|
|
429
442
|
}
|
|
430
443
|
|
|
431
444
|
const client = await getOpsCompassClient();
|
|
432
445
|
const monitoringConfiguration =
|
|
433
|
-
await client.licenseManager.createMonitoringConfiguration(company, name);
|
|
446
|
+
await client.licenseManager.createMonitoringConfiguration(company, name, optionalParams);
|
|
434
447
|
|
|
435
448
|
console.log(JSON.stringify(monitoringConfiguration, null, 2));
|
|
436
449
|
}
|
|
@@ -1359,6 +1372,55 @@ async function getMssqlAssessmentResources(args) {
|
|
|
1359
1372
|
console.log(JSON.stringify(response, null, 2));
|
|
1360
1373
|
}
|
|
1361
1374
|
|
|
1375
|
+
async function checkMssqlConfigMetadata(args) {
|
|
1376
|
+
|
|
1377
|
+
for (let i = 0; i < args.length - 1; i++) {
|
|
1378
|
+
switch (args[i].toLowerCase()) {
|
|
1379
|
+
case "--account-id":
|
|
1380
|
+
case "--accountid":
|
|
1381
|
+
callParams.accountId = args[++i];
|
|
1382
|
+
break;
|
|
1383
|
+
case "--company":
|
|
1384
|
+
callParams.company = args[++i];
|
|
1385
|
+
break;
|
|
1386
|
+
case "--last-collected-before":
|
|
1387
|
+
case "--lastcollectedbefore":
|
|
1388
|
+
callParams.lastCollectedBefore = args[++i];
|
|
1389
|
+
break;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
const client = await getOpsCompassClient();
|
|
1394
|
+
const response = await client.licenseManager.checkMssqlConfigMetadata(callParams.accountId, callParams.company, callParams.lastCollectedBefore);
|
|
1395
|
+
|
|
1396
|
+
console.log(JSON.stringify(response, null, 2));
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
async function checkOracleConfigMetadata(args) {
|
|
1400
|
+
|
|
1401
|
+
for (let i = 0; i < args.length - 1; i++) {
|
|
1402
|
+
switch (args[i].toLowerCase()) {
|
|
1403
|
+
case "--account-id":
|
|
1404
|
+
case "--accountid":
|
|
1405
|
+
callParams.accountId = args[++i];
|
|
1406
|
+
break;
|
|
1407
|
+
case "--company":
|
|
1408
|
+
callParams.company = args[++i];
|
|
1409
|
+
break;
|
|
1410
|
+
case "--last-collected-before":
|
|
1411
|
+
case "--lastcollectedbefore":
|
|
1412
|
+
callParams.lastCollectedBefore = args[++i];
|
|
1413
|
+
break;
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
const client = await getOpsCompassClient();
|
|
1418
|
+
const response = await client.licenseManager.checkOracleConfigMetadata(callParams.accountId, callParams.company, callParams.lastCollectedBefore);
|
|
1419
|
+
|
|
1420
|
+
console.log(JSON.stringify(response, null, 2));
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
|
|
1362
1424
|
async function printHelp() {
|
|
1363
1425
|
console.log("Actions available for license-manager:");
|
|
1364
1426
|
console.log();
|
|
@@ -1469,6 +1531,8 @@ async function printHelp() {
|
|
|
1469
1531
|
console.log("Parameters:");
|
|
1470
1532
|
console.log("--company [company_slug]");
|
|
1471
1533
|
console.log("--configurationName [configuration name]");
|
|
1534
|
+
console.log("--autoUpdateScripts (optional) [true | false] automatically update all scripts when the scripts are run.");
|
|
1535
|
+
console.log("--autoUpdateConfigurations (optional) [true | false] automatically update all configurations when scripts are run.");
|
|
1472
1536
|
console.log();
|
|
1473
1537
|
console.log(
|
|
1474
1538
|
"create-network-discovery-configuration",
|
|
@@ -1903,6 +1967,24 @@ async function printHelp() {
|
|
|
1903
1967
|
console.log("Parameters:");
|
|
1904
1968
|
console.log("--assessmentId [number] The id of the assessment to retrieve.");
|
|
1905
1969
|
console.log();
|
|
1970
|
+
console.log(
|
|
1971
|
+
"check-mssql-config-metadata",
|
|
1972
|
+
"Checks the mssql configuration metadata for a company."
|
|
1973
|
+
);
|
|
1974
|
+
console.log("Parameters:");
|
|
1975
|
+
console.log("--accountId [string] The account id for the company.");
|
|
1976
|
+
console.log("--company [string] The company slug.");
|
|
1977
|
+
console.log("--lastCollectedBefore [string] (optional) Only returns records that have not been collected since the given date. Format: UTC, example: '2022-08-23T17:00:00Z'");
|
|
1978
|
+
console.log();
|
|
1979
|
+
console.log(
|
|
1980
|
+
"check-oracle-config-metadata",
|
|
1981
|
+
"Checks the oracle configuration metadata for a company."
|
|
1982
|
+
);
|
|
1983
|
+
console.log("Parameters:");
|
|
1984
|
+
console.log("--accountId [string] The account id for the company.");
|
|
1985
|
+
console.log("--company [string] The company slug.");
|
|
1986
|
+
console.log("--lastCollectedBefore [string] (optional) Only returns records that have not been collected since the given date. Format: UTC, example: '2022-08-23T17:00:00Z'");
|
|
1987
|
+
console.log();
|
|
1906
1988
|
}
|
|
1907
1989
|
|
|
1908
1990
|
const licenseManagerModule = (action, ...args) => {
|
|
@@ -1999,6 +2081,10 @@ const licenseManagerModule = (action, ...args) => {
|
|
|
1999
2081
|
return updateMssqlEntitlement(args);
|
|
2000
2082
|
case "delete-mssql-entitlements":
|
|
2001
2083
|
return deleteMssqlEntitlements(args);
|
|
2084
|
+
case "check-mssql-config-metadata":
|
|
2085
|
+
return checkMssqlConfigMetadata(args);
|
|
2086
|
+
case "check-oracle-config-metadata":
|
|
2087
|
+
return checkOracleConfigMetadata(args);
|
|
2002
2088
|
case "help":
|
|
2003
2089
|
case "":
|
|
2004
2090
|
return printHelp();
|
package/modules.js
CHANGED
|
@@ -2,6 +2,7 @@ const resources = require("./modules/resources.js");
|
|
|
2
2
|
const accounts = require("./modules/accounts.js");
|
|
3
3
|
const licenseManager = require("./modules/license-manager.js");
|
|
4
4
|
const compliance = require("./modules/compliance.js");
|
|
5
|
+
const expirationInfo = require("./modules/expiration-info.js");
|
|
5
6
|
const defaults = require("./modules/defaults.js");
|
|
6
7
|
|
|
7
8
|
// Dynaimcally loaded modules - may be optional
|
|
@@ -26,5 +27,6 @@ module.exports = {
|
|
|
26
27
|
compliance,
|
|
27
28
|
defaults,
|
|
28
29
|
"license-manager": licenseManager,
|
|
30
|
+
"expiration-info": expirationInfo,
|
|
29
31
|
"data-gathering-scripts": dataGatheringScripts,
|
|
30
32
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opscompass/opscompass-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
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
|
+
"@opscompass/opscompass-api": "^1.0.31",
|
|
19
19
|
"adm-zip": "^0.5.9",
|
|
20
20
|
"axios": "^0.21.1",
|
|
21
21
|
"fs-extra": "^10.1.0",
|