export type S3BackupCredentials = {accessKeyId?: string | undefined, secretAccessKey?: string | undefined}; export type BackupCredentials = {s3?: S3BackupCredentials | undefined}; export type BcBody = {backup_credentials?: BackupCredentials | undefined}; export type UpdateApiApiV2SeedsSeedNameBackupcredentialsArgs = {seed_name: string, body: BcBody}; export type UpdateApiApiV2SeedsSeedNameBackupcredentialsOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Creates or updates backup credentials for a given seed * * PUT /api/v2/seeds/{seed_name}/backupcredentials */ export const updateApiApiV2SeedsSeedNameBackupcredentials = async (args: UpdateApiApiV2SeedsSeedNameBackupcredentialsArgs, options: UpdateApiApiV2SeedsSeedNameBackupcredentialsOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/seeds/${encodeURIComponent(String(args.seed_name))}/backupcredentials${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };