import {z} from 'zod' export type KubernetesCostAllocationV1QuerySchema = {projectId?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array}) | undefined, kubernetesClusterId?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array}) | undefined, clusterName?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array} | {_type: 'EqualToOrNull', value: string} | {_type: 'Search', value: string}) | undefined, k8sClusterEntityKey?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array} | {_type: 'EqualToOrNull', value: string} | {_type: 'Search', value: string}) | undefined, windowStart?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: string} | {_type: 'GreaterThanOrEqual', value: string} | {_type: 'LessThan', value: string} | {_type: 'LessThanOrEqual', value: string} | {_type: 'InBetween', startValue: string, endValue: string}) | undefined, windowEnd?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: string} | {_type: 'GreaterThanOrEqual', value: string} | {_type: 'LessThan', value: string} | {_type: 'LessThanOrEqual', value: string} | {_type: 'InBetween', startValue: string, endValue: string}) | undefined, namespace?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array} | {_type: 'EqualToOrNull', value: string} | {_type: 'Search', value: string}) | undefined, controllerKind?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array} | {_type: 'EqualToOrNull', value: string} | {_type: 'Search', value: string}) | undefined, controllerName?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array} | {_type: 'EqualToOrNull', value: string} | {_type: 'Search', value: string}) | undefined, podName?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array} | {_type: 'EqualToOrNull', value: string} | {_type: 'Search', value: string}) | undefined, containerName?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array} | {_type: 'EqualToOrNull', value: string} | {_type: 'Search', value: string}) | undefined, nodeName?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array} | {_type: 'EqualToOrNull', value: string} | {_type: 'Search', value: string}) | undefined, providerId?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array} | {_type: 'EqualToOrNull', value: string} | {_type: 'Search', value: string}) | undefined, labels?: ({[key: string]: string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Search', value: string}}) | undefined, labelKeys?: ({_type: 'EqualTo', value: string} | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array} | {_type: 'Search', value: string}) | undefined, cpuCoreHours?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, cpuCoreRequestAverage?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, cpuCoreUsageAverage?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, cpuCoreLimitAverage?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, cpuCost?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, gpuHours?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, gpuCost?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, ramByteHours?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, ramBytesRequestAverage?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, ramBytesUsageAverage?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, ramBytesLimitAverage?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, ramBytesUsageMax?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, ramCost?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, pvByteHours?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, pvCost?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, networkCost?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, loadBalancerCost?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, sharedCost?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, externalCost?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, totalCost?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, cpuEfficiency?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, ramEfficiency?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, totalEfficiency?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, currency?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array} | {_type: 'EqualToOrNull', value: string} | {_type: 'Search', value: string}) | undefined, shipmentId?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array} | {_type: 'EqualToOrNull', value: string} | {_type: 'Search', value: string}) | undefined, shipmentChunk?: (number | {_type: 'NotEqual', value: number} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: number} | {_type: 'GreaterThanOrEqual', value: number} | {_type: 'LessThan', value: number} | {_type: 'LessThanOrEqual', value: number} | {_type: 'InBetween', startValue: number, endValue: number}) | undefined, _id?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'Includes', value: Array}) | undefined, createdAt?: (string | {_type: 'NotEqual', value: string} | {_type: 'IsNull'} | {_type: 'NotNull'} | {_type: 'GreaterThan', value: string} | {_type: 'GreaterThanOrEqual', value: string} | {_type: 'LessThan', value: string} | {_type: 'LessThanOrEqual', value: string} | {_type: 'InBetween', startValue: string, endValue: string}) | undefined}; export type KubernetesCostAllocationV1SelectSchema = {projectId?: boolean | undefined, kubernetesClusterId?: boolean | undefined, clusterName?: boolean | undefined, k8sClusterEntityKey?: boolean | undefined, windowStart?: boolean | undefined, windowEnd?: boolean | undefined, namespace?: boolean | undefined, controllerKind?: boolean | undefined, controllerName?: boolean | undefined, podName?: boolean | undefined, containerName?: boolean | undefined, nodeName?: boolean | undefined, providerId?: boolean | undefined, labels?: boolean | undefined, labelKeys?: boolean | undefined, cpuCoreHours?: boolean | undefined, cpuCoreRequestAverage?: boolean | undefined, cpuCoreUsageAverage?: boolean | undefined, cpuCoreLimitAverage?: boolean | undefined, cpuCost?: boolean | undefined, gpuHours?: boolean | undefined, gpuCost?: boolean | undefined, ramByteHours?: boolean | undefined, ramBytesRequestAverage?: boolean | undefined, ramBytesUsageAverage?: boolean | undefined, ramBytesLimitAverage?: boolean | undefined, ramBytesUsageMax?: boolean | undefined, ramCost?: boolean | undefined, pvByteHours?: boolean | undefined, pvCost?: boolean | undefined, networkCost?: boolean | undefined, loadBalancerCost?: boolean | undefined, sharedCost?: boolean | undefined, externalCost?: boolean | undefined, totalCost?: boolean | undefined, cpuEfficiency?: boolean | undefined, ramEfficiency?: boolean | undefined, totalEfficiency?: boolean | undefined, currency?: boolean | undefined, shipmentId?: boolean | undefined, shipmentChunk?: boolean | undefined, _id?: boolean | undefined, createdAt?: boolean | undefined}; export type KubernetesCostAllocationV1SortSchema = {projectId?: ('ASC' | 'DESC') | undefined, kubernetesClusterId?: ('ASC' | 'DESC') | undefined, clusterName?: ('ASC' | 'DESC') | undefined, k8sClusterEntityKey?: ('ASC' | 'DESC') | undefined, windowStart?: ('ASC' | 'DESC') | undefined, windowEnd?: ('ASC' | 'DESC') | undefined, namespace?: ('ASC' | 'DESC') | undefined, controllerKind?: ('ASC' | 'DESC') | undefined, controllerName?: ('ASC' | 'DESC') | undefined, podName?: ('ASC' | 'DESC') | undefined, containerName?: ('ASC' | 'DESC') | undefined, nodeName?: ('ASC' | 'DESC') | undefined, providerId?: ('ASC' | 'DESC') | undefined, cpuCoreHours?: ('ASC' | 'DESC') | undefined, cpuCoreRequestAverage?: ('ASC' | 'DESC') | undefined, cpuCoreUsageAverage?: ('ASC' | 'DESC') | undefined, cpuCoreLimitAverage?: ('ASC' | 'DESC') | undefined, cpuCost?: ('ASC' | 'DESC') | undefined, gpuHours?: ('ASC' | 'DESC') | undefined, gpuCost?: ('ASC' | 'DESC') | undefined, ramByteHours?: ('ASC' | 'DESC') | undefined, ramBytesRequestAverage?: ('ASC' | 'DESC') | undefined, ramBytesUsageAverage?: ('ASC' | 'DESC') | undefined, ramBytesLimitAverage?: ('ASC' | 'DESC') | undefined, ramBytesUsageMax?: ('ASC' | 'DESC') | undefined, ramCost?: ('ASC' | 'DESC') | undefined, pvByteHours?: ('ASC' | 'DESC') | undefined, pvCost?: ('ASC' | 'DESC') | undefined, networkCost?: ('ASC' | 'DESC') | undefined, loadBalancerCost?: ('ASC' | 'DESC') | undefined, sharedCost?: ('ASC' | 'DESC') | undefined, externalCost?: ('ASC' | 'DESC') | undefined, totalCost?: ('ASC' | 'DESC') | undefined, cpuEfficiency?: ('ASC' | 'DESC') | undefined, ramEfficiency?: ('ASC' | 'DESC') | undefined, totalEfficiency?: ('ASC' | 'DESC') | undefined, currency?: ('ASC' | 'DESC') | undefined, shipmentId?: ('ASC' | 'DESC') | undefined, shipmentChunk?: ('ASC' | 'DESC') | undefined, retentionDate?: ('ASC' | 'DESC') | undefined, _id?: ('ASC' | 'DESC') | undefined, createdAt?: ('ASC' | 'DESC') | undefined}; export type KubernetesCostAllocationV1GroupBySchema = {projectId?: boolean | undefined, kubernetesClusterId?: boolean | undefined, clusterName?: boolean | undefined, k8sClusterEntityKey?: boolean | undefined, namespace?: boolean | undefined, controllerKind?: boolean | undefined, controllerName?: boolean | undefined, podName?: boolean | undefined, containerName?: boolean | undefined, nodeName?: boolean | undefined, providerId?: boolean | undefined, currency?: boolean | undefined, shipmentId?: boolean | undefined, shipmentChunk?: boolean | undefined, _id?: boolean | undefined, createdAt?: boolean | undefined}; export type CreateApiKubernetesCostAllocationGetListArgs = {body: {query?: KubernetesCostAllocationV1QuerySchema | undefined, select?: KubernetesCostAllocationV1SelectSchema | undefined, sort?: KubernetesCostAllocationV1SortSchema | undefined, groupBy?: KubernetesCostAllocationV1GroupBySchema | undefined, limit?: number | undefined, skip?: number | undefined}}; export type CreateApiKubernetesCostAllocationGetListOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; export const kubernetesCostAllocationV1 = z.object({projectId: z.string(), kubernetesClusterId: z.string(), clusterName: z.string(), k8sClusterEntityKey: z.string().optional(), windowStart: z.string().optional(), windowEnd: z.string().optional(), namespace: z.string().optional(), controllerKind: z.string().optional(), controllerName: z.string().optional(), podName: z.string().optional(), containerName: z.string().optional(), nodeName: z.string().optional(), providerId: z.string().optional(), labels: z.string().optional(), labelKeys: z.array(z.string()).optional(), cpuCoreHours: z.number().optional(), cpuCoreRequestAverage: z.number().optional(), cpuCoreUsageAverage: z.number().optional(), cpuCoreLimitAverage: z.number().optional(), cpuCost: z.number().optional(), gpuHours: z.number().optional(), gpuCost: z.number().optional(), ramByteHours: z.number().optional(), ramBytesRequestAverage: z.number().optional(), ramBytesUsageAverage: z.number().optional(), ramBytesLimitAverage: z.number().optional(), ramBytesUsageMax: z.number().optional(), ramCost: z.number().optional(), pvByteHours: z.number().optional(), pvCost: z.number().optional(), networkCost: z.number().optional(), loadBalancerCost: z.number().optional(), sharedCost: z.number().optional(), externalCost: z.number().optional(), totalCost: z.number().optional(), cpuEfficiency: z.number().optional(), ramEfficiency: z.number().optional(), totalEfficiency: z.number().optional(), currency: z.string().optional(), shipmentId: z.string().optional(), shipmentChunk: z.number().optional()}); export const createApiKubernetesCostAllocationGetListResponse = z.object({data: z.array(kubernetesCostAllocationV1).optional(), count: z.number().optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * List Kubernetes Cost Allocation * * POST /kubernetes-cost-allocation/get-list */ export const createApiKubernetesCostAllocationGetList = async (args: CreateApiKubernetesCostAllocationGetListArgs, options?: CreateApiKubernetesCostAllocationGetListOptions) => { const {baseUrl = "https://oneuptime.com/api", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (ApiKey !== undefined) headers.set("APIKey", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/kubernetes-cost-allocation/get-list${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 validateResponse(createApiKubernetesCostAllocationGetListResponse, await res.json()) };