mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 04:51:51 +00:00
Add actions to fetch data from Prowler Hub
This commit is contained in:
committed by
Pepe Fagoaga
parent
788b092dff
commit
6259df4f8c
@@ -0,0 +1,45 @@
|
||||
export const getLighthouseProviderChecks = async ({
|
||||
providerType,
|
||||
service,
|
||||
severity,
|
||||
compliances,
|
||||
}: {
|
||||
providerType: string;
|
||||
service: string[];
|
||||
severity: string[];
|
||||
compliances: string[];
|
||||
}) => {
|
||||
const url = new URL(
|
||||
`https://hub.prowler.com/api/check?fields=id&providers=${providerType}`,
|
||||
);
|
||||
if (service) {
|
||||
url.searchParams.append("services", service.join(","));
|
||||
}
|
||||
if (severity) {
|
||||
url.searchParams.append("severities", severity.join(","));
|
||||
}
|
||||
if (compliances) {
|
||||
url.searchParams.append("compliances", compliances.join(","));
|
||||
}
|
||||
|
||||
const response = await fetch(url.toString(), {
|
||||
method: "GET",
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
const ids = data.map((item: { id: string }) => item.id);
|
||||
return ids;
|
||||
};
|
||||
|
||||
export const getLighthouseCheckDetails = async ({
|
||||
checkId,
|
||||
}: {
|
||||
checkId: string;
|
||||
}) => {
|
||||
const url = new URL(`https://hub.prowler.com/api/check/${checkId}`);
|
||||
const response = await fetch(url.toString(), {
|
||||
method: "GET",
|
||||
});
|
||||
const data = await response.json();
|
||||
return data;
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
export const getLighthouseComplianceFrameworks = async (
|
||||
provider_type: string,
|
||||
) => {
|
||||
const url = new URL(
|
||||
`https://hub.prowler.com/api/compliance?fields=id&provider=${provider_type}`,
|
||||
);
|
||||
const response = await fetch(url.toString(), {
|
||||
method: "GET",
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
const frameworks = data.map((item: { id: string }) => item.id);
|
||||
return frameworks;
|
||||
};
|
||||
Reference in New Issue
Block a user