@opscompass/opscompass-cli 1.0.10 → 1.0.12

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/credentials.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const fs = require("fs");
2
2
  const path = require("path");
3
3
  const { redeemRefreshToken } = require("./oauth");
4
- const { opscompassHome } = require("./environment/current.js");
4
+ const { opscompassHome, cliCommand } = require("./environment/current.js");
5
5
  const {
6
6
  writeFileToHome
7
7
  } = require("./lib/homeInteraction.js");
@@ -24,7 +24,7 @@ async function storeCredentials(data) {
24
24
  data.expires_at = new Date(Date.now() + (data.expires_in * 1000));
25
25
  }
26
26
 
27
- return writeFileToHome('tokens.json', data);
27
+ return writeFileToHome('tokens.json', data, 0o600);
28
28
  }
29
29
 
30
30
  async function getCredentials() {
@@ -52,12 +52,14 @@ async function getCredentials() {
52
52
  await storeCredentials(refreshedTokenData);
53
53
  resolve(refreshedTokenData);
54
54
  }
55
-
56
55
  // return the data from the file
57
56
  resolve(tokensData);
58
57
  } catch (innerError) {
59
- reject(innerError);
60
- }
58
+ reject();
59
+ console.log();
60
+ console.warn(`You aren't logged in. Please run '${cliCommand} login' to log in.`)
61
+ console.log();
62
+ }
61
63
  }
62
64
  );
63
65
  } catch (e) {
package/lib/cliHelpers.js CHANGED
@@ -138,6 +138,29 @@ async function unzipFile(unzipFileLocation, unzipFileName) {
138
138
  }
139
139
  }
140
140
 
141
+ /**
142
+ * We need to be able to get all file paths for a given directory. This returns all file paths in all sub folders as well.
143
+ * @param {string} dirPath the path to the directory to return all file paths for
144
+ * @returns {string[]} all file paths recursively for the passed in directory path
145
+ */
146
+ function getAllFilesInFolder(dirPath) {
147
+ files = fs.readdirSync(dirPath);
148
+
149
+ var arrayOfFiles = arrayOfFiles || [];
150
+
151
+ files.forEach(function(file) {
152
+ const filePathToCheck = path.join(dirPath, file);
153
+ if (fs.lstatSync(filePathToCheck).isDirectory() ) {
154
+ const folderFiles = getAllFilesInFolder(filePathToCheck);
155
+ arrayOfFiles = arrayOfFiles.concat(folderFiles);
156
+ } else {
157
+ arrayOfFiles.push(filePathToCheck);
158
+ }
159
+ });
160
+
161
+ return arrayOfFiles
162
+ }
163
+
141
164
  /**
142
165
  * Moves a directory and contents from one location to another.
143
166
  * @param {string} sourcePath the directory to move
@@ -201,5 +224,6 @@ module.exports = {
201
224
  findOrCreateFolder,
202
225
  canReadFile,
203
226
  moveFolder,
227
+ getAllFilesInFolder,
204
228
  FilePermissions
205
229
  };
@@ -10,7 +10,8 @@ const {
10
10
  moveFolder,
11
11
  writeFile,
12
12
  canReadFile,
13
- FilePermissions
13
+ FilePermissions,
14
+ getAllFilesInFolder
14
15
  } = require("./cliHelpers.js");
15
16
 
16
17
  const SRC_FOLDER_NAME = "src";
@@ -140,7 +141,20 @@ async function downloadScriptsToHome(scriptType, scriptVersion, companySlug, cli
140
141
  await unzipFile(scriptTypeFolderPath, fileName);
141
142
 
142
143
  // Move contents from script version folder to src
143
- await moveFolder(path.join(scriptTypeFolderPath, scriptVersion), path.join(scriptTypeFolderPath, SRC_FOLDER_NAME));
144
+ const destinationPath = path.join(scriptTypeFolderPath, SRC_FOLDER_NAME);
145
+ await moveFolder(path.join(scriptTypeFolderPath, scriptVersion), destinationPath);
146
+
147
+ // Set all files to mode 600, if they are .sh set to 700.
148
+ const allFilePaths = getAllFilesInFolder(destinationPath);
149
+ allFilePaths.forEach(function(filePath) {
150
+ var fileExtension = path.extname(filePath);
151
+
152
+ if (fileExtension === '.sh') {
153
+ fs.chmodSync(filePath, 0o700);
154
+ } else {
155
+ fs.chmodSync(filePath, 0o600);
156
+ }
157
+ });
144
158
 
145
159
  // Set the script's metadata
146
160
  await setScriptMetadata(scriptTypeFolderPath, scriptVersion);
@@ -148,6 +162,20 @@ async function downloadScriptsToHome(scriptType, scriptVersion, companySlug, cli
148
162
  deleteFile(path.join(scriptTypeFolderPath, fileName));
149
163
  }
150
164
 
165
+ /**
166
+ * Returns boolean indicating if the script type has been downloaded previously, or if this is the first time.
167
+ * @param {string} scriptType the script type to check
168
+ * @return {boolean} indicates if script type has been previously downloaded
169
+ */
170
+ function previousScriptsDownloaded(scriptType) {
171
+ const folderPath = scriptTypeFolderPath(scriptType);
172
+ try {
173
+ return fs.existsSync(folderPath);
174
+ } catch (err) {
175
+ return false;
176
+ }
177
+ }
178
+
151
179
  /**
152
180
  * Creates/updates a file that contains a specific script's metadata.
153
181
  * @param {string} scriptFolderPath path to the script folder
@@ -178,5 +206,6 @@ module.exports = {
178
206
  findOrCreateScriptTypeFolder,
179
207
  getInstalledScriptVersion,
180
208
  removeCurrentlyInstalledScript,
181
- downloadScriptsToHome
209
+ downloadScriptsToHome,
210
+ previousScriptsDownloaded
182
211
  };
@@ -2,9 +2,36 @@ const { getOpsCompassClient } = require("../opscompass.js");
2
2
  const { getCredentials } = require("../credentials.js");
3
3
 
4
4
  async function transferOracleDatabaseMetadata(args) {
5
+ const callParams = genericMetadataTrasfer(args);
6
+ const client = await getOpsCompassClient();
7
+ const response = await client.compliance.transferOracleDatabaseMetadata(callParams.company, callParams.type, callParams.filePath);
8
+
9
+ console.log(JSON.stringify(response, null, 2));
10
+ }
11
+
12
+ async function transferVMwareVsphereMetadata(args) {
13
+ const callParams = genericMetadataTrasfer(args);
14
+ const client = await getOpsCompassClient();
15
+ const response = await client.compliance.transferVMwareVsphereMetadata(callParams.company, callParams.filePath);
16
+
17
+ console.log(JSON.stringify(response, null, 2));
18
+ }
19
+
20
+ async function transferSqlServerDatabaseMetadata(args) {
21
+ const callParams = genericMetadataTrasfer(args);
22
+ const client = await getOpsCompassClient();
23
+ const response = await client.compliance.transferSqlServerDatabaseMetadata(callParams.company, callParams.type, callParams.filePath);
24
+
25
+ console.log(JSON.stringify(response, null, 2));
26
+ }
27
+
28
+ function genericMetadataTrasfer(args) {
5
29
  const callParams = {};
6
30
  for (let i = 0; i < args.length - 1; i++) {
7
31
  switch (args[i].toLowerCase()) {
32
+ case "--type":
33
+ callParams.type = args[++i];
34
+ break;
8
35
  case "--filepath":
9
36
  callParams.filePath = args[++i];
10
37
  break;
@@ -13,30 +40,198 @@ const { getCredentials } = require("../credentials.js");
13
40
  break;
14
41
  }
15
42
  }
43
+ return callParams;
44
+ }
45
+
46
+ async function listComplianceExceptions(args) {
47
+ let company = undefined;
48
+ for (let i = 0; i < args.length - 1; i++) {
49
+ switch (args[i].toLowerCase()) {
50
+ case "--company":
51
+ company = args[++i];
52
+ break;
53
+ }
54
+ }
55
+
56
+ const client = await getOpsCompassClient();
57
+ const complianceExceptions = await client.compliance.getComplianceExceptions(company);
58
+
59
+ console.log(JSON.stringify(complianceExceptions, null, 2));
60
+ }
16
61
 
62
+ async function updateComplianceException(args) {
63
+ const callParams = {};
64
+ for (let i = 0; i < args.length - 1; i++) {
65
+ switch (args[i].toLowerCase()) {
66
+ case "--id":
67
+ callParams.id = args[++i];
68
+ break;
69
+ case "--reason":
70
+ callParams.reason = args[++i];
71
+ break;
72
+ case "--expiresat":
73
+ case "--expires-at":
74
+ const expiresDate = args[++i];
75
+ if (expiresDate === 'null') {
76
+ callParams.expiresAt = null;
77
+ } else {
78
+ callParams.expiresAt = expiresDate;
79
+ }
80
+
81
+ break;
82
+ }
83
+ }
17
84
 
18
85
  const client = await getOpsCompassClient();
19
- const response = await client.compliance.transferOracleDatabaseMetadata(callParams.company, callParams.filePath);
20
-
21
- console.log(JSON.stringify(response, null, 2));
86
+ const complianceException = await client.compliance.updateComplianceException(callParams.id, callParams);
87
+ console.log(JSON.stringify(complianceException, null, 2));
22
88
  }
89
+
90
+ async function updateComplianceExceptions(args) {
91
+ let callParamsArray = [];
92
+ let jsonIndex = args.indexOf('--json-updates');
93
+ let idIndex = args.indexOf('--id');
94
+ let callParams = {};
23
95
 
96
+ /* Process bulk update with JSON */
97
+ if (jsonIndex !== -1) {
98
+ const jsonString = args[jsonIndex + 1];
99
+ callParamsArray = JSON.parse(jsonString);
100
+ } else if (idIndex !== -1) {
101
+ /* If no '--json-update' flag, process bulk update with parameter flags (e.g. --id, --name, etc.) */
102
+ for(let i = 0; i < args.length - 1; i++) {
103
+ const argument = args[i].toLowerCase();
104
+ if(argument === '--id') {
105
+ /* Reset callParams object when a second id is encountered */
106
+ callParams = {};
107
+ /* if theres an existing callParams object, toss it into the array and move on. */
108
+ callParamsArray.push(callParams)
109
+ /* Create the object's properties based on the index (e.g. if the index is --id, you'll find the value at the next index */
110
+ callParams.id = args[i + 1];
111
+ } else if(argument === '--reason') {
112
+ callParams.reason = args[i + 1];
113
+ } else if(argument === '--expiresat' || argument === '--expires-at') {
114
+ const expiresDate = args[i + 1];
115
+ if (expiresDate === 'null') {
116
+ callParams.expiresAt = null;
117
+ } else {
118
+ callParams.expiresAt = expiresDate;
119
+ }
120
+ }
121
+ }
122
+ } else {
123
+ console.warn("Invalid input, please see help for examples.")
124
+ }
125
+
126
+ /* Call the API and print to console */
127
+ const client = await getOpsCompassClient();
128
+ const vCenterConfigurations = await client.compliance.updateComplianceExceptions(callParamsArray);
129
+ console.log(JSON.stringify(vCenterConfigurations, null, 2));
130
+ }
24
131
 
