//native
/**
* Get topology path
* Run a path analysis between a source and a destination: SecureTrack returns the devices the traffic crosses and whether it is allowed.
*/
export async function main(
auth: RT.TufinSecuretrack,
src: string,
dst: string,
service: string | undefined
) {
const base = auth.base_url.replace(/\/+$/, "")
const url = new URL(`${base}/securetrack/api/topology/path`)
url.searchParams.append("src", src)
url.searchParams.append("dst", dst)
url.searchParams.append("service", service || "Any")
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: `Basic ${btoa(`${auth.username}:${auth.password}`)}`,
Accept: "application/json",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 6 hours ago