@broadcom/ops-for-zowe-cli 5.0.0-next.202401221923 → 5.0.0-next.202408051627
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/README.md +180 -43
- package/lib/api/Execute.d.ts +5 -0
- package/lib/api/Execute.js +138 -0
- package/lib/api/Execute.js.map +1 -0
- package/lib/api/OpsProfilesConfig.js +5 -19
- package/lib/api/OpsProfilesConfig.js.map +1 -1
- package/lib/api/Show.d.ts +8 -1
- package/lib/api/Show.js +57 -7
- package/lib/api/Show.js.map +1 -1
- package/lib/api/Update.js +57 -45
- package/lib/api/Update.js.map +1 -1
- package/lib/api/constants/Ops.constants.js +17 -8
- package/lib/api/constants/Ops.constants.js.map +1 -1
- package/lib/api/doc/IExecuteRexxResponse.d.ts +9 -0
- package/lib/api/doc/IExecuteRexxResponse.js +34 -0
- package/lib/api/doc/IExecuteRexxResponse.js.map +1 -0
- package/lib/api/doc/IShowLognameResponse.d.ts +12 -0
- package/lib/api/doc/IShowLognameResponse.js +25 -0
- package/lib/api/doc/IShowLognameResponse.js.map +1 -0
- package/lib/api/doc/IShowStatusResponse.d.ts +13 -0
- package/lib/api/doc/IShowStatusResponse.js +25 -0
- package/lib/api/doc/IShowStatusResponse.js.map +1 -0
- package/lib/api/doc/IShowSubsystemsResponse.d.ts +12 -0
- package/lib/api/doc/IShowSubsystemsResponse.js +25 -0
- package/lib/api/doc/IShowSubsystemsResponse.js.map +1 -0
- package/lib/api/index.d.ts +6 -0
- package/lib/api/index.js +6 -0
- package/lib/api/index.js.map +1 -1
- package/lib/api/utils/LognameListUtils.d.ts +12 -0
- package/lib/api/utils/LognameListUtils.js +104 -0
- package/lib/api/utils/LognameListUtils.js.map +1 -0
- package/lib/api/utils/LognameUtils.d.ts +4 -0
- package/lib/api/utils/LognameUtils.js +41 -0
- package/lib/api/utils/LognameUtils.js.map +1 -0
- package/lib/api/utils/OpsRestClient.js +2 -0
- package/lib/api/utils/OpsRestClient.js.map +1 -1
- package/lib/api/utils/OpsRestUtils.d.ts +1 -0
- package/lib/api/utils/OpsRestUtils.js +18 -6
- package/lib/api/utils/OpsRestUtils.js.map +1 -1
- package/lib/api/utils/OpsTextUtils.d.ts +1 -1
- package/lib/api/utils/OpsTextUtils.js +8 -4
- package/lib/api/utils/OpsTextUtils.js.map +1 -1
- package/lib/api/utils/RexxListUtils.d.ts +9 -0
- package/lib/api/utils/RexxListUtils.js +146 -0
- package/lib/api/utils/RexxListUtils.js.map +1 -0
- package/lib/api/utils/RexxUtils.d.ts +5 -0
- package/lib/api/utils/RexxUtils.js +48 -0
- package/lib/api/utils/RexxUtils.js.map +1 -0
- package/lib/api/utils/RuleListUtils.d.ts +15 -3
- package/lib/api/utils/RuleListUtils.js +173 -21
- package/lib/api/utils/RuleListUtils.js.map +1 -1
- package/lib/api/utils/RuleUtils.d.ts +1 -3
- package/lib/api/utils/RuleUtils.js +21 -39
- package/lib/api/utils/RuleUtils.js.map +1 -1
- package/lib/api/utils/RulesetListUtils.d.ts +9 -1
- package/lib/api/utils/RulesetListUtils.js +102 -4
- package/lib/api/utils/RulesetListUtils.js.map +1 -1
- package/lib/api/utils/RulesetUtils.d.ts +0 -1
- package/lib/api/utils/RulesetUtils.js +6 -10
- package/lib/api/utils/RulesetUtils.js.map +1 -1
- package/lib/api/utils/SSMResourceListUtils.d.ts +14 -1
- package/lib/api/utils/SSMResourceListUtils.js +274 -17
- package/lib/api/utils/SSMResourceListUtils.js.map +1 -1
- package/lib/api/utils/{SSMUtils.d.ts → SSMResourceUtils.d.ts} +2 -3
- package/lib/api/utils/{SSMUtils.js → SSMResourceUtils.js} +39 -66
- package/lib/api/utils/SSMResourceUtils.js.map +1 -0
- package/lib/api/utils/StatusListUtils.d.ts +9 -0
- package/lib/api/utils/StatusListUtils.js +100 -0
- package/lib/api/utils/StatusListUtils.js.map +1 -0
- package/lib/api/utils/StatusUtils.d.ts +4 -0
- package/lib/api/utils/StatusUtils.js +37 -0
- package/lib/api/utils/StatusUtils.js.map +1 -0
- package/lib/api/utils/SubsystemListUtils.d.ts +12 -0
- package/lib/api/utils/SubsystemListUtils.js +104 -0
- package/lib/api/utils/SubsystemListUtils.js.map +1 -0
- package/lib/api/utils/SubsystemUtils.d.ts +4 -0
- package/lib/api/utils/SubsystemUtils.js +37 -0
- package/lib/api/utils/SubsystemUtils.js.map +1 -0
- package/lib/api/utils/index.d.ts +9 -1
- package/lib/api/utils/index.js +9 -1
- package/lib/api/utils/index.js.map +1 -1
- package/lib/cli/LognameParameterDefinitions.d.ts +4 -0
- package/lib/cli/LognameParameterDefinitions.js +40 -0
- package/lib/cli/LognameParameterDefinitions.js.map +1 -0
- package/lib/cli/OpsBaseHandler.js +4 -2
- package/lib/cli/OpsBaseHandler.js.map +1 -1
- package/lib/cli/ResourceParameterDefinitions.d.ts +1 -1
- package/lib/cli/ResourceParameterDefinitions.js +9 -4
- package/lib/cli/ResourceParameterDefinitions.js.map +1 -1
- package/lib/cli/RexxParameterDefinitions.d.ts +14 -0
- package/lib/cli/RexxParameterDefinitions.js +125 -0
- package/lib/cli/RexxParameterDefinitions.js.map +1 -0
- package/lib/cli/RuleParameterDefinitions.d.ts +2 -1
- package/lib/cli/RuleParameterDefinitions.js +11 -0
- package/lib/cli/RuleParameterDefinitions.js.map +1 -1
- package/lib/cli/RulesetParameterDefinitions.d.ts +1 -0
- package/lib/cli/RulesetParameterDefinitions.js +11 -0
- package/lib/cli/RulesetParameterDefinitions.js.map +1 -1
- package/lib/cli/StatusParameterDefinitions.d.ts +4 -0
- package/lib/cli/StatusParameterDefinitions.js +40 -0
- package/lib/cli/StatusParameterDefinitions.js.map +1 -0
- package/lib/cli/SubsystemsParameterDefinitions.d.ts +4 -0
- package/lib/cli/SubsystemsParameterDefinitions.js +40 -0
- package/lib/cli/SubsystemsParameterDefinitions.js.map +1 -0
- package/lib/cli/disable/Disable.definition.js +2 -2
- package/lib/cli/disable/Disable.definition.js.map +1 -1
- package/lib/cli/disable/rule/Rule.definition.js +3 -1
- package/lib/cli/disable/rule/Rule.definition.js.map +1 -1
- package/lib/cli/disable/rule/Rule.handler.js +1 -1
- package/lib/cli/disable/rule/Rule.handler.js.map +1 -1
- package/lib/cli/enable/Enable.definition.js +2 -2
- package/lib/cli/enable/Enable.definition.js.map +1 -1
- package/lib/cli/enable/rule/Rule.handler.js +1 -1
- package/lib/cli/enable/rule/Rule.handler.js.map +1 -1
- package/lib/cli/execute/Execute.definition.d.ts +3 -0
- package/lib/cli/execute/Execute.definition.js +35 -0
- package/lib/cli/execute/Execute.definition.js.map +1 -0
- package/lib/cli/execute/rexx/Rexx.definition.d.ts +2 -0
- package/lib/cli/execute/rexx/Rexx.definition.js +55 -0
- package/lib/cli/execute/rexx/Rexx.definition.js.map +1 -0
- package/lib/cli/execute/rexx/Rexx.handler.d.ts +5 -0
- package/lib/cli/execute/rexx/Rexx.handler.js +46 -0
- package/lib/cli/execute/rexx/Rexx.handler.js.map +1 -0
- package/lib/cli/show/Show.definition.js +10 -5
- package/lib/cli/show/Show.definition.js.map +1 -1
- package/lib/cli/show/logname/Logname.definition.d.ts +17 -0
- package/lib/cli/show/logname/Logname.definition.js +62 -0
- package/lib/cli/show/logname/Logname.definition.js.map +1 -0
- package/lib/cli/show/logname/Logname.handler.d.ts +5 -0
- package/lib/cli/show/logname/Logname.handler.js +49 -0
- package/lib/cli/show/logname/Logname.handler.js.map +1 -0
- package/lib/cli/show/resource/Resource.definition.js +3 -1
- package/lib/cli/show/resource/Resource.definition.js.map +1 -1
- package/lib/cli/show/resource/Resource.handler.js +3 -3
- package/lib/cli/show/resource/Resource.handler.js.map +1 -1
- package/lib/cli/show/rule/Rule.definition.d.ts +1 -1
- package/lib/cli/show/rule/Rule.definition.js +9 -7
- package/lib/cli/show/rule/Rule.definition.js.map +1 -1
- package/lib/cli/show/rule/Rule.handler.js +5 -5
- package/lib/cli/show/rule/Rule.handler.js.map +1 -1
- package/lib/cli/show/ruleset/Ruleset.definition.js +1 -0
- package/lib/cli/show/ruleset/Ruleset.definition.js.map +1 -1
- package/lib/cli/show/ruleset/Ruleset.handler.js +3 -4
- package/lib/cli/show/ruleset/Ruleset.handler.js.map +1 -1
- package/lib/cli/show/status/Status.definition.d.ts +17 -0
- package/lib/cli/show/status/Status.definition.js +62 -0
- package/lib/cli/show/status/Status.definition.js.map +1 -0
- package/lib/cli/show/status/Status.handler.d.ts +5 -0
- package/lib/cli/show/status/Status.handler.js +49 -0
- package/lib/cli/show/status/Status.handler.js.map +1 -0
- package/lib/cli/show/subsystem/Subsystem.definition.d.ts +17 -0
- package/lib/cli/show/subsystem/Subsystem.definition.js +62 -0
- package/lib/cli/show/subsystem/Subsystem.definition.js.map +1 -0
- package/lib/cli/show/subsystem/Subsystem.handler.d.ts +5 -0
- package/lib/cli/show/subsystem/Subsystem.handler.js +49 -0
- package/lib/cli/show/subsystem/Subsystem.handler.js.map +1 -0
- package/lib/cli/start/Start.definition.js +2 -2
- package/lib/cli/start/Start.definition.js.map +1 -1
- package/lib/cli/start/resource/Resource.handler.js +3 -4
- package/lib/cli/start/resource/Resource.handler.js.map +1 -1
- package/lib/cli/stop/Stop.definition.js +2 -2
- package/lib/cli/stop/Stop.definition.js.map +1 -1
- package/lib/cli/stop/resource/Resource.definition.js +1 -1
- package/lib/cli/stop/resource/Resource.handler.js +3 -4
- package/lib/cli/stop/resource/Resource.handler.js.map +1 -1
- package/lib/healthCheck.handler.js +2 -1
- package/lib/healthCheck.handler.js.map +1 -1
- package/lib/imperative.js +0 -2
- package/lib/imperative.js.map +1 -1
- package/lib/index.d.ts +5 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/package.json +25 -24
- package/lib/api/utils/SSMUtils.js.map +0 -1
|
@@ -34,7 +34,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
34
34
|
exports.RuleUtils = void 0;
|
|
35
35
|
const constants_1 = require("../constants");
|
|
36
36
|
const OpsRestClient_1 = require("./OpsRestClient");
|
|
37
|
-
const OpsTextUtils_1 = require("./OpsTextUtils");
|
|
38
37
|
class RuleUtils {
|
|
39
38
|
/**
|
|
40
39
|
* setRuleStatus
|
|
@@ -62,52 +61,35 @@ class RuleUtils {
|
|
|
62
61
|
subsystemQueryString = "?sub=" + encodeURIComponent(subSystem);
|
|
63
62
|
}
|
|
64
63
|
// Endpoint formatted based on restApi value
|
|
65
|
-
if (restApi === false) {
|
|
66
|
-
|
|
64
|
+
if (restApi === false) {
|
|
65
|
+
// web services
|
|
66
|
+
return `${constants_1.OpsConstants.BASE_URL}${constants_1.OpsConstants.RULESET_URL}/${ruleSetName}${constants_1.OpsConstants.RULE_URL}/${ruleName}${constants_1.OpsConstants.STATUS_URL}${subsystemQueryString}`;
|
|
67
67
|
}
|
|
68
68
|
else {
|
|
69
|
-
|
|
70
|
-
if ((ruleSetName === "*") || (ruleName === "*")) {
|
|
71
|
-
if (ruleSetName === "*") {
|
|
72
|
-
if (ruleName !== "*") {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
ruleSetName = "%2A";
|
|
76
|
-
}
|
|
77
|
-
if (ruleName === "*") {
|
|
78
|
-
ruleName = "%2A";
|
|
79
|
-
}
|
|
80
|
-
return `${constants_1.OpsConstants.RULES_URL}${subsystemQueryString}&ruleset=${ruleSetName}&rulename=${ruleName}`;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
return `${constants_1.OpsConstants.RULES_URL}/${ruleSetName}.${ruleName}${subsystemQueryString}`;
|
|
84
|
-
}
|
|
69
|
+
return this.getRuleURLForRestApi(session, ruleSetName, ruleName, subsystemQueryString);
|
|
85
70
|
}
|
|
86
71
|
}
|
|
87
|
-
static
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
static formatStatusResponse(newStatus, oldStatus) {
|
|
92
|
-
if (newStatus === "ENABLED") {
|
|
93
|
-
newStatus = OpsTextUtils_1.OpsTextUtils.colorizeOK(newStatus);
|
|
72
|
+
static getRuleURLForRestApi(session, ruleSetName, ruleName, subsystemQueryString) {
|
|
73
|
+
let resource = "";
|
|
74
|
+
if (session.ISession.basePath == null || session.ISession.basePath === "") {
|
|
75
|
+
resource = constants_1.OpsConstants.DEFAULT_BASEPATH;
|
|
94
76
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
77
|
+
// Don't allow ruleSetName * and ruleName with value (this is validated in processOps of Rule.handler.ts)
|
|
78
|
+
if ((ruleSetName === "*") || (ruleName === "*")) {
|
|
79
|
+
if (ruleSetName === "*") {
|
|
80
|
+
if (ruleName !== "*") {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
ruleSetName = "%2A";
|
|
84
|
+
}
|
|
85
|
+
if (ruleName === "*") {
|
|
86
|
+
ruleName = "%2A";
|
|
87
|
+
}
|
|
88
|
+
return `${resource}${constants_1.OpsConstants.RULES_URL}${subsystemQueryString}&ruleset=${ruleSetName}&rulename=${ruleName}`;
|
|
105
89
|
}
|
|
106
90
|
else {
|
|
107
|
-
|
|
91
|
+
return `${resource}${constants_1.OpsConstants.RULES_URL}/${ruleSetName}.${ruleName}${subsystemQueryString}`;
|
|
108
92
|
}
|
|
109
|
-
const statusAttention = OpsTextUtils_1.OpsTextUtils.colorizeAttention("status: ");
|
|
110
|
-
return statusAttention + status;
|
|
111
93
|
}
|
|
112
94
|
}
|
|
113
95
|
exports.RuleUtils = RuleUtils;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuleUtils.js","sourceRoot":"","sources":["../../../src/api/utils/RuleUtils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;;;;;;;;;;AAGH,4CAA4C;AAC5C,mDAAgD;
|
|
1
|
+
{"version":3,"file":"RuleUtils.js","sourceRoot":"","sources":["../../../src/api/utils/RuleUtils.ts"],"names":[],"mappings":";AAA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|
export declare class RulesetListUtils {
|
|
3
|
-
static printShowRulesetResponse(rulesetList: any, params: IHandlerParameters):
|
|
3
|
+
static printShowRulesetResponse(rulesetList: any, params: IHandlerParameters): string;
|
|
4
|
+
static formatOutputFromArrayRestApi(ruleset: any, i: number, params: IHandlerParameters): string;
|
|
5
|
+
static formatOutputRestApi(ruleset: any, params: IHandlerParameters): string;
|
|
6
|
+
static formatRulesetResponse(ruleSet: string, system: string, subsystem: string, status: string, autoenabled: string): string;
|
|
7
|
+
static formatNameValueRulesetResponse(rulesetList: any): string;
|
|
8
|
+
static formatNameValueColorRulesetResponse(rulesetList: any): string;
|
|
9
|
+
static formatJsonDataResponse(rulesetList: any): string;
|
|
10
|
+
static formatCsvHeaderResponse(): string;
|
|
11
|
+
static formatCsvDataResponse(rulesetList: any): string;
|
|
4
12
|
}
|
|
@@ -23,18 +23,116 @@
|
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.RulesetListUtils = void 0;
|
|
26
|
-
const
|
|
26
|
+
const constants_1 = require("../constants");
|
|
27
|
+
const OpsTextUtils_1 = require("./OpsTextUtils");
|
|
27
28
|
class RulesetListUtils {
|
|
28
29
|
static printShowRulesetResponse(rulesetList, params) {
|
|
30
|
+
let output = "";
|
|
29
31
|
if (rulesetList.length > 1) {
|
|
30
32
|
for (let i = 0; i < rulesetList.length; i++) {
|
|
31
|
-
|
|
33
|
+
const ruleset = rulesetList[i];
|
|
34
|
+
output = output + RulesetListUtils.formatOutputFromArrayRestApi(ruleset, i, params);
|
|
32
35
|
}
|
|
36
|
+
// close out JSON
|
|
37
|
+
if (params.arguments.format.toUpperCase() === constants_1.OpsConstants.JSON) {
|
|
38
|
+
output = output + "]";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
output = output + RulesetListUtils.formatOutputRestApi(rulesetList, params);
|
|
43
|
+
}
|
|
44
|
+
return output;
|
|
45
|
+
}
|
|
46
|
+
static formatOutputFromArrayRestApi(ruleset, i, params) {
|
|
47
|
+
let output = "";
|
|
48
|
+
if (params.arguments.format.toUpperCase() === constants_1.OpsConstants.CSV) {
|
|
49
|
+
if (i === 0) {
|
|
50
|
+
output = `${output}${RulesetListUtils.formatCsvHeaderResponse()}`;
|
|
51
|
+
}
|
|
52
|
+
output = `${output}\n${RulesetListUtils.formatCsvDataResponse(ruleset)}`;
|
|
53
|
+
}
|
|
54
|
+
else if (params.arguments.format.toUpperCase() === constants_1.OpsConstants.JSON) {
|
|
55
|
+
if (i === 0) {
|
|
56
|
+
output = output + "[";
|
|
57
|
+
}
|
|
58
|
+
else if (i > 0) {
|
|
59
|
+
output = output + ", ";
|
|
60
|
+
}
|
|
61
|
+
output = `${output}${RulesetListUtils.formatJsonDataResponse(ruleset)}`;
|
|
62
|
+
}
|
|
63
|
+
else if (params.arguments.format.toUpperCase() === constants_1.OpsConstants.NAMEVALUECOLOR) {
|
|
64
|
+
if (i > 0) {
|
|
65
|
+
output = output + "\n";
|
|
66
|
+
}
|
|
67
|
+
output = `${output}${RulesetListUtils.formatNameValueColorRulesetResponse(ruleset)}`;
|
|
33
68
|
}
|
|
34
69
|
else {
|
|
35
|
-
|
|
36
|
-
|
|
70
|
+
if (i > 0) {
|
|
71
|
+
output = output + "\n";
|
|
72
|
+
}
|
|
73
|
+
output = `${output}${RulesetListUtils.formatNameValueRulesetResponse(ruleset)}`;
|
|
74
|
+
}
|
|
75
|
+
return output;
|
|
76
|
+
}
|
|
77
|
+
static formatOutputRestApi(ruleset, params) {
|
|
78
|
+
let output = "";
|
|
79
|
+
if (params.arguments.format.toUpperCase() === constants_1.OpsConstants.CSV) {
|
|
80
|
+
output = `${RulesetListUtils.formatCsvHeaderResponse()}`;
|
|
81
|
+
output = `${output}\n${RulesetListUtils.formatCsvDataResponse(ruleset)}`;
|
|
37
82
|
}
|
|
83
|
+
else if (params.arguments.format.toUpperCase() === constants_1.OpsConstants.JSON) {
|
|
84
|
+
output = `[${output}${RulesetListUtils.formatJsonDataResponse(ruleset)}]`;
|
|
85
|
+
}
|
|
86
|
+
else if (params.arguments.format.toUpperCase() === constants_1.OpsConstants.NAMEVALUECOLOR) {
|
|
87
|
+
output = RulesetListUtils.formatNameValueColorRulesetResponse(ruleset);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
output = RulesetListUtils.formatNameValueRulesetResponse(ruleset);
|
|
91
|
+
}
|
|
92
|
+
return output;
|
|
93
|
+
}
|
|
94
|
+
static formatRulesetResponse(ruleSet, system, subsystem, status, autoenabled) {
|
|
95
|
+
const name = OpsTextUtils_1.OpsTextUtils.colorizeAttention("name: ");
|
|
96
|
+
const statusText = OpsTextUtils_1.OpsTextUtils.colorizeAttention(" status: ");
|
|
97
|
+
const autoenabledText = OpsTextUtils_1.OpsTextUtils.colorizeAttention(" autoenabled: ");
|
|
98
|
+
return `${name}${system}/${subsystem}/${ruleSet}${statusText}${status}${autoenabledText}${autoenabled}`;
|
|
99
|
+
}
|
|
100
|
+
static formatNameValueRulesetResponse(rulesetList) {
|
|
101
|
+
const output = `name: ${rulesetList.system}/${rulesetList.subsystem}/${rulesetList.ruleset}\n`;
|
|
102
|
+
return `${output} sysplex: ${rulesetList.sysplex}\n status: ${rulesetList.status}\n autoEnabled: ${rulesetList.autoEnabled}\n`;
|
|
103
|
+
}
|
|
104
|
+
static formatNameValueColorRulesetResponse(rulesetList) {
|
|
105
|
+
const name = OpsTextUtils_1.OpsTextUtils.colorizeAttention("name: ");
|
|
106
|
+
const statusText = OpsTextUtils_1.OpsTextUtils.colorizeAttention(" status: ");
|
|
107
|
+
const sysplexText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("sysplex:");
|
|
108
|
+
const autoenabledText = OpsTextUtils_1.OpsTextUtils.colorizeAttention(" autoenabled: ");
|
|
109
|
+
// eslint-disable-next-line max-len
|
|
110
|
+
const output = `${name}${rulesetList.system}/${rulesetList.subsystem}/${rulesetList.ruleset}`;
|
|
111
|
+
let status;
|
|
112
|
+
if (rulesetList.status.toUpperCase() === "ENABLED") {
|
|
113
|
+
status = OpsTextUtils_1.OpsTextUtils.colorizeOK(rulesetList.status);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
status = OpsTextUtils_1.OpsTextUtils.colorizeError(rulesetList.status);
|
|
117
|
+
}
|
|
118
|
+
return `${output}\n ${sysplexText} ${rulesetList.sysplex}\n${statusText} ${status}\n${autoenabledText} ${rulesetList.autoEnabled}\n`;
|
|
119
|
+
}
|
|
120
|
+
static formatJsonDataResponse(rulesetList) {
|
|
121
|
+
let output = `{`;
|
|
122
|
+
output = output + `"sysplex": "${rulesetList.sysplex}", "system": "${rulesetList.system}", `;
|
|
123
|
+
output = output + `"subsystem": "${rulesetList.subsystem}", "ruleset": "${rulesetList.ruleset}", `;
|
|
124
|
+
output = output + `"status": "${rulesetList.status}", "autoEnabled": "${rulesetList.autoEnabled}"`;
|
|
125
|
+
output = output + `}`;
|
|
126
|
+
return output;
|
|
127
|
+
}
|
|
128
|
+
static formatCsvHeaderResponse() {
|
|
129
|
+
return `sysplex,system,subsystem,ruleset,status,autoenabled`;
|
|
130
|
+
}
|
|
131
|
+
static formatCsvDataResponse(rulesetList) {
|
|
132
|
+
let output = `"${rulesetList.sysplex}","${rulesetList.system}",`;
|
|
133
|
+
output = output + `"${rulesetList.subsystem}","${rulesetList.ruleset}",`;
|
|
134
|
+
output = output + `"${rulesetList.status}","${rulesetList.autoEnabled}"`;
|
|
135
|
+
return output;
|
|
38
136
|
}
|
|
39
137
|
}
|
|
40
138
|
exports.RulesetListUtils = RulesetListUtils;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RulesetListUtils.js","sourceRoot":"","sources":["../../../src/api/utils/RulesetListUtils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAGH,
|
|
1
|
+
{"version":3,"file":"RulesetListUtils.js","sourceRoot":"","sources":["../../../src/api/utils/RulesetListUtils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AC;IACjE,CAAC;IAEM,MAAM,CAAC,qBAAqB,CAAC,WAAgB;QAEhD,IAAI,MAAM,GAAG,IAAI,WAAW,CAAC,OAAO,MAAM,WAAW,CAAC,MAAM,IAAI,CAAC;QACjE,MAAM,GAAG,MAAM,GAAG,IAAI,WAAW,CAAC,SAAS,MAAM,WAAW,CAAC,OAAO,IAAI,CAAC;QACzE,MAAM,GAAG,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,MAAM,WAAW,CAAC,WAAW,GAAG,CAAC;QAEzE,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA5HD,4CA4HC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Session } from "@zowe/imperative";
|
|
2
2
|
export declare class RulesetUtils {
|
|
3
3
|
static getRulesetURL(session: Session, ruleSetName: string, restApi: boolean, subSystem: string): string;
|
|
4
|
-
static formatRulesetResponse(ruleSet: string, system: string, subsystem: string, status: string, autoenabled: string): string;
|
|
5
4
|
}
|
|
@@ -24,28 +24,24 @@
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.RulesetUtils = void 0;
|
|
26
26
|
const constants_1 = require("../constants");
|
|
27
|
-
const OpsTextUtils_1 = require("./OpsTextUtils");
|
|
28
27
|
class RulesetUtils {
|
|
29
28
|
static getRulesetURL(session, ruleSetName, restApi, subSystem) {
|
|
29
|
+
let ruleset = "";
|
|
30
|
+
if (session.ISession.basePath === null || session.ISession.basePath === "") {
|
|
31
|
+
ruleset = constants_1.OpsConstants.DEFAULT_BASEPATH;
|
|
32
|
+
}
|
|
30
33
|
let subsystemQueryString = "";
|
|
31
34
|
if (subSystem != null) {
|
|
32
35
|
subsystemQueryString = "?sub=" + encodeURIComponent(subSystem);
|
|
33
36
|
}
|
|
34
37
|
if (ruleSetName != null) {
|
|
35
38
|
ruleSetName = encodeURIComponent(ruleSetName);
|
|
36
|
-
return `${constants_1.OpsConstants.RULESET_URL}/${ruleSetName}${subsystemQueryString}`;
|
|
39
|
+
return `${ruleset}${constants_1.OpsConstants.RULESET_URL}/${ruleSetName}${subsystemQueryString}`;
|
|
37
40
|
}
|
|
38
41
|
else {
|
|
39
|
-
return `${constants_1.OpsConstants.RULESET_URL}${subsystemQueryString}`;
|
|
42
|
+
return `${ruleset}${constants_1.OpsConstants.RULESET_URL}${subsystemQueryString}`;
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
|
-
static formatRulesetResponse(ruleSet, system, subsystem, status, autoenabled) {
|
|
43
|
-
const name = OpsTextUtils_1.OpsTextUtils.colorizeAttention("name: ");
|
|
44
|
-
const statusText = OpsTextUtils_1.OpsTextUtils.colorizeAttention(" status: ");
|
|
45
|
-
const autoenabledText = OpsTextUtils_1.OpsTextUtils.colorizeAttention(" autoenabled: ");
|
|
46
|
-
return name + system + "/" + subsystem + "/" + ruleSet
|
|
47
|
-
+ statusText + status + autoenabledText + autoenabled;
|
|
48
|
-
}
|
|
49
45
|
}
|
|
50
46
|
exports.RulesetUtils = RulesetUtils;
|
|
51
47
|
//# sourceMappingURL=RulesetUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RulesetUtils.js","sourceRoot":"","sources":["../../../src/api/utils/RulesetUtils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAGH,4CAA4C;
|
|
1
|
+
{"version":3,"file":"RulesetUtils.js","sourceRoot":"","sources":["../../../src/api/utils/RulesetUtils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAGH,4CAA4C;AAE5C,MAAa,YAAY;IAEd,MAAM,CAAC,aAAa,CAAC,OAAgB,EAAE,WAAmB,EAAE,OAAgB,EAAE,SAAiB;QAElG,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,KAAK,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,KAAK,EAAE,EAAE;YACxE,OAAO,GAAG,wBAAY,CAAC,gBAAgB,CAAC;SAC3C;QAED,IAAI,oBAAoB,GAAG,EAAE,CAAC;QAC9B,IAAI,SAAS,IAAI,IAAI,EAAE;YACnB,oBAAoB,GAAG,OAAO,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;SAClE;QAED,IAAI,WAAW,IAAI,IAAI,EAAE;YACrB,WAAW,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;YAC9C,OAAO,GAAG,OAAO,GAAG,wBAAY,CAAC,WAAW,IAAI,WAAW,GAAG,oBAAoB,EAAE,CAAC;SACxF;aACI;YACD,OAAO,GAAG,OAAO,GAAG,wBAAY,CAAC,WAAW,GAAG,oBAAoB,EAAE,CAAC;SACzE;IACL,CAAC;CACJ;AAvBD,oCAuBC"}
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { IHandlerParameters } from "@zowe/imperative";
|
|
2
2
|
export declare class SSMResourceListUtils {
|
|
3
|
-
static
|
|
3
|
+
static printShowResourceResponse(SSMResourceList: any, params: IHandlerParameters): string;
|
|
4
|
+
static printResourceStateList(SSMResourceList: any, params: IHandlerParameters): string;
|
|
5
|
+
static formatNotRestApiResourceList(SSMResourceList: any, params: IHandlerParameters): string;
|
|
6
|
+
static formatRestApiResourceList(SSMResourceList: any, params: IHandlerParameters): string;
|
|
7
|
+
static formatRestApiAllResourceList(SSMResourceList: any, params: IHandlerParameters): string;
|
|
8
|
+
static formatOutputFromArrayRestApi(resource: any, i: number, params: IHandlerParameters): string;
|
|
9
|
+
static formatOutputRestApi(resource: any, params: IHandlerParameters): string;
|
|
10
|
+
static formatResourceResponse(table: string, resourceName: string): string;
|
|
11
|
+
static formatStateResponse(current: string, desired: string, restApi: boolean): string;
|
|
12
|
+
static formatAllDataResponse(SSMResourceList: any): string;
|
|
13
|
+
static formatAllDataResponseJson(SSMResourceList: any): string;
|
|
14
|
+
static formatAllDataResponseWithColor(SSMResourceList: any): string;
|
|
15
|
+
static formatAllCsvHeaderResponse(): string;
|
|
16
|
+
static formatAllCsvDataResponse(SSMResourceList: any): string;
|
|
4
17
|
}
|
|
@@ -23,31 +23,288 @@
|
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.SSMResourceListUtils = void 0;
|
|
26
|
-
const
|
|
26
|
+
const constants_1 = require("../constants");
|
|
27
|
+
const OpsTextUtils_1 = require("./OpsTextUtils");
|
|
27
28
|
class SSMResourceListUtils {
|
|
28
|
-
static
|
|
29
|
-
let table = "";
|
|
29
|
+
static printShowResourceResponse(SSMResourceList, params) {
|
|
30
30
|
if (params.arguments.restApi === false) {
|
|
31
|
-
|
|
32
|
-
table = SSMResourceList.ssmresource[i].table;
|
|
33
|
-
params.response.console.log(SSMUtils_1.SSMUtils.formatResourceResponse(table, SSMResourceList.ssmresource[i].resource));
|
|
34
|
-
params.response.console.log(SSMUtils_1.SSMUtils.formatStateResponse(SSMResourceList.ssmresource[i].current, SSMResourceList.ssmresource[i].desired, params.arguments.restApi));
|
|
35
|
-
}
|
|
31
|
+
return SSMResourceListUtils.formatNotRestApiResourceList(SSMResourceList, params);
|
|
36
32
|
}
|
|
37
33
|
else {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
return SSMResourceListUtils.formatRestApiAllResourceList(SSMResourceList, params);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
static printResourceStateList(SSMResourceList, params) {
|
|
38
|
+
if (params.arguments.restApi === false) {
|
|
39
|
+
return SSMResourceListUtils.formatNotRestApiResourceList(SSMResourceList, params);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return SSMResourceListUtils.formatRestApiResourceList(SSMResourceList, params);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
static formatNotRestApiResourceList(SSMResourceList, params) {
|
|
46
|
+
let table = "";
|
|
47
|
+
let output = "";
|
|
48
|
+
for (let i = 0; i < SSMResourceList.count; i += 1) {
|
|
49
|
+
table = SSMResourceList.ssmresource[i].table;
|
|
50
|
+
if (i > 0) {
|
|
51
|
+
output = output + "\n";
|
|
52
|
+
}
|
|
53
|
+
output = output + SSMResourceListUtils.formatResourceResponse(table, SSMResourceList.ssmresource[i].resource);
|
|
54
|
+
output = `${output}\n${SSMResourceListUtils.formatStateResponse(SSMResourceList.ssmresource[i].current, SSMResourceList.ssmresource[i].desired, params.arguments.restApi)}`;
|
|
55
|
+
}
|
|
56
|
+
return output;
|
|
57
|
+
}
|
|
58
|
+
static formatRestApiResourceList(SSMResourceList, params) {
|
|
59
|
+
let table = "";
|
|
60
|
+
let output = "";
|
|
61
|
+
if (SSMResourceList.length > 0) {
|
|
62
|
+
for (let i = 0; i < SSMResourceList.length; i += 1) {
|
|
63
|
+
table = SSMResourceList[i].table;
|
|
64
|
+
if (i > 0) {
|
|
65
|
+
output = output + "\n";
|
|
43
66
|
}
|
|
67
|
+
output = output + SSMResourceListUtils.formatResourceResponse(table, SSMResourceList[i].resource);
|
|
68
|
+
output = `${output}\n${SSMResourceListUtils.formatStateResponse(SSMResourceList[i].currentState, SSMResourceList[i].desiredState, params.arguments.restApi)}`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
table = SSMResourceList.table;
|
|
73
|
+
output = SSMResourceListUtils.formatResourceResponse(table, SSMResourceList.resource);
|
|
74
|
+
output = `${output}\n${SSMResourceListUtils.formatStateResponse(SSMResourceList.currentState, SSMResourceList.desiredState, params.arguments.restApi)}`;
|
|
75
|
+
}
|
|
76
|
+
return output;
|
|
77
|
+
}
|
|
78
|
+
static formatRestApiAllResourceList(SSMResourceList, params) {
|
|
79
|
+
let output = "";
|
|
80
|
+
if (SSMResourceList.length > 0) {
|
|
81
|
+
for (let i = 0; i < SSMResourceList.length; i += 1) {
|
|
82
|
+
const resource = SSMResourceList[i];
|
|
83
|
+
output = output + SSMResourceListUtils.formatOutputFromArrayRestApi(resource, i, params);
|
|
84
|
+
}
|
|
85
|
+
// close out JSON
|
|
86
|
+
if (params.arguments.format.toUpperCase() === constants_1.OpsConstants.JSON) {
|
|
87
|
+
output = output + "]";
|
|
44
88
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
output = output + SSMResourceListUtils.formatOutputRestApi(SSMResourceList, params);
|
|
92
|
+
}
|
|
93
|
+
return output;
|
|
94
|
+
}
|
|
95
|
+
static formatOutputFromArrayRestApi(resource, i, params) {
|
|
96
|
+
let output = "";
|
|
97
|
+
if (params.arguments.format.toUpperCase() === constants_1.OpsConstants.CSV) {
|
|
98
|
+
if (i === 0) {
|
|
99
|
+
output = `${output}${SSMResourceListUtils.formatAllCsvHeaderResponse()}`;
|
|
100
|
+
}
|
|
101
|
+
output = `${output}\n${SSMResourceListUtils.formatAllCsvDataResponse(resource)}`;
|
|
102
|
+
}
|
|
103
|
+
else if (params.arguments.format.toUpperCase() === constants_1.OpsConstants.JSON) {
|
|
104
|
+
if (i === 0) {
|
|
105
|
+
output = output + "[";
|
|
49
106
|
}
|
|
107
|
+
else if (i > 0) {
|
|
108
|
+
output = output + ",\n";
|
|
109
|
+
}
|
|
110
|
+
output = `${output}${SSMResourceListUtils.formatAllDataResponseJson(resource)}`;
|
|
111
|
+
}
|
|
112
|
+
else if (params.arguments.format.toUpperCase() === constants_1.OpsConstants.NAMEVALUECOLOR) {
|
|
113
|
+
if (i > 0) {
|
|
114
|
+
output = output + "\n";
|
|
115
|
+
}
|
|
116
|
+
output = `${output}${SSMResourceListUtils.formatAllDataResponseWithColor(resource)}`;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
if (i > 0) {
|
|
120
|
+
output = output + "\n";
|
|
121
|
+
}
|
|
122
|
+
output = `${output}${SSMResourceListUtils.formatAllDataResponse(resource)}`;
|
|
123
|
+
}
|
|
124
|
+
return output;
|
|
125
|
+
}
|
|
126
|
+
static formatOutputRestApi(resource, params) {
|
|
127
|
+
let output = "";
|
|
128
|
+
if (params.arguments.format.toUpperCase() === constants_1.OpsConstants.CSV) {
|
|
129
|
+
output = `${SSMResourceListUtils.formatAllCsvHeaderResponse()}`;
|
|
130
|
+
output = `${output}\n${SSMResourceListUtils.formatAllCsvDataResponse(resource)}`;
|
|
50
131
|
}
|
|
132
|
+
else if (params.arguments.format.toUpperCase() === constants_1.OpsConstants.JSON) {
|
|
133
|
+
output = `[${output}${SSMResourceListUtils.formatAllDataResponseJson(resource)}]`;
|
|
134
|
+
}
|
|
135
|
+
else if (params.arguments.format.toUpperCase() === constants_1.OpsConstants.NAMEVALUECOLOR) {
|
|
136
|
+
output = `${output}${SSMResourceListUtils.formatAllDataResponseWithColor(resource)}`;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
output = `${output}${SSMResourceListUtils.formatAllDataResponse(resource)}`;
|
|
140
|
+
}
|
|
141
|
+
return output;
|
|
142
|
+
}
|
|
143
|
+
static formatResourceResponse(table, resourceName) {
|
|
144
|
+
const name = OpsTextUtils_1.OpsTextUtils.colorizeAttention("name: ");
|
|
145
|
+
return `${name}/${table}/${resourceName}`;
|
|
146
|
+
}
|
|
147
|
+
static formatStateResponse(current, desired, restApi) {
|
|
148
|
+
const state = " state";
|
|
149
|
+
let currentStateString = "current";
|
|
150
|
+
let desiredStateString = "desired";
|
|
151
|
+
if (restApi) {
|
|
152
|
+
currentStateString = currentStateString + state;
|
|
153
|
+
desiredStateString = desiredStateString + state;
|
|
154
|
+
}
|
|
155
|
+
let currentState = current;
|
|
156
|
+
let desiredState = desired;
|
|
157
|
+
if (currentState === desiredState) {
|
|
158
|
+
currentState = OpsTextUtils_1.OpsTextUtils.colorizeOK(currentState);
|
|
159
|
+
desiredState = OpsTextUtils_1.OpsTextUtils.colorizeOK(desiredState);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
currentState = OpsTextUtils_1.OpsTextUtils.colorizeError(currentState);
|
|
163
|
+
desiredState = OpsTextUtils_1.OpsTextUtils.colorizeError(desiredState);
|
|
164
|
+
}
|
|
165
|
+
const currentAttention = OpsTextUtils_1.OpsTextUtils.colorizeAttention(currentStateString + ": ");
|
|
166
|
+
const desiredAttention = OpsTextUtils_1.OpsTextUtils.colorizeAttention(desiredStateString + ": ");
|
|
167
|
+
return `${currentAttention}${currentState} ${desiredAttention}${desiredState}`;
|
|
168
|
+
}
|
|
169
|
+
static formatAllDataResponse(SSMResourceList) {
|
|
170
|
+
let output = `name: /${SSMResourceList.table}/${SSMResourceList.resource}\n`;
|
|
171
|
+
const lineLength = 30;
|
|
172
|
+
output = output + ` sysplex: ${SSMResourceList.sysplex} system: ${SSMResourceList.system}`;
|
|
173
|
+
// if no value then show ''
|
|
174
|
+
if (SSMResourceList.jobName === "") {
|
|
175
|
+
SSMResourceList.jobName = "''";
|
|
176
|
+
}
|
|
177
|
+
output = output + ` subsystem: ${SSMResourceList.subsystem} jobName: ${SSMResourceList.jobName}\n`;
|
|
178
|
+
output = output + ` type: ${SSMResourceList.type} currentState: ${SSMResourceList.currentState}`;
|
|
179
|
+
output = output + ` desiredState: ${SSMResourceList.desiredState}`;
|
|
180
|
+
// if no value then show ''
|
|
181
|
+
if (SSMResourceList.prereqs === "") {
|
|
182
|
+
SSMResourceList.prereqs = "''";
|
|
183
|
+
}
|
|
184
|
+
// For prereqs place on separate line if long value
|
|
185
|
+
if (SSMResourceList.prereqs.length > lineLength) {
|
|
186
|
+
output = output + `\n prereqs: ${SSMResourceList.prereqs}\n`;
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
output = output + ` prereqs: ${SSMResourceList.prereqs}\n`;
|
|
190
|
+
}
|
|
191
|
+
// if no value then show ''
|
|
192
|
+
if (SSMResourceList.missingPrereqs === "") {
|
|
193
|
+
SSMResourceList.missingPrereqs = "''";
|
|
194
|
+
}
|
|
195
|
+
// For missingPrereqs place on separate line if long value
|
|
196
|
+
if (SSMResourceList.missingPrereqs.length > lineLength) {
|
|
197
|
+
output = output + ` missingPrereqs: ${SSMResourceList.missingPrereqs}\n`;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
output = output + ` missingPrereqs: ${SSMResourceList.missingPrereqs}`;
|
|
201
|
+
}
|
|
202
|
+
output = output + ` resourceMode: ${SSMResourceList.resourceMode}`;
|
|
203
|
+
output = output + ` prereqMode: ${SSMResourceList.prereqMode} referenceMode: ${SSMResourceList.referenceMode}\n`;
|
|
204
|
+
output = output + ` actionMode: ${SSMResourceList.actionMode} scheduleMode: ${SSMResourceList.scheduleMode}`;
|
|
205
|
+
output = output + ` checkpointState: ${SSMResourceList.chkpointState} iplState: ${SSMResourceList.iplState}`;
|
|
206
|
+
return output;
|
|
207
|
+
}
|
|
208
|
+
static formatAllDataResponseJson(SSMResourceList) {
|
|
209
|
+
let output = `{`;
|
|
210
|
+
output = output + `"sysplex": "${SSMResourceList.sysplex}", "system": "${SSMResourceList.system}", `;
|
|
211
|
+
output = output + `"subsystem": "${SSMResourceList.subsystem}", "table": "${SSMResourceList.table}", `;
|
|
212
|
+
output = output + `"resource": "${SSMResourceList.resource}", "jobName": "${SSMResourceList.jobName}", `;
|
|
213
|
+
output = output + `"type": "${SSMResourceList.type}", "currentState": "${SSMResourceList.currentState}", `;
|
|
214
|
+
output = output + `"desiredState": "${SSMResourceList.desiredState}", "prereqs": "${SSMResourceList.prereqs}", `;
|
|
215
|
+
output = output + `"missingPrereqs": "${SSMResourceList.missingPrereqs}", "resourceMode": "${SSMResourceList.resourceMode}", `;
|
|
216
|
+
output = output + `"prereqMode": "${SSMResourceList.prereqMode}", "referenceMode": "${SSMResourceList.referenceMode}", `;
|
|
217
|
+
output = output + `"actionMode": "${SSMResourceList.actionMode}", "scheduleMode": "${SSMResourceList.scheduleMode}", `;
|
|
218
|
+
output = output + `"checkpointState": "${SSMResourceList.chkpointState}", "iplState": "${SSMResourceList.iplState}"`;
|
|
219
|
+
output = output + `}`;
|
|
220
|
+
return output;
|
|
221
|
+
}
|
|
222
|
+
static formatAllDataResponseWithColor(SSMResourceList) {
|
|
223
|
+
const name = OpsTextUtils_1.OpsTextUtils.colorizeAttention("name: ");
|
|
224
|
+
let output = `${name}/${SSMResourceList.table}/${SSMResourceList.resource}\n`;
|
|
225
|
+
const sysplexText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("sysplex: ");
|
|
226
|
+
const sysplexValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.sysplex);
|
|
227
|
+
const systemText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("system: ");
|
|
228
|
+
const systemValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.system);
|
|
229
|
+
const subsystemText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("subsystem: ");
|
|
230
|
+
const subsystemValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.subsystem);
|
|
231
|
+
// if no value then show ''
|
|
232
|
+
if (SSMResourceList.jobName === "") {
|
|
233
|
+
SSMResourceList.jobName = "''";
|
|
234
|
+
}
|
|
235
|
+
const jobNameText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("jobName: ");
|
|
236
|
+
const jobNameValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.jobName);
|
|
237
|
+
const typeText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("type: ");
|
|
238
|
+
const typeValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.type);
|
|
239
|
+
const currentStateText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("currentState: ");
|
|
240
|
+
const currentStateValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.currentState);
|
|
241
|
+
const desiredStateText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("desiredState: ");
|
|
242
|
+
const desiredStateValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.desiredState);
|
|
243
|
+
// if no value then show ''
|
|
244
|
+
if (SSMResourceList.prereqs === "") {
|
|
245
|
+
SSMResourceList.prereqs = "''";
|
|
246
|
+
}
|
|
247
|
+
const prereqsText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("prereqs: ");
|
|
248
|
+
const prereqsValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.prereqs);
|
|
249
|
+
// if no value then show ''
|
|
250
|
+
if (SSMResourceList.missingPrereqs === "") {
|
|
251
|
+
SSMResourceList.missingPrereqs = "''";
|
|
252
|
+
}
|
|
253
|
+
const missingPrereqsText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("missingPrereqs: ");
|
|
254
|
+
const missingPrereqsValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.missingPrereqs);
|
|
255
|
+
const resourceModeText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("resourceMode: ");
|
|
256
|
+
const resourceModeValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.resourceMode);
|
|
257
|
+
const prereqModeText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("prereqMode: ");
|
|
258
|
+
const prereqModeValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.prereqMode);
|
|
259
|
+
const referenceModeText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("referenceMode: ");
|
|
260
|
+
const referenceModeValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.referenceMode);
|
|
261
|
+
const actionModeText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("actionMode: ");
|
|
262
|
+
const actionModeValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.actionMode);
|
|
263
|
+
const scheduleModeText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("scheduleMode: ");
|
|
264
|
+
const scheduleModeValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.scheduleMode);
|
|
265
|
+
const chkpointStateText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("chkpointState: ");
|
|
266
|
+
const chkpointStateValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.chkpointState);
|
|
267
|
+
const iplStateText = OpsTextUtils_1.OpsTextUtils.colorizeAttention("iplState: ");
|
|
268
|
+
const iplStateValue = OpsTextUtils_1.OpsTextUtils.colorizeOK(SSMResourceList.iplState);
|
|
269
|
+
const lineLength = 30;
|
|
270
|
+
output = output + ` ${sysplexText}${sysplexValue} ${systemText}${systemValue}`;
|
|
271
|
+
output = output + ` ${subsystemText}${subsystemValue} ${jobNameText}${jobNameValue}\n`;
|
|
272
|
+
output = output + ` ${typeText}${typeValue} ${currentStateText}${currentStateValue}`;
|
|
273
|
+
output = output + ` ${desiredStateText}${desiredStateValue}`;
|
|
274
|
+
// For prereqs and missingPrereqs place on separate line if long value
|
|
275
|
+
if (SSMResourceList.prereqs.length > lineLength) {
|
|
276
|
+
output = output + `\n ${prereqsText}${prereqsValue}\n`;
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
output = output + ` ${prereqsText}${prereqsValue}\n`;
|
|
280
|
+
}
|
|
281
|
+
if (SSMResourceList.missingPrereqs.length > lineLength) {
|
|
282
|
+
output = output + `\n ${missingPrereqsText}${missingPrereqsValue}\n`;
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
output = output + ` ${missingPrereqsText}${missingPrereqsValue}`;
|
|
286
|
+
}
|
|
287
|
+
output = output + ` ${resourceModeText}${resourceModeValue}`;
|
|
288
|
+
output = output + ` ${prereqModeText}${prereqModeValue} ${referenceModeText}${referenceModeValue}\n`;
|
|
289
|
+
output = output + ` ${actionModeText}${actionModeValue} ${scheduleModeText}${scheduleModeValue}`;
|
|
290
|
+
output = output + ` ${chkpointStateText}${chkpointStateValue} ${iplStateText}${iplStateValue}\n`;
|
|
291
|
+
return output;
|
|
292
|
+
}
|
|
293
|
+
static formatAllCsvHeaderResponse() {
|
|
294
|
+
let output = `Sysplex,System,Subsystem,Job Name,Type,Current State,Desired State,Prereqs,Missing Prereqs,Resource Mode,`;
|
|
295
|
+
output = output + `Prereq Mode,Reference Mode,Action Mode,Schedule Mode,Checkpoint State,IPL State`;
|
|
296
|
+
return output;
|
|
297
|
+
}
|
|
298
|
+
static formatAllCsvDataResponse(SSMResourceList) {
|
|
299
|
+
let output = `"${SSMResourceList.sysplex}","${SSMResourceList.system}",`;
|
|
300
|
+
output = output + `"${SSMResourceList.subsystem}","${SSMResourceList.jobName}",`;
|
|
301
|
+
output = output + `"${SSMResourceList.type}","${SSMResourceList.currentState}",`;
|
|
302
|
+
output = output + `"${SSMResourceList.desiredState}","${SSMResourceList.prereqs}",`;
|
|
303
|
+
output = output + `"${SSMResourceList.missingPrereqs}","${SSMResourceList.resourceMode}",`;
|
|
304
|
+
output = output + `"${SSMResourceList.prereqMode}","${SSMResourceList.referenceMode}",`;
|
|
305
|
+
output = output + `"${SSMResourceList.actionMode}","${SSMResourceList.scheduleMode}",`;
|
|
306
|
+
output = output + `"${SSMResourceList.chkpointState}","${SSMResourceList.iplState}"`;
|
|
307
|
+
return output;
|
|
51
308
|
}
|
|
52
309
|
}
|
|
53
310
|
exports.SSMResourceListUtils = SSMResourceListUtils;
|