//native
type Digitalocean = {
token: string;
};
/**
* List All Actions for a Floating IP
* To retrieve all actions that have been executed on a floating IP, send a GET request to `/v2/floating_ips/$FLOATING_IP/actions`.
*/
export async function main(auth: Digitalocean, floating_ip: string) {
const url = new URL(
`https://api.digitalocean.com/v2/floating_ips/${floating_ip}/actions`,
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 536 days ago