import {z} from 'zod' export type GetApiV1NamespacesTenantMetaNamespaceAuthenticationLogsUuidArgs = {'tenant_meta.namespace': string, uuid: string, 'get_parameters.mask'?: string | undefined}; export type GetApiV1NamespacesTenantMetaNamespaceAuthenticationLogsUuidOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; export const v1IndexData = z.object({data: z.array(z.string()).optional(), search_score: z.number().optional(), tenant: z.string().optional(), will_be_deleted_at: z.string().optional()}); export const googleprotobufAny = z.object({"@type": z.string().optional()}).and(z.record(z.string(), z.unknown())); export const v1Meta = z.object({annotations: z.record(z.string(), z.string()).optional(), create_time: z.string().optional(), created_by: z.string().optional(), description: z.string().optional(), index_data: v1IndexData.optional(), kind: z.string().optional(), name: z.string(), parent_kind: z.string().optional(), parent_uuid: z.string().optional(), references: z.record(z.string(), googleprotobufAny).optional(), tags: z.array(z.string()).optional(), update_time: z.string().optional(), updated_by: z.string().optional(), upsert_time: z.string().optional(), version: z.string().optional()}); export const v1AuthenticationLogSpec = z.object({authorized_tenants: z.array(z.string()).optional(), claims: z.array(z.string()).optional(), error_message: z.string().optional(), remote_address: z.string().optional(), status: z.number().int().optional(), success: z.boolean().optional(), uri: z.string().optional()}); export const v1TenantMeta = z.object({namespace: z.string()}); export const v1AuthenticationLog = z.object({meta: v1Meta, spec: v1AuthenticationLogSpec, tenant_meta: v1TenantMeta.optional(), uuid: z.string().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 }; /** * GetAuthenticationLog * * GET /v1/namespaces/{tenant_meta.namespace}/authentication-logs/{uuid} */ export const getApiV1NamespacesTenantMetaNamespaceAuthenticationLogsUuid = async (args: GetApiV1NamespacesTenantMetaNamespaceAuthenticationLogsUuidArgs, options?: GetApiV1NamespacesTenantMetaNamespaceAuthenticationLogsUuidOptions) => { const {baseUrl = "https://api.endorlabs.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args['get_parameters.mask'] != null) query.append("get_parameters.mask", String(args['get_parameters.mask'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/namespaces/${encodeURIComponent(String(args['tenant_meta.namespace']))}/authentication-logs/${encodeURIComponent(String(args.uuid))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(v1AuthenticationLog, await res.json()) };