export type DeleteApiDekRegistryV1KeksNameArgs = {name: string, permanent?: boolean | undefined}; export type DeleteApiDekRegistryV1KeksNameOptions = {baseUrl?: string | undefined, resourceApiKey?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Delete a kek * * DELETE /dek-registry/v1/keks/{name} * * Also accepts auth: external-access-token */ export const deleteApiDekRegistryV1KeksName = async (args: DeleteApiDekRegistryV1KeksNameArgs, options?: DeleteApiDekRegistryV1KeksNameOptions) => { const {baseUrl = "https://api.confluent.cloud", fetch: fetchFn = fetch, resourceApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.permanent != null) query.append("permanent", String(args.permanent)) if (resourceApiKey !== undefined) headers.set('authorization', `Basic ${btoa(`${resourceApiKey.username}:${resourceApiKey.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/dek-registry/v1/keks/${encodeURIComponent(String(args.name))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };