export type DeleteApiPublicV1ClustersClusterNameServiceAccountsAivenAivenSAUsernameArgs = {clusterName: string, aivenSAUsername: string}; export type DeleteApiPublicV1ClustersClusterNameServiceAccountsAivenAivenSAUsernameOptions = {baseUrl: string, httpAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete an Aiven service account * * DELETE /public/v1/clusters/{clusterName}/service-accounts-aiven/{aivenSAUsername} */ export const deleteApiPublicV1ClustersClusterNameServiceAccountsAivenAivenSAUsername = async (args: DeleteApiPublicV1ClustersClusterNameServiceAccountsAivenAivenSAUsernameArgs, options: DeleteApiPublicV1ClustersClusterNameServiceAccountsAivenAivenSAUsernameOptions) => { const {baseUrl, fetch: fetchFn = fetch, httpAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (httpAuth !== undefined) headers.set('authorization', `Bearer ${httpAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/public/v1/clusters/${encodeURIComponent(String(args.clusterName))}/service-accounts-aiven/${encodeURIComponent(String(args.aivenSAUsername))}${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 };