/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 8919bebcd77f */ import * as z from "zod/v4"; import { ClosedEnum } from "../types/enums.js"; /** * 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; }; /** * Required with `operationPattern`: the highest risk tier the wildcard grant may cover. */ export const CreateAccessRequestMaxRisk = { ReadOnly: "read-only", Mutating: "mutating", Destructive: "destructive", } as const; /** * Required with `operationPattern`: the highest risk tier the wildcard grant may cover. */ export type CreateAccessRequestMaxRisk = ClosedEnum< typeof CreateAccessRequestMaxRisk >; export type CreateAccessRequest = { /** * Durable replay key scoped to the authenticated requester and workspace. Reusing it with a different validated payload returns ACCESS_REQUEST_REPLAY_MISMATCH. */ replayKey?: string | undefined; /** * Absolute requester deadline in UTC (Z suffix). Must be in the future and at most six hours ahead (30 seconds clock-skew tolerance). Approvals never extend it. Omit for legacy approval-window behavior. */ requestedExpiresAt?: Date | undefined; deploymentId: string; /** * Set for a plan-backed (ai-agent) request. Omit for a plan-less (CLI) request. */ remediationPlanId?: string | undefined; /** * Required for a plan-backed request; defaults to the operation/pattern for a plan-less one. */ title?: string | undefined; reason?: string | undefined; /** * Plan-backed only: the exact commands the investigation is requesting. */ commands?: Array | undefined; /** * Plan-less, exact request: a single `plugin/operation`. */ operation?: string | undefined; /** * Plan-less, wildcard request: `plugin/*`. Requires `maxRisk`. */ operationPattern?: string | undefined; /** * Params for an exact `operation` request. */ params?: any | null | undefined; /** * Required with `operationPattern`: the highest risk tier the wildcard grant may cover. */ maxRisk?: CreateAccessRequestMaxRisk | undefined; }; /** @internal */ export const CreateAccessRequestTier$outboundSchema: z.ZodEnum< typeof CreateAccessRequestTier > = z.enum(CreateAccessRequestTier); /** @internal */ export type CreateAccessRequestCommand$Outbound = { command: string; summary: string; params?: any | null | undefined; tier?: string | undefined; }; /** @internal */ export const CreateAccessRequestCommand$outboundSchema: z.ZodType< CreateAccessRequestCommand$Outbound, CreateAccessRequestCommand > = z.object({ command: z.string(), summary: z.string(), params: z.nullable(z.any()).optional(), tier: CreateAccessRequestTier$outboundSchema.optional(), }); export function createAccessRequestCommandToJSON( createAccessRequestCommand: CreateAccessRequestCommand, ): string { return JSON.stringify( CreateAccessRequestCommand$outboundSchema.parse(createAccessRequestCommand), ); } /** @internal */ export const CreateAccessRequestMaxRisk$outboundSchema: z.ZodEnum< typeof CreateAccessRequestMaxRisk > = z.enum(CreateAccessRequestMaxRisk); /** @internal */ export type CreateAccessRequest$Outbound = { replayKey?: string | undefined; requestedExpiresAt?: string | undefined; deploymentId: string; remediationPlanId?: string | undefined; title?: string | undefined; reason?: string | undefined; commands?: Array | undefined; operation?: string | undefined; operationPattern?: string | undefined; params?: any | null | undefined; maxRisk?: string | undefined; }; /** @internal */ export const CreateAccessRequest$outboundSchema: z.ZodType< CreateAccessRequest$Outbound, CreateAccessRequest > = z.object({ replayKey: z.string().optional(), requestedExpiresAt: z.date().transform(v => v.toISOString()).optional(), deploymentId: z.string(), remediationPlanId: z.string().optional(), title: z.string().optional(), reason: z.string().optional(), commands: z.array(z.lazy(() => CreateAccessRequestCommand$outboundSchema)) .optional(), operation: z.string().optional(), operationPattern: z.string().optional(), params: z.nullable(z.any()).optional(), maxRisk: CreateAccessRequestMaxRisk$outboundSchema.optional(), }); export function createAccessRequestToJSON( createAccessRequest: CreateAccessRequest, ): string { return JSON.stringify( CreateAccessRequest$outboundSchema.parse(createAccessRequest), ); }