export type WarehouseAssignment = {user: string, type: 'ownership'} | {role: string, type: 'ownership'} | {user: string, type: 'pass_grants'} | {role: string, type: 'pass_grants'} | {user: string, type: 'manage_grants'} | {role: string, type: 'manage_grants'} | {user: string, type: 'describe'} | {role: string, type: 'describe'} | {user: string, type: 'select'} | {role: string, type: 'select'} | {user: string, type: 'create'} | {role: string, type: 'create'} | {user: string, type: 'modify'} | {role: string, type: 'modify'}; export type UpdateWarehouseAssignmentsRequest = {deletes?: Array | undefined, writes?: Array | undefined}; export type CreateApiManagementV1PermissionsWarehouseWarehouseIdAssignmentsArgs = {warehouse_id: string, body: UpdateWarehouseAssignmentsRequest}; export type CreateApiManagementV1PermissionsWarehouseWarehouseIdAssignmentsOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update permissions for a warehouse * * POST /management/v1/permissions/warehouse/{warehouse_id}/assignments */ export const createApiManagementV1PermissionsWarehouseWarehouseIdAssignments = async (args: CreateApiManagementV1PermissionsWarehouseWarehouseIdAssignmentsArgs, options?: CreateApiManagementV1PermissionsWarehouseWarehouseIdAssignmentsOptions) => { const {baseUrl = "https://localhost", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/management/v1/permissions/warehouse/${encodeURIComponent(String(args.warehouse_id))}/assignments${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 };