//native
type Digitalocean = {
token: string;
};
/**
* Update SQL Mode for a Cluster
* To configure the SQL modes for an existing MySQL cluster, send a PUT request to `/v2/databases/$DATABASE_ID/sql_mode` specifying the desired modes. See the official MySQL 8 documentation for a [full list of supported SQL modes](https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sql-mode-full).
A successful request will receive a 204 No Content status code with no body in response.
*/
export async function main(
auth: Digitalocean,
database_cluster_uuid: string,
body: { sql_mode: string },
) {
const url = new URL(
`https://api.digitalocean.com/v2/databases/${database_cluster_uuid}/sql_mode`,
);
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 537 days ago