//native
type Digitalocean = {
token: string;
};
/**
* Retrieve an Existing Database Cluster Configuration
* Shows configuration parameters for an existing database cluster by sending a GET request to
`/v2/databases/$DATABASE_ID/config`.
The response is a JSON object with a `config` key, which is set to an object
containing any database configuration parameters.
*/
export async function main(auth: Digitalocean, database_cluster_uuid: string) {
const url = new URL(
`https://api.digitalocean.com/v2/databases/${database_cluster_uuid}/config`,
);
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 537 days ago