@opscompass/skills 0.1.0 → 0.2.1
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 +9 -1
- package/manifest.json +2 -2
- package/package.json +1 -1
- package/skills/opscompass-oracle-licensing/.opscompass-runtime/tools/opsc-cli-context.js +34 -0
- package/skills/opscompass-oracle-licensing/.opscompass-runtime/tools/opsc-cli.js +102 -0
- package/skills/opscompass-oracle-licensing/SKILL.md +11 -5
- package/skills/opscompass-oracle-licensing/references/evidence-model.md +6 -2
- package/skills/opscompass-oracle-licensing/references/report-structure.md +7 -3
- package/skills/opscompass-oracle-licensing/scripts/oracle-assessment.js +284 -0
- package/skills/opscompass-oracle-licensing/scripts/oracle-assessment.tool.js +32 -0
- package/skills/opscompass-oracle-licensing/scripts/tools.js +3 -2
- package/skills/opscompass-resources/.opscompass-runtime/tools/opsc-cli-context.js +10 -0
- package/skills/opscompass-resources/.opscompass-runtime/tools/opsc-cli.js +24 -12
- package/skills/opscompass-resources/SKILL.md +37 -11
- package/skills/opscompass-resources/references/resources-commands.md +15 -1
- package/skills/opscompass-resources/scripts/build-resources-command.tool.js +6 -1
- package/skills/opscompass-resources/scripts/build_resources_command.js +43 -5
- package/skills/opscompass-resources/scripts/list_and_fetch_latest_configs.js +4 -4
- package/skills/opscompass-resources/scripts/opscompass-resources.tool.js +1 -0
- package/skills/opscompass-resources/scripts/tools.js +1 -0
- package/skills/opscompass-oracle-licensing/api/entitlement-compliance/entitlement-compliance.json +0 -189
- package/skills/opscompass-oracle-licensing/api/entitlement-deployment/entitlement-deployment +0 -26
- package/skills/opscompass-oracle-licensing/api/entitlement-usage/entitlement-usage.json +0 -114
- package/skills/opscompass-oracle-licensing/assets/mock-entitlements/deployment-details.json +0 -61
- package/skills/opscompass-oracle-licensing/assets/mock-entitlements/license-usage-map.json +0 -70
- package/skills/opscompass-oracle-licensing/assets/mock-entitlements/overall-compliance.json +0 -36
- package/skills/opscompass-oracle-licensing/scripts/fake-entitlements-api.tool.js +0 -31
- package/skills/opscompass-oracle-licensing/scripts/fake_entitlements_api.js +0 -72
package/skills/opscompass-oracle-licensing/api/entitlement-deployment/entitlement-deployment
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{"Server":"NTX3-HOST06-DC3","VM":"NTX-APPLICATIONPROD-LX02","Instance":"TRKP1","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"3/5/25"},
|
|
3
|
-
{"Server":"NTX5-HOST01-DC1","VM":"NTX-INTERFACEDEV-LX01","Instance":"INVD1","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"4/11/25"},
|
|
4
|
-
{"Server":"NTX5-HOST01-DC1","VM":"NTX-ARRAYDEV-LX01","Instance":"INVQ2","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"3/14/25"},
|
|
5
|
-
{"Server":"NTX5-HOST01-DC1","VM":"NTX-CAPACITORDEV-LX01","Instance":"DWHS01","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"4/11/25"},
|
|
6
|
-
{"Server":"NTX5-HOST01-DC1","VM":"NTX-MONITORDEV-LX01","Instance":"HISTDR2","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"5/3/18"},
|
|
7
|
-
{"Server":"NTX5-HOST01-DC1","VM":"NTX-ALARMDEV-LX02","Instance":"INVT2","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"4/9/25"},
|
|
8
|
-
{"Server":"NTX5-HOST01-DC1","VM":"NTX-CARDDEV-LX01","Instance":"MEND2","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"1/1/25"},
|
|
9
|
-
{"Server":"NTX5-HOST01-DC1","VM":"NTX-DRIVERDEV-LX01","Instance":"HISTQA","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"2/26/25"},
|
|
10
|
-
{"Server":"NTX5-HOST01-DC1","VM":"NTX-CIRCUITDEV-LX01","Instance":"REPD1","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"2/24/25"},
|
|
11
|
-
{"Server":"NTX5-HOST01-DC1","VM":"NTX-BANDWIDTHDEV-LX01","Instance":"RMANCP1","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"3/3/25"},
|
|
12
|
-
{"Server":"NTX5-HOST01-DC1","VM":"NTX-MONITORDEV-LX01","Instance":"TRK2","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"2/13/25"},
|
|
13
|
-
{"Server":"NTX5-HOST01-DC1","VM":"NTX-ALARMDEV-LX02","Instance":"INVT1","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"4/9/25"},
|
|
14
|
-
{"Server":"NTX5-HOST01-DC1","VM":"NTX-MONITORDEV-LX01","Instance":"INVT2","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"4/9/25"},
|
|
15
|
-
{"Server":"NTX5-HOST02-DC1","VM":"NTX-APPLICATIONDEV-LX02","Instance":"DWHS02","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"4/11/25"},
|
|
16
|
-
{"Server":"NTX5-HOST02-DC1","VM":"NTX-PROGRAMDEV-LX02","Instance":"INVD2","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"4/11/25"},
|
|
17
|
-
{"Server":"NTX5-HOST02-DC1","VM":"NTX-FIREWALLDEV-LX02","Instance":"HISTDR1","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"5/3/18"},
|
|
18
|
-
{"Server":"NTX5-HOST02-DC1","VM":"NTX-CAPACITORDEV-LX02","Instance":"INVQ1","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"3/14/25"},
|
|
19
|
-
{"Server":"NTX5-HOST02-DC1","VM":"NTX-ALARMDEV-LX02","Instance":"MEND1","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"1/1/25"},
|
|
20
|
-
{"Server":"NTX5-HOST02-DC1","VM":"NTX-APPLICATIONDEV-LX02","Instance":"RMANCP2","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"3/3/25"},
|
|
21
|
-
{"Server":"NTX5-HOST02-DC1","VM":"NTX-CARDDEV-LX02","Instance":"TRK1","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"2/13/25"},
|
|
22
|
-
{"Server":"NTX5-HOST02-DC1","VM":"NTX-ARRAYDEV-LX02","Instance":"REPD2","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"2/23/25"},
|
|
23
|
-
{"Server":"NTX6-HOST01-DC1","VM":"NTX-FIREWALLPROD-LX01","Instance":"INVP2","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"2/2/13"},
|
|
24
|
-
{"Server":"NTX6-HOST01-DC1","VM":"NTX-PIXELPROD-LX01","Instance":"TRKP2","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"3/5/25"},
|
|
25
|
-
{"Server":"NTX6-HOST02-DC1","VM":"NTX-SYSTEMPROD-LX02","Instance":"INVP1","Edition":"Enterprise Edition","Version":"19.0.0.0.0","DB Created":"2/2/13"}
|
|
26
|
-
]
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"Product": "Oracle Active Data Guard",
|
|
4
|
-
"Metric": "Processor",
|
|
5
|
-
"Limitation": "Full Use",
|
|
6
|
-
"Limited To": "",
|
|
7
|
-
"Usage": 16
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"Product": "Oracle Advanced Compression",
|
|
11
|
-
"Metric": "Processor",
|
|
12
|
-
"Limitation": "Full Use",
|
|
13
|
-
"Limited To": "",
|
|
14
|
-
"Usage": 16
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"Product": "Oracle Advanced Security",
|
|
18
|
-
"Metric": "Named User Plus",
|
|
19
|
-
"Limitation": "Limited Use Other",
|
|
20
|
-
"Limited To": "Test / Dev",
|
|
21
|
-
"Usage": 400
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"Product": "Oracle Advanced Security",
|
|
25
|
-
"Metric": "Processor",
|
|
26
|
-
"Limitation": "Full Use",
|
|
27
|
-
"Limited To": "",
|
|
28
|
-
"Usage": 32
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"Product": "Oracle Database Enterprise Edition",
|
|
32
|
-
"Metric": "Processor",
|
|
33
|
-
"Limitation": "Full Use",
|
|
34
|
-
"Limited To": "",
|
|
35
|
-
"Usage": 32
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"Product": "Oracle Database Enterprise Edition",
|
|
39
|
-
"Metric": "Named User Plus",
|
|
40
|
-
"Limitation": "Limited Use Other",
|
|
41
|
-
"Limited To": "Test / Dev",
|
|
42
|
-
"Usage": 400
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"Product": "Oracle Database Vault",
|
|
46
|
-
"Metric": "Named User Plus",
|
|
47
|
-
"Limitation": "Limited Use Other",
|
|
48
|
-
"Limited To": "Test / Dev",
|
|
49
|
-
"Usage": 400
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"Product": "Oracle Database Vault",
|
|
53
|
-
"Metric": "Processor",
|
|
54
|
-
"Limitation": "Full Use",
|
|
55
|
-
"Limited To": "",
|
|
56
|
-
"Usage": 32
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"Product": "Oracle Diagnostics Pack",
|
|
60
|
-
"Metric": "Processor",
|
|
61
|
-
"Limitation": "Full Use",
|
|
62
|
-
"Limited To": "",
|
|
63
|
-
"Usage": 16
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"Product": "Oracle Diagnostics Pack",
|
|
67
|
-
"Metric": "Named User Plus",
|
|
68
|
-
"Limitation": "Limited Use Other",
|
|
69
|
-
"Limited To": "Test / Dev",
|
|
70
|
-
"Usage": 400
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
"Product": "Oracle GoldenGate",
|
|
74
|
-
"Metric": "Processor",
|
|
75
|
-
"Limitation": "Full Use",
|
|
76
|
-
"Limited To": "",
|
|
77
|
-
"Usage": 16
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"Product": "Oracle GoldenGate",
|
|
81
|
-
"Metric": "Named User Plus",
|
|
82
|
-
"Limitation": "Limited Use Other",
|
|
83
|
-
"Limited To": "Test / Dev",
|
|
84
|
-
"Usage": 400
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"Product": "Oracle Partitioning",
|
|
88
|
-
"Metric": "Processor",
|
|
89
|
-
"Limitation": "Full Use",
|
|
90
|
-
"Limited To": "",
|
|
91
|
-
"Usage": 16
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"Product": "Oracle Partitioning",
|
|
95
|
-
"Metric": "Named User Plus",
|
|
96
|
-
"Limitation": "Limited Use Other",
|
|
97
|
-
"Limited To": "Test / Dev",
|
|
98
|
-
"Usage": 400
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"Product": "Oracle Real Application Clusters",
|
|
102
|
-
"Metric": "Processor",
|
|
103
|
-
"Limitation": "Full Use",
|
|
104
|
-
"Limited To": "",
|
|
105
|
-
"Usage": 32
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"Product": "Oracle Real Application Clusters",
|
|
109
|
-
"Metric": "Named User Plus",
|
|
110
|
-
"Limitation": "Limited Use Other",
|
|
111
|
-
"Limited To": "Test / Dev",
|
|
112
|
-
"Usage": 400
|
|
113
|
-
}
|
|
114
|
-
]
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"organization": "OpsCompass Demo",
|
|
3
|
-
"assessmentScope": "oracle-licensing",
|
|
4
|
-
"generatedAt": "2026-04-23T00:00:00Z",
|
|
5
|
-
"deployments": [
|
|
6
|
-
{
|
|
7
|
-
"deploymentId": "prod-microchip",
|
|
8
|
-
"environment": "prod",
|
|
9
|
-
"platform": "nutanix",
|
|
10
|
-
"databaseName": "REPP1",
|
|
11
|
-
"databaseHostname": "NTX-MICROCHIPPROD-LX02",
|
|
12
|
-
"oracleVersion": "19.0.0.0.0",
|
|
13
|
-
"oracleEdition": "Enterprise Edition",
|
|
14
|
-
"vmName": "ntx-microchipprod-lx02",
|
|
15
|
-
"clusterName": "ntx1-prod-dc1",
|
|
16
|
-
"hostName": "ntx1-host08-dc1",
|
|
17
|
-
"provisionedVcpu": 8,
|
|
18
|
-
"estimatedLicensableCores": 8,
|
|
19
|
-
"notes": [
|
|
20
|
-
"Production Oracle workload",
|
|
21
|
-
"Mapped through Nutanix VM latest configuration"
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"deploymentId": "prod-sensor",
|
|
26
|
-
"environment": "prod",
|
|
27
|
-
"platform": "nutanix",
|
|
28
|
-
"databaseName": "REPP2",
|
|
29
|
-
"databaseHostname": "NTX-SENSORPROD-LX02",
|
|
30
|
-
"oracleVersion": "19.0.0.0.0",
|
|
31
|
-
"oracleEdition": "Enterprise Edition",
|
|
32
|
-
"vmName": "ntx-sensorprod-lx02",
|
|
33
|
-
"clusterName": "ntx3-prod-dc3",
|
|
34
|
-
"hostName": "ntx3-host03-dc3",
|
|
35
|
-
"provisionedVcpu": 16,
|
|
36
|
-
"estimatedLicensableCores": 16,
|
|
37
|
-
"notes": [
|
|
38
|
-
"Production Oracle workload",
|
|
39
|
-
"Higher CPU footprint than standard 8-vCPU pattern"
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"deploymentId": "dev-bandwidth",
|
|
44
|
-
"environment": "dev",
|
|
45
|
-
"platform": "nutanix",
|
|
46
|
-
"databaseName": "RMANCP1",
|
|
47
|
-
"databaseHostname": "NTX-BANDWIDTHDEV-LX01",
|
|
48
|
-
"oracleVersion": "19.0.0.0.0",
|
|
49
|
-
"oracleEdition": "Enterprise Edition",
|
|
50
|
-
"vmName": "ntx-bandwidthdev-lx01",
|
|
51
|
-
"clusterName": "ntx2-dev-dc1",
|
|
52
|
-
"hostName": "ntx2-host02-dc1",
|
|
53
|
-
"provisionedVcpu": 4,
|
|
54
|
-
"estimatedLicensableCores": 4,
|
|
55
|
-
"notes": [
|
|
56
|
-
"Development Oracle workload",
|
|
57
|
-
"Candidate for lower licensing priority"
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"organization": "OpsCompass Demo",
|
|
3
|
-
"assessmentScope": "oracle-licensing",
|
|
4
|
-
"generatedAt": "2026-04-23T00:00:00Z",
|
|
5
|
-
"entitlements": [
|
|
6
|
-
{
|
|
7
|
-
"licensePoolId": "ee-processor-pool",
|
|
8
|
-
"licenseMetric": "processor",
|
|
9
|
-
"licenseType": "Oracle Database Enterprise Edition",
|
|
10
|
-
"entitledQuantity": 24,
|
|
11
|
-
"allocatedQuantity": 20,
|
|
12
|
-
"unallocatedQuantity": 4,
|
|
13
|
-
"limitedUse": false
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"licensePoolId": "diag-tuning-pack-pool",
|
|
17
|
-
"licenseMetric": "processor",
|
|
18
|
-
"licenseType": "Diagnostics Pack + Tuning Pack",
|
|
19
|
-
"entitledQuantity": 8,
|
|
20
|
-
"allocatedQuantity": 16,
|
|
21
|
-
"unallocatedQuantity": -8,
|
|
22
|
-
"limitedUse": false
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
|
-
"usageMap": [
|
|
26
|
-
{
|
|
27
|
-
"deploymentId": "prod-microchip",
|
|
28
|
-
"databaseName": "REPP1",
|
|
29
|
-
"assignedLicensePoolIds": [
|
|
30
|
-
"ee-processor-pool",
|
|
31
|
-
"diag-tuning-pack-pool"
|
|
32
|
-
],
|
|
33
|
-
"consumedQuantity": {
|
|
34
|
-
"Oracle Database Enterprise Edition": 8,
|
|
35
|
-
"Diagnostics Pack + Tuning Pack": 8
|
|
36
|
-
},
|
|
37
|
-
"featureSignals": [
|
|
38
|
-
"CONTROL_MANAGEMENT_PACK_ACCESS=DIAGNOSTIC+TUNING"
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"deploymentId": "prod-sensor",
|
|
43
|
-
"databaseName": "REPP2",
|
|
44
|
-
"assignedLicensePoolIds": [
|
|
45
|
-
"ee-processor-pool",
|
|
46
|
-
"diag-tuning-pack-pool"
|
|
47
|
-
],
|
|
48
|
-
"consumedQuantity": {
|
|
49
|
-
"Oracle Database Enterprise Edition": 16,
|
|
50
|
-
"Diagnostics Pack + Tuning Pack": 16
|
|
51
|
-
},
|
|
52
|
-
"featureSignals": [
|
|
53
|
-
"CONTROL_MANAGEMENT_PACK_ACCESS=DIAGNOSTIC+TUNING"
|
|
54
|
-
]
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"deploymentId": "dev-bandwidth",
|
|
58
|
-
"databaseName": "RMANCP1",
|
|
59
|
-
"assignedLicensePoolIds": [
|
|
60
|
-
"ee-processor-pool"
|
|
61
|
-
],
|
|
62
|
-
"consumedQuantity": {
|
|
63
|
-
"Oracle Database Enterprise Edition": 4
|
|
64
|
-
},
|
|
65
|
-
"featureSignals": [
|
|
66
|
-
"CONTROL_MANAGEMENT_PACK_ACCESS=NONE"
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"organization": "OpsCompass Demo",
|
|
3
|
-
"assessmentScope": "oracle-licensing",
|
|
4
|
-
"generatedAt": "2026-04-23T00:00:00Z",
|
|
5
|
-
"summary": {
|
|
6
|
-
"overallStatus": "non-compliant",
|
|
7
|
-
"deploymentsReviewed": 3,
|
|
8
|
-
"deploymentsCompliant": 1,
|
|
9
|
-
"deploymentsWithFindings": 2,
|
|
10
|
-
"licenseDeficiencyCount": 2,
|
|
11
|
-
"limitedUseIssues": 0
|
|
12
|
-
},
|
|
13
|
-
"findings": [
|
|
14
|
-
{
|
|
15
|
-
"deploymentId": "prod-microchip",
|
|
16
|
-
"databaseName": "REPP1",
|
|
17
|
-
"severity": "medium",
|
|
18
|
-
"findingType": "management-pack-overconsumption",
|
|
19
|
-
"message": "Diagnostics Pack + Tuning Pack usage is assigned, but the shared pool is oversubscribed.",
|
|
20
|
-
"recommendedAction": "Reconcile management pack entitlement assignments or reduce pack usage."
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"deploymentId": "prod-sensor",
|
|
24
|
-
"databaseName": "REPP2",
|
|
25
|
-
"severity": "high",
|
|
26
|
-
"findingType": "processor-license-deficiency",
|
|
27
|
-
"message": "Current processor consumption exceeds the remaining available Enterprise Edition entitlement.",
|
|
28
|
-
"recommendedAction": "Add processor entitlements, reallocate underused licenses, or reduce deployment CPU footprint."
|
|
29
|
-
}
|
|
30
|
-
],
|
|
31
|
-
"recommendations": [
|
|
32
|
-
"Prioritize REPP2 for remediation because it combines the largest CPU footprint with pack usage.",
|
|
33
|
-
"Review whether development environments require Enterprise Edition or can be right-sized.",
|
|
34
|
-
"Use the current deployment map when modeling the AWS target-state license plan."
|
|
35
|
-
]
|
|
36
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
const API_ROOT = path.resolve(fileURLToPath(new URL("../api", import.meta.url)));
|
|
5
|
-
const PAYLOAD_FILES = {
|
|
6
|
-
"deployment-details": path.join(API_ROOT, "entitlement-deployment", "entitlement-deployment"),
|
|
7
|
-
"license-usage-map": path.join(API_ROOT, "entitlement-usage", "entitlement-usage.json"),
|
|
8
|
-
"overall-compliance": path.join(API_ROOT, "entitlement-compliance", "entitlement-compliance.json"),
|
|
9
|
-
};
|
|
10
|
-
export const fakeEntitlementsApiTool = {
|
|
11
|
-
name: "opscompass_oracle_licensing_fake_entitlements",
|
|
12
|
-
label: "read entitlement fixture",
|
|
13
|
-
description: "Read one of the checked-in Oracle entitlement API fixtures.",
|
|
14
|
-
parameters: {
|
|
15
|
-
type: "object",
|
|
16
|
-
properties: {
|
|
17
|
-
payload: { type: "string", enum: Object.keys(PAYLOAD_FILES) },
|
|
18
|
-
showPath: { type: "boolean" },
|
|
19
|
-
},
|
|
20
|
-
required: ["payload"],
|
|
21
|
-
additionalProperties: false,
|
|
22
|
-
},
|
|
23
|
-
async execute(input) {
|
|
24
|
-
const value = input;
|
|
25
|
-
if (!value?.payload || !Object.hasOwn(PAYLOAD_FILES, value.payload))
|
|
26
|
-
throw new Error("invalid entitlement payload");
|
|
27
|
-
const file = PAYLOAD_FILES[value.payload];
|
|
28
|
-
const text = await readFile(file, "utf8");
|
|
29
|
-
return { content: [{ type: "text", text: value.showPath ? `[entitlements] ${file}\n${text}` : text }] };
|
|
30
|
-
},
|
|
31
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { isMainModule } from "../.opscompass-runtime/tools/cli-entrypoint.js";
|
|
5
|
-
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
6
|
-
const API_ROOT = path.join(ROOT, "api");
|
|
7
|
-
export const PAYLOAD_FILES = {
|
|
8
|
-
"deployment-details": path.join(API_ROOT, "entitlement-deployment", "entitlement-deployment"),
|
|
9
|
-
"license-usage-map": path.join(API_ROOT, "entitlement-usage", "entitlement-usage.json"),
|
|
10
|
-
"overall-compliance": path.join(API_ROOT, "entitlement-compliance", "entitlement-compliance.json"),
|
|
11
|
-
};
|
|
12
|
-
function isPayloadName(value) {
|
|
13
|
-
return typeof value === "string" && Object.hasOwn(PAYLOAD_FILES, value);
|
|
14
|
-
}
|
|
15
|
-
function parseArgs(argv) {
|
|
16
|
-
if (!argv.length) {
|
|
17
|
-
throw new Error("the following arguments are required: payload");
|
|
18
|
-
}
|
|
19
|
-
const payload = argv[0];
|
|
20
|
-
let showPath = false;
|
|
21
|
-
for (const flag of argv.slice(1)) {
|
|
22
|
-
if (flag === "--show-path") {
|
|
23
|
-
showPath = true;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
throw new Error(`unrecognized arguments: ${flag}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (!isPayloadName(payload)) {
|
|
30
|
-
throw new Error(`invalid choice: '${payload}' (choose from deployment-details, license-usage-map, overall-compliance)`);
|
|
31
|
-
}
|
|
32
|
-
return { payload, showPath };
|
|
33
|
-
}
|
|
34
|
-
function errorMessage(error) {
|
|
35
|
-
return error instanceof Error ? error.message : String(error);
|
|
36
|
-
}
|
|
37
|
-
function isMissingFileError(error) {
|
|
38
|
-
return error instanceof Error && error.code === "ENOENT";
|
|
39
|
-
}
|
|
40
|
-
export function main(argv = process.argv.slice(2)) {
|
|
41
|
-
try {
|
|
42
|
-
const args = parseArgs(argv);
|
|
43
|
-
const payloadPath = PAYLOAD_FILES[args.payload];
|
|
44
|
-
if (args.showPath) {
|
|
45
|
-
console.error(`[entitlements] ${args.payload} -> ${payloadPath}`);
|
|
46
|
-
}
|
|
47
|
-
let data;
|
|
48
|
-
try {
|
|
49
|
-
data = JSON.parse(readFileSync(payloadPath, "utf8"));
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
if (isMissingFileError(error)) {
|
|
53
|
-
console.error(`Error: missing payload file: ${payloadPath}`);
|
|
54
|
-
return 2;
|
|
55
|
-
}
|
|
56
|
-
if (error instanceof SyntaxError) {
|
|
57
|
-
console.error(`Error: invalid JSON in ${payloadPath}: ${error.message}`);
|
|
58
|
-
return 2;
|
|
59
|
-
}
|
|
60
|
-
throw error;
|
|
61
|
-
}
|
|
62
|
-
console.log(JSON.stringify(data, null, 2));
|
|
63
|
-
return 0;
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
console.error(`Error: ${errorMessage(error)}`);
|
|
67
|
-
return 2;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (isMainModule(import.meta.url)) {
|
|
71
|
-
process.exitCode = main();
|
|
72
|
-
}
|