export type DeleteApiStackAdminconfigV2RolesRoleNameArgs = {stack: string, roleName: string}; export type DeleteApiStackAdminconfigV2RolesRoleNameOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * delete a specific role * * DELETE /{stack}/adminconfig/v2/roles/{roleName} */ export const deleteApiStackAdminconfigV2RolesRoleName = async (args: DeleteApiStackAdminconfigV2RolesRoleNameArgs, options: DeleteApiStackAdminconfigV2RolesRoleNameOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/${encodeURIComponent(String(args.stack))}/adminconfig/v2/roles/${encodeURIComponent(String(args.roleName))}${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 };