/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 9c7bec905991 */ import * as z from "zod/v4"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import * as models from "../index.js"; export type CreateAccessRequestGlobals = { /** * Workspace name. Platform API keys already select a workspace; other authentication methods can configure it once on the SDK client. */ workspace?: string | undefined; }; export const CreateAccessRequestRequesterKind = { User: "user", ServiceAccount: "serviceAccount", } as const; export type CreateAccessRequestRequesterKind = ClosedEnum< typeof CreateAccessRequestRequesterKind >; export type CreateAccessRequestDeployment = { id: string; name: string; deploymentGroup?: models.DeploymentGroupInfo | undefined; }; /** * How risky an operation is (declared by the plugin metadata). */ export const CreateAccessRequestTier = { ReadOnly: "read-only", Mutating: "mutating", Destructive: "destructive", } as const; /** * How risky an operation is (declared by the plugin metadata). */ export type CreateAccessRequestTier = ClosedEnum< typeof CreateAccessRequestTier >; export type CreateAccessRequestCommand = { command: string; summary: string; params?: any | null | undefined; /** * How risky an operation is (declared by the plugin metadata). */ tier?: CreateAccessRequestTier | undefined; }; /** * How risky an operation is (declared by the plugin metadata). */ export const CreateAccessRequestMaxRisk = { ReadOnly: "read-only", Mutating: "mutating", Destructive: "destructive", } as const; /** * How risky an operation is (declared by the plugin metadata). */ export type CreateAccessRequestMaxRisk = ClosedEnum< typeof CreateAccessRequestMaxRisk >; /** * The created access request. */ export type CreateAccessRequestResponse = { id: string; requesterKind: CreateAccessRequestRequesterKind | null; requesterId: string | null; requestedExpiresAt: string | null; deploymentId: string; deployment?: CreateAccessRequestDeployment | undefined; remediationPlanId: string | null; title: string; reason: string | null; commands: Array; operationPattern: string | null; /** * How risky an operation is (declared by the plugin metadata). */ maxRisk: CreateAccessRequestMaxRisk | null; status: models.AccessRequestStatus; approvedUntil: string | null; }; /** @internal */ export const CreateAccessRequestRequesterKind$inboundSchema: z.ZodEnum< typeof CreateAccessRequestRequesterKind > = z.enum(CreateAccessRequestRequesterKind); /** @internal */ export const CreateAccessRequestDeployment$inboundSchema: z.ZodType< CreateAccessRequestDeployment, unknown > = z.object({ id: z.string(), name: z.string(), deploymentGroup: models.DeploymentGroupInfo$inboundSchema.optional(), }); export function createAccessRequestDeploymentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateAccessRequestDeployment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAccessRequestDeployment' from JSON`, ); } /** @internal */ export const CreateAccessRequestTier$inboundSchema: z.ZodEnum< typeof CreateAccessRequestTier > = z.enum(CreateAccessRequestTier); /** @internal */ export const CreateAccessRequestCommand$inboundSchema: z.ZodType< CreateAccessRequestCommand, unknown > = z.object({ command: z.string(), summary: z.string(), params: z.nullable(z.any()).optional(), tier: CreateAccessRequestTier$inboundSchema.optional(), }); export function createAccessRequestCommandFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateAccessRequestCommand$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAccessRequestCommand' from JSON`, ); } /** @internal */ export const CreateAccessRequestMaxRisk$inboundSchema: z.ZodEnum< typeof CreateAccessRequestMaxRisk > = z.enum(CreateAccessRequestMaxRisk); /** @internal */ export const CreateAccessRequestResponse$inboundSchema: z.ZodType< CreateAccessRequestResponse, unknown > = z.object({ id: z.string(), requesterKind: z.nullable(CreateAccessRequestRequesterKind$inboundSchema), requesterId: z.nullable(z.string()), requestedExpiresAt: z.nullable(z.string()), deploymentId: z.string(), deployment: z.lazy(() => CreateAccessRequestDeployment$inboundSchema) .optional(), remediationPlanId: z.nullable(z.string()), title: z.string(), reason: z.nullable(z.string()), commands: z.array(z.lazy(() => CreateAccessRequestCommand$inboundSchema)), operationPattern: z.nullable(z.string()), maxRisk: z.nullable(CreateAccessRequestMaxRisk$inboundSchema), status: models.AccessRequestStatus$inboundSchema, approvedUntil: z.nullable(z.string()), }); export function createAccessRequestResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateAccessRequestResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAccessRequestResponse' from JSON`, ); }