/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: c320b24261b5 */ import * as z from "zod/v4"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; import { Role, Role$inboundSchema } from "./role.js"; import { SubjectScope, SubjectScope$inboundSchema } from "./subjectscope.js"; /** * Authenticated service account subject with scoped permissions (workspace, project, or deployment level) */ export type ServiceAccountSubject = { /** * Subject type identifier */ kind: "serviceAccount"; /** * Unique service account identifier (API key ID) */ id: string; /** * ID of the workspace the service account belongs to */ workspaceId: string; /** * Name of the workspace the service account belongs to */ workspaceName?: string | undefined; /** * Authorization scope defining what resources this service account can access */ scope: SubjectScope; /** * Role defining what actions this service account can perform within its scope */ role: Role; }; /** @internal */ export const ServiceAccountSubject$inboundSchema: z.ZodType< ServiceAccountSubject, unknown > = z.object({ kind: z.literal("serviceAccount"), id: z.string(), workspaceId: z.string(), workspaceName: z.string().optional(), scope: SubjectScope$inboundSchema, role: Role$inboundSchema, }); export function serviceAccountSubjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ServiceAccountSubject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ServiceAccountSubject' from JSON`, ); }