//native
/**
* List Cluster Kubernetes Events
* List Cluster Kubernetes Events
*/
export async function main(
auth: RT.Qovery,
clusterId: string,
from_date_time: string | undefined,
to_date_time: string | undefined,
node_name?: string | undefined,
pod_name?: string | undefined,
reporting_component?: string | undefined
) {
const url = new URL(`https://api.qovery.com/cluster/${clusterId}/events`)
for (const [k, v] of [
['from_date_time', from_date_time],
['to_date_time', to_date_time],
['node_name', node_name],
['pod_name', pod_name],
['reporting_component', reporting_component]
]) {
if (v !== undefined && v !== '') {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Token ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago