export type AlterConfigBatchRequestData = {data: Array<{name: string, value?: (string | null) | undefined, operation?: (string | null) | undefined}>, validate_only?: boolean | undefined}; export type CreateApiKafkaV3ClustersClusterIdGroupsGroupIdConfigsAlterArgs = {validate_only?: boolean | undefined, body: AlterConfigBatchRequestData}; export type CreateApiKafkaV3ClustersClusterIdGroupsGroupIdConfigsAlterOptions = {baseUrl?: string | undefined, resourceApiKey?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Batch Alter Group Configs * * POST /kafka/v3/clusters/{cluster_id}/groups/{group_id}/configs:alter * * Also accepts auth: external-access-token */ export const createApiKafkaV3ClustersClusterIdGroupsGroupIdConfigsAlter = async (args: CreateApiKafkaV3ClustersClusterIdGroupsGroupIdConfigsAlterArgs, options?: CreateApiKafkaV3ClustersClusterIdGroupsGroupIdConfigsAlterOptions) => { const {baseUrl = "https://api.confluent.cloud", fetch: fetchFn = fetch, resourceApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.validate_only != null) query.append("validate_only", String(args.validate_only)) if (resourceApiKey !== undefined) headers.set('authorization', `Basic ${btoa(`${resourceApiKey.username}:${resourceApiKey.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/kafka/v3/clusters/${encodeURIComponent(String(args.cluster_id))}/groups/${encodeURIComponent(String(args.group_id))}/configs:alter${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };