export type DeleteApiDekRegistryV1KeksNameDeksSubjectArgs = {name: string, subject: string, algorithm?: ('AES128_GCM' | 'AES256_GCM' | 'AES256_SIV') | undefined, permanent?: boolean | undefined}; export type DeleteApiDekRegistryV1KeksNameDeksSubjectOptions = {baseUrl?: string | undefined, resourceApiKey?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Delete all versions of a dek * * DELETE /dek-registry/v1/keks/{name}/deks/{subject} * * Also accepts auth: external-access-token */ export const deleteApiDekRegistryV1KeksNameDeksSubject = async (args: DeleteApiDekRegistryV1KeksNameDeksSubjectArgs, options?: DeleteApiDekRegistryV1KeksNameDeksSubjectOptions) => { const {baseUrl = "https://api.confluent.cloud", fetch: fetchFn = fetch, resourceApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.algorithm != null) query.append("algorithm", String(args.algorithm)) 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))}/deks/${encodeURIComponent(String(args.subject))}${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 };