132
+ async function createComplianceResourceCheckException(args) {
133
+ let complianceResourceCheckId= undefined;
134
+ let complianceExceptionType= undefined;
135
+ let reason = undefined;
136
+ let expiresAt = undefined;
137
+
138
+ for (let i = 0; i < args.length - 1; i++) {
139
+ switch (args[i].toLowerCase()) {
140
+ case "--complianceresourcecheckid":
141
+ case "--compliance-resource-check-id":
142
+ complianceResourceCheckId = args[i+1];
143
+ break;
144
+ case "--complianceexceptiontype":
145
+ case "--compliance-exception-type":
146
+ complianceExceptionType = args[i+1];
147
+ break;
148
+ case "--reason":
149
+ reason = args[i+1];
150
+ break;
151
+ case "--expiresat":
152
+ case "--expires-at":
153
+ expiresAt = args[i+1];
154
+ break;
155
+ }
156
+ }
157
+
158
+ const client = await getOpsCompassClient();
159
+ const complianceExceptions = await client.compliance.createComplianceResourceCheckException(complianceResourceCheckId, complianceExceptionType, reason, expiresAt);
160
+ console.log(JSON.stringify(complianceExceptions, null, 2));
161
+ console.log();
162
+ }
163
+
164
+
25
165
  async function printHelp() {
26
166
  console.log("Actions available for compliance:");
27
167
  console.log();
28
168
  console.log("transfer-oracle-database-metadata", "Transfers OpsCompass Oracle Database metadata report into OpsCompass for processing");
29
169
  console.log("Parameters:");
30
170
  console.log("--company [company_slug]");
171
+ console.log("--type [licensing | compliance]")
31
172
  console.log("--filePath [path] Path of the file to transfer to OpsCompass for processing.");
32
173
  console.log();
174
+ console.log("transfer-vmware-vsphere-metadata", "Transfers OpsCompass VMware VSphere metadata report into OpsCompass for processing");
175
+ console.log("Parameters:");
176
+ console.log("--company [company_slug]");
177
+ console.log("--filePath [path] Path of the file to transfer to OpsCompass for processing.");
178
+ console.log();
179
+ console.log("transfer-sql-server-database-metadata", "Transfers OpsCompass SQL Server Database metadata report into OpsCompass for processing");
180
+ console.log("Parameters:");
181
+ console.log("--company [company_slug]");
182
+ console.log("--type [licensing | compliance]")
183
+ console.log("--filePath [path] Path of the file to transfer to OpsCompass for processing.");
184
+ console.log();
185
+ console.log("list-compliance-exceptions", "Gets list of policy exceptions and mitigations");
186
+ console.log("Parameters:");
187
+ console.log("--company [company_slug]");
188
+ console.log();
189
+ console.log("update-compliance-exception", "Updates single compliance exception record (i.e. mitigations and policy exceptions)");
190
+ console.log("Parameters:");
191
+ console.log("--id [record id]");
192
+ console.log("--reason [string] the reason for the compliance exception");
193
+ console.log("--expiresAt [string] the date at which to expire. If you want to remove a compliance exception from the list, set the expiresAt to todays date.");
194
+ console.log("Format: UTC, example: '2022-08-23T17:00:00Z' to expire August 8th, 2022 at 17:00 UTC. To remove this field, pass in null.");
195
+ console.log();
196
+ console.log("update-compliance-exceptions", "Updates multiple compliance exceptions (i.e. mitigations and policy exceptions)");
197
+ console.log("Parameters:");
198
+ console.log("--id [record id]");
199
+ console.log("--reason (optional) [string] the reason for the compliance exception");
200
+ console.log("--expiresAt (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.");
201
+ console.log("Format: UTC, example: '2022-08-23T17:00:00Z' to expire August 8th, 2022 at 17:00 UTC. To remove this field, pass in null.");
202
+ console.log("OR --json-updates [stringified json objects with your updates]");
203
+ console.log("For quick updates, you may use the above parameters");
204
+ console.log('e.g. opscompass compliance update-compliance-exceptions --id 18 --reason "Valid exception reason" --id 3 --expires-at "09/15/2022"');
205
+ console.log("For larger updates, JavaScript Object Notation (JSON) may be used with the --json-updates flag");
206
+ console.log(`e.g. opscompass compliance update-compliance-exceptions --json-updates '[{\"id\":\"18\",\"reason\":\"Valid exception reason\"},{\"id\":\"3\",\"expiresAt\":\"2022-08-23T17:00:00Z\"}]'`);
207
+ console.log();
208
+ console.log("create-compliance-resource-check-exceptions", "Creates a new compliance resource check exception");
209
+ console.log("Parameters:");
210
+ console.log("--compliance-resource-check-id [the compliance resource check id]");
211
+ console.log("--compliance-exception-type [string] the type of compliance exception: 'mitigation' or 'policy_exception'");
212
+ console.log("--reason [string] the reason for the compliance resource check exception");
213
+ 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.");
214
+ console.log("Format: UTC, example: '2022-08-23T17:00:00Z' to expire August 8th, 2022 at 17:00 UTC.");
215
+ console.log();
33
216
  }
34
217
 
35
218
 
36
219
  const complianceModule = (action, ...args) => {
37
220
  switch (action?.toLowerCase() ?? "") {
221
+ case "transfer-vmware-vsphere-metadata":
222
+ return transferVMwareVsphereMetadata(args);
38
223
  case "transfer-oracle-database-metadata":
39
224
  return transferOracleDatabaseMetadata(args);
225
+ case "transfer-sql-server-database-metadata":
226
+ return transferSqlServerDatabaseMetadata(args);
227
+ case "list-compliance-exceptions":
228
+ return listComplianceExceptions(args);
229
+ case "update-compliance-exception":
230
+ return updateComplianceException(args);
231
+ case "update-compliance-exceptions":
232
+ return updateComplianceExceptions(args);
233
+ case "create-compliance-resource-check-exception":
234
+ return createComplianceResourceCheckException(args);
40
235
  case "help":
41
236
  case "":
42
237
  return printHelp();
@@ -1,6 +1,6 @@
1
1
  const { getOpsCompassClient } = require("../opscompass.js");
2
2
  const { ScriptType, cliCommand } = require("../environment/current.js");
3
- const { downloadScriptsToHome, findOrCreateScriptTypeFolder, SRC_FOLDER_NAME, BASE_SCRIPTS_RUN_ALL_RELATIVE_PATH, getInstalledScriptVersion } = require("../lib/homeInteraction.js");
3
+ const { downloadScriptsToHome, findOrCreateScriptTypeFolder, SRC_FOLDER_NAME, BASE_SCRIPTS_RUN_ALL_RELATIVE_PATH, getInstalledScriptVersion, previousScriptsDownloaded } = require("../lib/homeInteraction.js");
4
4
  const { canReadFile } = require("../lib/cliHelpers.js");
5
5
  const semver = require("semver");
6
6
  const path = require("path");
@@ -11,6 +11,7 @@ const exec = util.promisify(require('child_process').exec);
11
11
  /**
12
12
  * Downloads data gathering scripts based on the given scriptType.
13
13
  */
14
+
14
15
  async function downloadScripts(args) {
15
16
  let companySlug = undefined;
16
17
  let scriptType = undefined;
@@ -88,14 +89,53 @@ async function checkScriptUpdates(args) {
88
89
 
89
90
  //Semver returns true if the latest version is higher than the currentScriptVersion.
90
91
  if (semver.gt(latestScriptVersion.scriptVersion, currentScriptVersion)) {
91
- console.log(yellowText, `Warning! You are using version ${currentScriptVersion} of the the ${scriptType} scripts, but the latest version is ${latestScriptVersion.scriptVersion}.`);
92
- console.log(yellowText, `To update to the latest version, please run: ${cliCommand} data-gathering-scripts download-scripts --company ${companySlug} --scriptType ${scriptType} `);
92
+ console.log(yellowText, `Warning! You are using version ${currentScriptVersion} of the the ${scriptType} scripts, but the latest version is ${latestScriptVersion.scriptVersion}. To update to the latest version, please run:`);
93
+ console.log(greenText, ` ${cliCommand} data-gathering-scripts download-scripts --company ${companySlug} --scriptType ${scriptType} `);
94
+ console.log();
93
95
  } else {
94
- console.log(greenText, `You are using the latest version of ${scriptType} script, ${latestScriptVersion.scriptVersion}.`);
96
+ console.log(greenText, `You are already using the latest version of ${scriptType} script, ${latestScriptVersion.scriptVersion}.`);
95
97
  console.log();
96
98
  }
97
99
  }
98
100
 
101
+ async function autoCheckScriptUpdates(args) {
102
+ let companySlug = undefined;
103
+ let scriptType = undefined;
104
+ for (let i = 0; i < args.length - 1; i++) {
105
+ switch (args[i].toLowerCase()) {
106
+ case "--company":
107
+ companySlug = args[++i];
108
+ break;
109
+ case "--script-type":
110
+ case "--scripttype":
111
+ scriptType = args[++i];
112
+ break;
113
+ }
114
+ }
115
+
116
+ // Check to see if script type has been previously downloaded. If it has, continue with the version check.
117
+ const previouslyDownloadedScripts = previousScriptsDownloaded(scriptType);
118
+ if (!previouslyDownloadedScripts) return;
119
+
120
+ const client = await getOpsCompassClient();
121
+ const currentScriptVersion = await getInstalledScriptVersion(scriptType);
122
+ if (!currentScriptVersion) {
123
+ console.log(`Local scripts for type ${scriptType} not found. Please make sure they are installed.`);
124
+ console.log("If the issue persists, please contact your OpsCompass rep.");
125
+ return;
126
+ }
127
+
128
+ const latestScriptVersion = await client.dataGatheringScripts.checkScriptUpdates(companySlug, scriptType);
129
+
130
+ //Semver returns true if the latest version is higher than the currentScriptVersion.
131
+ if (semver.gt(latestScriptVersion.scriptVersion, currentScriptVersion)) {
132
+ console.log(yellowText, `Warning! You are using version ${currentScriptVersion} of the the ${scriptType} scripts, but the latest version is ${latestScriptVersion.scriptVersion}. To update to the latest version, please run:`);
133
+ console.log();
134
+ console.log(greenText, ` ${cliCommand} data-gathering-scripts download-scripts --company ${companySlug} --scriptType ${scriptType} `);
135
+ console.log();
136
+ }
137
+ }
138
+
99
139
  /**
100
140
  * Manually runs the installed scripts. The base scripts has a runall.sh file.
101
141
  * This file runs all installed modules.
@@ -131,19 +171,25 @@ async function printHelp() {
131
171
  console.log("download-scripts", "Downloads scripts for the passed script type.");
132
172
  console.log("Parameters:");
133
173
  console.log("--company [company_slug]");
134
- console.log("--script-type ['oracle-cis']");
174
+ console.log("--script-type ['discovery-tools', 'oracle-compliance', 'oracle-features', 'vsphere', 'msql-license', 'msql-compliance']");
135
175
  console.log("--script-version (optional) [version] if not provided, the latest script will be downloaded");
136
176
  console.log();
137
177
  console.log("check-script-updates", "Checks locally installed script version against the latest published version for the passed script type.");
138
178
  console.log("Parameters:");
139
179
  console.log("--company [company_slug]");
140
- console.log("--script-type ['oracle-cis']");
180
+ console.log("--script-type ['oracle-compliance', 'oracle-features', 'vsphere', 'msql-license', 'msql-compliance']");
141
181
  console.log();
142
182
  console.log("manually-run-scripts", "Do not run this unless you know what you are doing. This manually runs all the scripts.");
143
183
  console.log();
144
184
  }
145
185
 
146
186
  const dataGatheringScriptsModule = (action, ...args) => {
187
+ // If it is a module with no arguments or if user is manually checking the version, do not run the auto version check. If user is already trying to download the latest versionm they do not need to be told to do so.
188
+ if (args.length > 0 && action !== 'check-script-updates' && action !== 'download-scripts' && !args.includes("--script-version")) {
189
+ autoCheckScriptUpdates(args)
190
+ }
191
+
192
+
147
193
  switch (action?.toLowerCase() ?? "") {
148
194
  case "download-scripts":
149
195
  return downloadScripts(args);
@@ -34,6 +34,22 @@ async function deleteVCenterConfiguration(args){
34
34
  console.log(JSON.stringify(response, null, 2));
35
35
  }
36
36
 
37
+ async function deleteMsqlConfiguration(args){
38
+ let id = undefined;
39
+ for (let i = 0; i < args.length - 1; i++) {
40
+ switch (args[i].toLowerCase()) {
41
+ case "--id":
42
+ id = args[++i];
43
+ break;
44
+ }
45
+ }
46
+
47
+ const client = await getOpsCompassClient();
48
+ const response = await client.licenseManager.deleteMsqlConfiguration(id);
49
+
50
+ console.log(JSON.stringify(response, null, 2));
51
+ }
52
+
37
53
  async function deleteMonitoringConfiguration(args){
38
54
  let id = undefined;
39
55
  for (let i = 0; i < args.length - 1; i++) {
@@ -193,7 +209,7 @@ async function getVCenterConfiguration(args) {
193
209
  async function createVCenterConfiguration(args) {
194
210
  let id = undefined;
195
211
  let name = undefined;
196
- let optionalParams = { action: undefined, connection: undefined, user: undefined, password: undefined };
212
+ let optionalParams = { actions: undefined, connection: undefined, user: undefined, password: undefined };
197
213
  for (let i = 0; i < args.length - 1; i++) {
198
214
  switch (args[i].toLowerCase()) {
199
215
  case "--monitoringconfigurationid":
@@ -203,7 +219,8 @@ async function createVCenterConfiguration(args) {
203
219
  name = args[++i];
204
220
  break;
205
221
  case "--action":
206
- optionalParams.action = args[++i];
222
+ if (optionalParams.actions === undefined) optionalParams.actions = [];
223
+ optionalParams.actions.push(args[++i]);
207
224
  break;
208
225
  case "--connection":
209
226
  optionalParams.connection = args[++i];;
@@ -223,10 +240,80 @@ async function createVCenterConfiguration(args) {
223
240
  console.log(JSON.stringify(monitoringConfig, null, 2));
224
241
  }
225
242
 
243
+ async function listMsqlConfigurations(args) {
244
+ let id = undefined;
245
+ for (let i = 0; i < args.length - 1; i++) {
246
+ switch (args[i].toLowerCase()) {
247
+ case "--monitoringconfigurationid":
248
+ case "--monitoring-configuration-id":
249
+ id = args[++i];
250
+ break;
251
+ }
252
+ }
253
+
254
+ const client = await getOpsCompassClient();
255
+ const listMsqlConfigs = await client.licenseManager.listMsqlConfigurations(id);
256
+
257
+ console.log(JSON.stringify(listMsqlConfigs, null, 2));
258
+ }
259
+
260
+ async function createMsqlConfiguration(args) {
261
+ let id = undefined;
262
+ let configurationName = undefined;
263
+ let optionalParams = { actions: undefined, server: undefined, user: undefined, password: undefined };
264
+ for (let i = 0; i < args.length - 1; i++) {
265
+ switch (args[i].toLowerCase()) {
266
+ case "--monitoringconfigurationid":
267
+ case "--monitoring-configuration-id":
268
+ id = args[++i];
269
+ break;
270
+ case "--configuration-name":
271
+ case "--configurationname":
272
+ configurationName = args[++i];
273
+ break;
274
+ case "--action":
275
+ if (optionalParams.actions === undefined) optionalParams.actions = [];
276
+ optionalParams.actions.push(args[++i]);
277
+ break;
278
+ case "--server":
279
+ optionalParams.server = args[++i];;
280
+ break;
281
+ case "--user":
282
+ optionalParams.user = args[++i];
283
+ break;
284
+ case "--password":
285
+ optionalParams.password = args[++i];
286
+ break;
287
+ }
288
+ }
289
+
290
+ const client = await getOpsCompassClient();
291
+
292
+ const msqlConfiguration = await client.licenseManager.createMsqlConfiguration(id, configurationName, optionalParams);
293
+
294
+ console.log(JSON.stringify(msqlConfiguration, null, 2));
295
+ }
296
+
297
+ async function getMsqlConfiguration(args) {
298
+ let id = undefined;
299
+ for (let i = 0; i < args.length - 1; i++) {
300
+ switch (args[i].toLowerCase()) {
301
+ case "--id":
302
+ id = args[++i];
303
+ break;
304
+ }
305
+ }
306
+
307
+ const client = await getOpsCompassClient();
308
+ const getMsqlConfig = await client.licenseManager.getMsqlConfiguration(id);
309
+
310
+ console.log(JSON.stringify(getMsqlConfig, null, 2));
311
+ }
312
+
226
313
  async function createOracleDatabaseConfiguration(args) {
227
314
  let id = undefined;
228
315
  let name = undefined;
229
- let optionalParams = { action: undefined, connection: undefined };
316
+ let optionalParams = { actions: undefined, connection: undefined };
230
317
  for (let i = 0; i < args.length - 1; i++) {
231
318
  switch (args[i].toLowerCase()) {
232
319
  case "--monitoringconfigurationid":
@@ -236,7 +323,8 @@ async function createOracleDatabaseConfiguration(args) {
236
323
  name = args[++i];
237
324
  break;
238
325
  case "--action":
239
- optionalParams.action = args[++i];
326
+ if (optionalParams.actions === undefined) optionalParams.actions = [];
327
+ optionalParams.actions.push(args[++i]);
240
328
  break;
241
329
  case "--connectionstring":
242
330
  optionalParams.connection = args[++i];
@@ -260,7 +348,9 @@ async function updateMonitoringConfiguration(args) {
260
348
  case "--id":
261
349
  callParams.id = args[++i];
262
350
  break;
351
+ case "--name":
263
352
  case "--configurationname":
353
+ case "--configuration-name":
264
354
  callParams.configurationName = args[++i];
265
355
  break;
266
356
  case "--datafileretaindays":
@@ -304,10 +394,13 @@ async function updateOracleDatabaseConfiguration(args) {
304
394
  callParams.id = args[++i];
305
395
  break;
306
396
  case "--name":
397
+ case "--configurationname":
398
+ case "--configuration-name":
307
399
  callParams.name = args[++i];
308
400
  break;
309
401
  case "--action":
310
- callParams.action = args[++i];
402
+ if (callParams.actions === undefined) callParams.actions = [];
403
+ callParams.actions.push(args[++i]);
311
404
  break;
312
405
  case "--connectionstring":
313
406
  callParams.connectionString = args[++i];
@@ -322,35 +415,38 @@ async function updateOracleDatabaseConfiguration(args) {
322
415
  }
323
416
 
324
417
  async function updateOracleDatabaseConfigurations(args) {
325
-
326
418
  let callParamsArray = [];
327
419
  let jsonIndex = args.indexOf('--json-updates')
328
420
  let idIndex = args.indexOf('--id')
329
421
  let callParams = {};
330
422
 
331
- /* Process bulk update with JSON */
332
- if (jsonIndex !== -1) {
333
- callParamsArray = args[jsonIndex + 1]
423
+ /* Process bulk update with JSON */
424
+ if (jsonIndex !== -1) {
425
+ const jsonString = args[jsonIndex + 1];
426
+ callParamsArray = JSON.parse(jsonString);
334
427
  } else if (idIndex !== -1) {
335
428
  /* If no '--json-update' flag, process bulk update with parameter flags (e.g. --id, --name, etc.) */
336
429
  for(let i = 0; i < args.length - 1; i++) {
337
430
  if(args[i] === '--id') {
338
431
  /* Reset callParams object when a second id is encountered */
339
- callParams = {};
432
+ callParams = {
433
+ };
340
434
  /* Push callParams into the array. */
341
435
  callParamsArray.push(callParams)
342
436
  /* Create the object's properties based on the index (e.g. if the index is --id, you'll find the value at the next index */
343
437
  callParams.id = args[i + 1];
344
- } else if(args[i] === '--configurationName') {
438
+ } else if(args[i].toLowerCase() === '--configurationname' || args[i].toLowerCase() === '--configuration-name' || args[i].toLowerCase() === "--name" ){
345
439
  callParams.configurationName = args[i + 1];
346
- } else if(args[i] === '--action') {
347
- callParams.action = args[i + 1];
348
440
  } else if(args[i] === '--connectionstring') {
349
441
  callParams.connectionString = args[i + 1];
350
- }
442
+ } else if(args[i] === '--action') {
443
+ if (callParams.actions === undefined) callParams.actions = [];
444
+ callParams.actions.push(args[i + 1]);
445
+ }
351
446
  }
352
447
  } else {
353
448
  console.warn("Invalid input, please see help for examples.")
449
+ return console.log("")
354
450
  }
355
451
  /* Call the API and print to console */
356
452
  const client = await getOpsCompassClient();
@@ -360,17 +456,21 @@ async function updateOracleDatabaseConfigurations(args) {
360
456
 
361
457
 
362
458
  async function updateVCenterConfiguration(args) {
363
- const callParams = {};
459
+ const callParams = {
460
+ };
364
461
  for (let i = 0; i < args.length - 1; i++) {
365
462
  switch (args[i].toLowerCase()) {
366
463
  case "--id":
367
464
  callParams.id = args[++i];
368
465
  break;
369
466
  case "--name":
467
+ case "--configurationname":
468
+ case "--configuration-name":
370
469
  callParams.name = args[++i];
371
470
  break;
372
471
  case "--action":
373
- callParams.action = args[++i];
472
+ if (callParams.actions === undefined) callParams.actions = [];
473
+ callParams.actions.push(args[++i]);
374
474
  break;
375
475
  case "--connection":
376
476
  callParams.connection = args[++i];
@@ -396,33 +496,37 @@ async function updateVCenterConfigurations(args) {
396
496
  let idIndex = args.indexOf('--id')
397
497
  let callParams = {};
398
498
 
399
- /* Process bulk update with JSON */
400
- if (jsonIndex !== -1) {
401
- callParamsArray = args[jsonIndex + 1]
402
- } else if (idIndex !== -1) {
499
+ /* Process bulk update with JSON */
500
+ if (jsonIndex !== -1) {
501
+ const jsonString = args[jsonIndex + 1];
502
+ callParamsArray = JSON.parse(jsonString);
503
+ } else if (idIndex !== -1) {
403
504
  /* If no '--json-update' flag, process bulk update with parameter flags (e.g. --id, --name, etc.) */
404
505
  for(let i = 0; i < args.length - 1; i++) {
405
506
  if(args[i] === '--id') {
406
507
  /* Reset callParams object when a second id is encountered */
407
- callParams = {};
508
+ callParams = {
509
+ };
408
510
  /* if theres an existing callParams object, toss it into the array and move on. */
409
511
  callParamsArray.push(callParams)
410
512
  /* Create the object's properties based on the index (e.g. if the index is --id, you'll find the value at the next index */
411
513
  callParams.id = args[i + 1];
412
- } else if(args[i] === '--configurationName') {
514
+ } else if(args[i].toLowerCase() === '--configurationname' || args[i].toLowerCase() === '--configuration-name' || args[i].toLowerCase() === "--name" ) {
413
515
  callParams.configurationName = args[i + 1];
414
- } else if(args[i] === '--action') {
415
- callParams.action = args[i + 1];
416
- } else if(args[i] === '--connection') {
516
+ } else if(args[i].toLowerCase() === '--action') {
517
+ if (callParams.actions === undefined) callParams.actions = [];
518
+ callParams.actions.push(args[i + 1]);
519
+ } else if(args[i.toLowerCase] === '--connection') {
417
520
  callParams.connection = args[i + 1];
418
- } else if(args[i] === '--user') {
521
+ } else if(args[i.toLowerCase] === '--user') {
419
522
  callParams.user = args[i + 1];
420
- } else if(args[i] === '--password') {
523
+ } else if(args[i.toLowerCase] === '--password') {
421
524
  callParams.password = args[i + 1];
422
- }
525
+ }
423
526
  }
424
527
  } else {
425
528
  console.warn("Invalid input, please see help for examples.")
529
+ return console.log("")
426
530
  }
427
531
 
428
532
  /* Call the API and print to console */
@@ -431,13 +535,94 @@ async function updateVCenterConfigurations(args) {
431
535
  console.log(JSON.stringify(vCenterConfigurations, null, 2));
432
536
  }
433
537
 
538
+ async function updateMsqlConfiguration(args) {
539
+ const callParams = {
540
+ };
541
+ for (let i = 0; i < args.length - 1; i++) {
542
+ switch (args[i].toLowerCase()) {
543
+ case "--id":
544
+ callParams.id = args[++i];
545
+ break;
546
+ case "--name":
547
+ case "--configurationname":
548
+ case "--configuration-name":
549
+ callParams.configurationName = args[++i];
550
+ break;
551
+ case "--action":
552
+ if (callParams.actions === undefined) callParams.actions = [];
553
+ callParams.actions.push(args[++i]);
554
+ break;
555
+ case "--server":
556
+ callParams.server = args[++i];
557
+ break;
558
+ case "--user":
559
+ callParams.user = args[++i];
560
+ break;
561
+ case "--password":
562
+ callParams.password = args[++i];
563
+ break;
564
+ }
565
+ }
566
+ const client = await getOpsCompassClient();
567
+ const msqlConfiguration = await client.licenseManager.updateMsqlConfiguration(callParams.id, callParams);
568
+ console.log(JSON.stringify(msqlConfiguration, null, 2));
569
+ }
570
+
571
+
572
+ async function updateMsqlConfigurations(args) {
573
+
574
+ let callParamsArray = [];
575
+ let jsonIndex = args.indexOf('--json-updates')
576
+ let idIndex = args.indexOf('--id')
577
+ let callParams = {};
578
+
579
+ /* Process bulk update with JSON */
580
+ if (jsonIndex !== -1) {
581
+ const jsonString = args[jsonIndex + 1];
582
+ callParamsArray = JSON.parse(jsonString);
583
+
584
+ /* If no '--json-updates' flag, process bulk update with parameter flags (e.g. --id, --name, etc.) */
585
+ } else if (idIndex !== -1) {
586
+ for(let i = 0; i < args.length - 1; i++) {
587
+ if(args[i] === '--id') {
588
+ /* Reset callParams object when a second id is encountered */
589
+ callParams = {
590
+ };
591
+ /* if theres an existing callParams object, toss it into the array and move on. */
592
+ callParamsArray.push(callParams)
593
+ /* Create the object's properties based on the index (e.g. if the index is --id, you'll find the value at the next index */
594
+ callParams.id = args[i + 1];
595
+ } else if(args[i].toLowerCase() === '--configurationname' || args[i].toLowerCase() === '--configuration-name' || args[i].toLowerCase() === "--name" ) {
596
+ callParams.configurationName = args[i + 1];
597
+ } else if(args[i].toLowerCase() === '--action') {
598
+ if (callParams.actions === undefined) callParams.actions = [];
599
+ callParams.actions.push(args[i + 1]);
600
+ } else if(args[i].toLowerCase() === '--server') {
601
+ callParams.server = args[i + 1];
602
+ } else if(args[i].toLowerCase() === '--user') {
603
+ callParams.user = args[i + 1];
604
+ } else if(args[i].toLowerCase() === '--password') {
605
+ callParams.password = args[i + 1];
606
+ }
607
+ }
608
+ } else {
609
+ console.warn("Invalid input, please see help for examples.")
610
+ return console.log("")
611
+ }
612
+
613
+ /* Call the API and print to console */
614
+ const client = await getOpsCompassClient();
615
+ const msqlConfigurations = await client.licenseManager.updateMsqlConfigurations(callParamsArray);
616
+ console.log(JSON.stringify(msqlConfigurations, null, 2));
617
+ }
618
+
434
619
  async function printHelp() {
435
620
  console.log("Actions available for license-manager:");
436
621
  console.log();
437
622
  console.log("get-secret-for-configuration", "Gets a secret for a single configuration passed.");
438
623
  console.log("Parameters:");
439
- console.log("--id [vcenter_configuration_id | oracle_database_configuration_id]");
440
- console.log("--recordType ['oracle_database_configuration' | 'vcenter_configuration'");
624
+ console.log("--id [vcenter_configuration_id | oracle_database_configuration_id | msql_configuration_id]");
625
+ console.log("--recordType ['oracle_database_configuration' | 'vcenter_configuration' | 'msql_configuration'");
441
626
  console.log();
442
627
  console.log("list-monitoring-configurations", "Lists all of the monitoring configurations associated with the give company.");
443
628
  console.log("Parameters:");
@@ -473,22 +658,39 @@ async function printHelp() {
473
658
  console.log("Parameters:");
474
659
  console.log("--monitoringConfigurationId [monitoring_configuration_id]");
475
660
  console.log("--name [unique name]");
476
- console.log("--action (optional) [allowed actions: \"skip\"]");
661
+ console.log(`--action (optional) pass multiple times to define which actions this connection can take e.g. --action "skip" --action "vmotion"`);
477
662
  console.log("--connection (optional) [the hostname or ip address]");
478
663
  console.log("--user (optional) [connection username]");
479
664
  console.log("--password (optional) [connection password]");
480
665
  console.log();
666
+ console.log("list-msql-configurations", "Lists all of the msql configurations associated with the given monitoring configuration");
667
+ console.log("Parameters:");
668
+ console.log("--monitoring-configuration-id [monitoring_configuration_id]");
669
+ console.log();
670
+ console.log("create-msql-configuration", "Create a single msql configuration associated with the given monitoring configuration.");
671
+ console.log("Parameters:");
672
+ console.log("--monitoring-configuration-id [monitoring_configuration_id]");
673
+ console.log("--configurationName [unique name]");
674
+ console.log(`--action (optional) pass multiple times to define which actions this connection can take e.g. --action "skip" --action "compliance"`);
675
+ console.log("--server (optional) [the hostname or ip address]");
676
+ console.log("--user (optional) [connection username]");
677
+ console.log("--password (optional) [connection password]");
678
+ console.log();
679
+ console.log("get-msql-configuration", "Get a single msql configuration associated with the given monitoring configuration");
680
+ console.log("Parameters:");
681
+ console.log("--id [msql_configuration_id]");
682
+ console.log();
481
683
  console.log("create-oracle-database-configuration", "Create a single oracle database configuration associated with the given monitoring configuration.");
482
684
  console.log("Parameters:");
483
685
  console.log("--monitoringConfigurationId [monitoring_configuration_id]");
484
686
  console.log("--name [unique name]");
485
- console.log("--action (optional) [allowed actions: \"skip\"]");
687
+ console.log(`--action (optional) pass multiple times to define which actions this connection can take e.g. --action "skip" --action "dbcompliance"`);
486
688
  console.log("--connectionString (optional) [the database connection string]");
487
689
  console.log();
488
690
  console.log("update-monitoring-configuration", "Update a single monitoring configuration.");
489
691
  console.log("Parameters:");
490
692
  console.log("--id [monitoring_configuration id]");
491
- console.log("--configurationName (optional) [unique name]");
693
+ console.log("--name or --configuration-name (optional) [unique name]");
492
694
  console.log("--dataFileRetainDays (optional) [determines how many days to retain encrypted output files locally]");
493
695
  console.log("--dataFileRetainTextDays (optional) [determines how many days to retain individual script output files locally]");
494
696
  console.log("--forceFileEncryption (optional) [enforce encryption of datafiles before being sent]");
@@ -501,27 +703,27 @@ async function printHelp() {
501
703
  console.log("update-oracle-database-configuration", "Update a single oracle database configuration.");
502
704
  console.log("Parameters:");
503
705
  console.log("--id [configuration id]");
504
- console.log("--name (optional) [unique name]");
505
- console.log("--action (optional) [allowed actions: \"skip\"]");
706
+ console.log("--name or --configuration-name (optional) [unique name]");
707
+ console.log(`--action (optional) pass multiple times to define which actions this connection can take --action "skip" --action "dbcompliance"`);
506
708
  console.log("--connectionString (optional) [the database connection string]");
507
709
  console.log();
508
710
  console.log("update-oracle-database-configurations", "Bulk update oracle database configurations.");
509
711
  console.log("Parameters:");
510
712
  console.log("--id [configuration id]");
511
- console.log("--name (optional) [unique name]");
512
- console.log("--action (optional) [allowed actions: \"skip\"]");
713
+ console.log("--name or --configuration-name (optional) [unique name]");
714
+ console.log(`--action (optional) pass multiple times to define which actions this connection can take e.g. --action "skip" --action "dbcompliance"`);
513
715
  console.log("--connectionString (optional) [the database connection string]");
514
716
  console.log("OR --json-updates [stringified json objects with your updates]");
515
717
  console.log("For quick updates, you may use the above parameters");
516
- console.log(`e.g. opscompass license-manager update-oracle-database-configurations --id 57 --configurationName "updatedName" --id 62 --configurationName "otherUpdatedName" --id 77 --configurationName "lastUpdatedName";`);
718
+ console.log(`e.g. opscompass license-manager update-oracle-database-configurations --id 57 --name "updatedName" --id 62 --name "otherUpdatedName" --id 77 --name "lastUpdatedName";`);
517
719
  console.log("For larger updates, JavaScript Object Notation (JSON) may be used with the --json-updates flag");
518
- console.log(`e.g. opscompass license-manager update-oracle-database-configurations --json-updates '[{"id":"57","configurationName":"updatedName"},{"id":"77", "configurationName":"otherUpdatedName", "action":"null"},{"id":"79", "configurationName":"lastUpdatedName"}]'`);
720
+ console.log(`e.g. opscompass license-manager update-oracle-database-configurations --json-updates '[{\"id\":\"57\",\"configurationName\":\"updatedName\"},{\"id\":\"77\", \"configurationName\":\"otherUpdatedName\", \"action\":\"null\"},{\"id\":\"79\", \"configurationName\":\"lastUpdatedName\"}]'`);
519
721
  console.log();
520
722
  console.log("update-vcenter-configuration", "Update a single vcenter configuration.");
521
723
  console.log("Parameters:");
522
724
  console.log("--id [configuration id]");
523
- console.log("--name (optional) [unique name]");
524
- console.log("--action (optional) [allowed actions: \"skip\"]");
725
+ console.log("--name or --configuration-name (optional) [unique name]");
726
+ console.log("--action (optional) pass multiple times to define which actions this connection can take e.g. --action 'skip' --action 'vmotion']");
525
727
  console.log("--connection (optional) [the hostname or ip address]");
526
728
  console.log("--user (optional) [connection username]");
527
729
  console.log("--password (optional) [connection password]");
@@ -529,16 +731,16 @@ async function printHelp() {
529
731
  console.log("update-vcenter-configurations", "Bulk Update vcenter configurations.");
530
732
  console.log("Parameters:");
531
733
  console.log("--id [configuration id]");
532
- console.log("--name (optional) [unique name]");
533
- console.log("--action (optional) [allowed actions: \"skip\"]");
734
+ console.log("--name or --configuration-name (optional) [unique name]");
735
+ console.log(`--action (optional) pass multiple times to define which actions this connection can take e.g. --action "skip" --action "vmotion"`);
534
736
  console.log("--connection (optional) [the hostname or ip address]");
535
737
  console.log("--user (optional) [connection username]");
536
738
  console.log("--password (optional) [connection password]");
537
739
  console.log("OR --json-updates [stringified json objects with your updates]");
538
740
  console.log("For quick updates, you may use the above parameters");
539
- console.log(`e.g. opscompass license-manager update-vcenter-configurations --id 137 --configurationName "updatedName" --id 138 --configurationName "otherUpdatedName" --id 144 --configurationName "lastUpdatedName";`);
741
+ console.log(`e.g. opscompass license-manager update-vcenter-configurations --id 137 --name "updatedName" --id 138 --name "otherUpdatedName" --id 144 --name "lastUpdatedName" --action "skip" --action "vmotion";`);
540
742
  console.log("For larger updates, JavaScript Object Notation (JSON) may be used with the --json-updates flag");
541
- console.log(`e.g. opscompass license-manager update-vcenter-configurations --json-updates '[{"id":"137","configurationName":"updatedName"},{"id":"138","configurationName":"otherUpdatedName"},{"id":"144","configurationName":"lastUpdatedName"}]'`);
743
+ console.log(`e.g. opscompass license-manager update-vcenter-configurations --json-updates '[{\"id\":\"137\",\"configurationName\":\"updatedName\"},{\"id\":\"138\",\"configurationName\":\"otherUpdatedName\"},{\"id\":\"144\",\"configurationName\":\"lastUpdatedName\", \"actions\":[\"skip\", \"vmotion\"]}]'`);
542
744
  console.log();
543
745
  console.log("delete-monitoring-configuration", "Delete a monitoring configuration");
544
746
  console.log("Parameters:");
@@ -552,6 +754,34 @@ async function printHelp() {
552
754
  console.log("Parameters:");
553
755
  console.log("--id [vcenter_configuration_id]");
554
756
  console.log();
757
+ console.log("delete-msql-configuration", "Delete a msql configuration");
758
+ console.log("Parameters:");
759
+ console.log("--id [msql_configuration_id]");
760
+ console.log();
761
+ console.log("update-msql-configuration", "Update a single msql configuration.");
762
+ console.log("Parameters:");
763
+ console.log("--id [configuration id]");
764
+ console.log("--name or --configuration-name (optional) [unique name]");
765
+ console.log("--action (optional) pass multiple times to define which actions this connection can take e.g. --action 'skip' --action 'dblicensing'");
766
+ console.log("--server (optional) [the server]");
767
+ console.log("--user (optional) [connection username]");
768
+ console.log("--password (optional) [connection password]");
769
+ console.log();
770
+ console.log();
771
+ console.log("update-msql-configurations", "Bulk Update Msql Configurations.");
772
+ console.log("Parameters:");
773
+ console.log("--id [configuration id]");
774
+ console.log("--name or --configuration-name (optional) [unique name]");
775
+ console.log("--action (optional) pass multiple times to define which actions this connection can take e.g. --action 'skip' --action 'dblicensing'");
776
+ console.log("--connection (optional) [the hostname or ip address]");
777
+ console.log("--user (optional) [connection username]");
778
+ console.log("--password (optional) [connection password]");
779
+ console.log("OR --json-updates [stringified json objects with your updates]");
780
+ console.log("For quick updates, you may use the above parameters");
781
+ console.log(`e.g. opscompass license-manager update-msql-configurations --id 31 --name "newname" --server "233.533.343" --user "joe" --action "skip" --id 25 --name "secondname" --actions"skip" --action "dblicensing"`);
782
+ console.log("For larger updates, JavaScript Object Notation (JSON) may be used with the --json-updates flag");
783
+ console.log(`e.g. opscompass license-manager update-msql-configurations --json-updates '[{\"id\":\"25\",\"configurationName\":\"25\", \"server\":\"100.232.2423\", \"user\":\"tony\", \"actions\":[\"skip\", \"dblicensing\"]}, {\"id\":\"31\",\"configurationName\":\"31\", \"server\":\"100.232.2423\", \"user\":\"tony\", \"actions\":[\"skip\", \"dblicensing\"]}]'`);
784
+ console.log();
555
785
  }
556
786
 
557
787
  const licenseManagerModule = (action, ...args) => {
@@ -570,6 +800,12 @@ const licenseManagerModule = (action, ...args) => {
570
800
  return getVCenterConfiguration(args);
571
801
  case "create-vcenter-configuration":
572
802
  return createVCenterConfiguration(args);
803
+ case "list-msql-configurations":
804
+ return listMsqlConfigurations(args);
805
+ case "create-msql-configuration":
806
+ return createMsqlConfiguration(args);
807
+ case "get-msql-configuration":
808
+ return getMsqlConfiguration(args);
573
809
  case "get-oracle-database-configuration":
574
810
  return getOracleDatabaseConfiguration(args);
575
811
  case "list-oracle-database-configurations":
@@ -584,14 +820,20 @@ const licenseManagerModule = (action, ...args) => {
584
820
  return updateOracleDatabaseConfigurations(args);
585
821
  case "update-vcenter-configuration":
586
822
  return updateVCenterConfiguration(args);
587
- case "update-vcenter-configurations":
588
- return updateVCenterConfigurations(args);
823
+ case "update-vcenter-configurations":
824
+ return updateVCenterConfigurations(args);
589
825
  case "delete-monitoring-configuration":
590
826
  return deleteMonitoringConfiguration(args);
591
827
  case "delete-oracle-database-configuration":
592
828
  return deleteOracleDatabaseConfiguration(args);
593
829
  case "delete-vcenter-configuration":
594
830
  return deleteVCenterConfiguration(args);
831
+ case "delete-msql-configuration":
832
+ return deleteMsqlConfiguration(args);
833
+ case "update-msql-configuration":
834
+ return updateMsqlConfiguration(args);
835
+ case "update-msql-configurations":
836
+ return updateMsqlConfigurations(args)
595
837
  case "help":
596
838
  case "":
597
839
  return printHelp();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opscompass/opscompass-cli",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
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.10",
18
+ "@opscompass/opscompass-api": "^1.0.12",
19
19
  "adm-zip": "^0.5.9",
20
20
  "axios": "^0.21.1",
21
21
  "fs-extra": "^10.1.0",
package/updates.js CHANGED
@@ -15,12 +15,10 @@ function versionCheck() {
15
15
  console.log(`error: ${error.message}`);
16
16
  return;
17
17
  }
18
- if (stderr) {
19
- console.log(`stderr: ${stderr}`);
20
- };
18
+
21
19
  /* Semver used to semantically compare version numbers */
22
20
  if (semver.gt(latestVersion, pkg.version)) {
23
- console.error(yellowText, `\nWarning! You are using CLI version ${pkg.version}, but the latest version is ${latestVersion}. To upgrade to the latest version, please run:`);
21
+ console.error(yellowText, `Warning! You are using CLI version ${pkg.version}, but the latest version is ${latestVersion}To upgrade to the latest version, please run:`);
24
22
  /* Prompt user to upgrade to the correct package based on their current environment */
25
23
  console.error(greenText, `\nnpm install -g ${pkg.name}@${latestVersion}\n`);
26
24
  return;