//native
type Linode = {
token: string;
};
/**
* Update a PostgreSQL Managed Database
* Make changes to an existing PostgreSQL Managed Database.
*/
export async function main(
auth: Linode,
apiVersion: "v4" | "v4beta",
instanceId: string,
body: {
allow_list?: string[];
label?: string;
type?: string;
updates?: {
day_of_week?: number;
duration?: number;
frequency?: "weekly";
hour_of_day?: number;
pending?: {
deadline?: string;
description?: string;
planned_for?: string;
}[];
};
version?: string;
},
) {
const url = new URL(
`https://api.linode.com/${apiVersion}/databases/postgresql/instances/${instanceId}`,
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago