//native
type Render = {
apiKey: string
}
/**
* Create or update metrics stream
* Creates or updates the metrics stream for the specified workspace.
*/
export async function main(
auth: Render,
ownerId: string,
body: {
provider?: 'BETTER_STACK' | 'GRAFANA' | 'DATADOG' | 'NEW_RELIC' | 'HONEYCOMB' | 'CUSTOM'
url?: string
token?: string
}
) {
const url = new URL(`https://api.render.com/v1/metrics-stream/${ownerId}`)
const response = await fetch(url, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
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