( apiPath: string, resource: T, )
| 88 | |
| 89 | /** Update (PUT) a resource. */ |
| 90 | export async function k8sUpdate<T extends K8sResource>( |
| 91 | apiPath: string, |
| 92 | resource: T, |
| 93 | ): Promise<T> { |
| 94 | const res = await fetch(`${apiBase()}${apiPath}`, { |
| 95 | method: "PUT", |
| 96 | headers: { ...headers(), "Content-Type": "application/json" }, |
| 97 | body: JSON.stringify(resource), |
| 98 | }); |
| 99 | return handleResponse(res); |
| 100 | } |
| 101 | |
| 102 | /** Patch a resource (strategic merge patch by default). */ |
| 103 | export async function k8sPatch<T extends K8sResource>( |
no test coverage detected