export type EntitiesHealthScore = {score?: number | undefined, category?: ('good' | 'bad' | 'moderate') | undefined}; export type EntitiesHealthState = {state?: ('GOOD' | 'MODERATE' | 'AT_RISK' | 'DEGRADED' | 'BAD' | 'UNKNOWN' | 'DISABLED' | null) | undefined}; export type EntitiesEntity = {id: string, type: string, name?: string | undefined, displayName?: (string | null) | undefined, createdTime?: string | undefined, updatedTime?: string | undefined, lastSeenTime: string, inMaintenance: boolean, healthscore?: EntitiesHealthScore | undefined, healthState?: EntitiesHealthState | undefined, tags: {[key: string]: string | null}, attributes?: {[key: string]: unknown} | undefined}; export type UpdateApiV1EntitiesIdArgs = {id: string, body: EntitiesEntity}; export type UpdateApiV1EntitiesIdOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update an entity by ID * * PUT /v1/entities/{id} */ export const updateApiV1EntitiesId = async (args: UpdateApiV1EntitiesIdArgs, options?: UpdateApiV1EntitiesIdOptions) => { const {baseUrl = "https://api.na-01.cloud.solarwinds.com", 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(/\/+$/, '')}/v1/entities/${encodeURIComponent(String(args.id))}${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 };