export type IconikStorageGatewayTelemetrySchema = {error_log_lines?: Array | undefined, host_info?: string | undefined, host_ip?: string | undefined, host_name?: string | undefined, is_leader?: boolean | undefined, log_lines?: Array | undefined, start_last_date?: string | undefined, start_status?: ('SUCCESS' | 'FAILED') | undefined, start_status_message?: string | undefined, status?: ('OFFLINE' | 'LIVE' | 'UNKNOWN' | 'WARNING' | 'ERROR' | 'STOPPED') | undefined, storage_gateway_id?: string | undefined, version?: string | undefined, worker_id: string}; export type CreateApiV1StorageGatewaysStorageGatewayIdTelemetryArgs = {'App-ID': string, 'Auth-Token': string, storage_gateway_id: string, body: IconikStorageGatewayTelemetrySchema}; export type CreateApiV1StorageGatewaysStorageGatewayIdTelemetryOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Create telemetry * * POST /v1/storage_gateways/{storage_gateway_id}/telemetry/ */ export const createApiV1StorageGatewaysStorageGatewayIdTelemetry = async (args: CreateApiV1StorageGatewaysStorageGatewayIdTelemetryArgs, options: CreateApiV1StorageGatewaysStorageGatewayIdTelemetryOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['App-ID'] != null) headers.set("App-ID", String(args['App-ID'])) if (args['Auth-Token'] != null) headers.set("Auth-Token", String(args['Auth-Token'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/storage_gateways/${encodeURIComponent(String(args.storage_gateway_id))}/telemetry/${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 };