0

List revisions

by
Published today

List the policy revisions SecureTrack recorded for a device.

Script tufin_securetrack Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 6 hours ago
1
//native
2

3
/**
4
 * List revisions
5
 * List the policy revisions SecureTrack recorded for a device. Get the device ID from List devices.
6
 */
7
export async function main(auth: RT.TufinSecuretrack, device_id: number) {
8
  const base = auth.base_url.replace(/\/+$/, "")
9
  const url = new URL(`${base}/securetrack/api/devices/${device_id}/revisions`)
10

11
  const response = await fetch(url, {
12
    method: "GET",
13
    headers: {
14
      Authorization: `Basic ${btoa(`${auth.username}:${auth.password}`)}`,
15
      Accept: "application/json",
16
    },
17
  })
18

19
  if (!response.ok) {
20
    throw new Error(`${response.status} ${await response.text()}`)
21
  }
22

23
  return await response.json()
24
}
25