/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 68436ab98d38 */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; 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 DenyAccessRequestGlobals = { /** * Workspace name. Platform API keys already select a workspace; other authentication methods can configure it once on the SDK client. */ workspace?: string | undefined; }; export type DenyAccessRequestRequestBody = { method: string; /** * Deprecated and ignored. Actor identity comes from the authenticated user. */ actorId?: string | undefined; source?: { [k: string]: any | null } | undefined; }; export type DenyAccessRequestRequest = { id: string; requestBody?: DenyAccessRequestRequestBody | undefined; }; export const DenyAccessRequestRequesterKind = { User: "user", ServiceAccount: "serviceAccount", } as const; export type DenyAccessRequestRequesterKind = ClosedEnum< typeof DenyAccessRequestRequesterKind >; export type DenyAccessRequestDeployment = { id: string; name: string; deploymentGroup?: models.DeploymentGroupInfo | undefined; }; /** * How risky an operation is (declared by the plugin metadata). */ export const DenyAccessRequestTier = { ReadOnly: "read-only", Mutating: "mutating", Destructive: "destructive", } as const; /** * How risky an operation is (declared by the plugin metadata). */ export type DenyAccessRequestTier = ClosedEnum; export type DenyAccessRequestCommand = { command: string; summary: string; params?: any | null | undefined; /** * How risky an operation is (declared by the plugin metadata). */ tier?: DenyAccessRequestTier | undefined; }; /** * How risky an operation is (declared by the plugin metadata). */ export const DenyAccessRequestMaxRisk = { ReadOnly: "read-only", Mutating: "mutating", Destructive: "destructive", } as const; /** * How risky an operation is (declared by the plugin metadata). */ export type DenyAccessRequestMaxRisk = ClosedEnum< typeof DenyAccessRequestMaxRisk >; /** * The rejected access request. */ export type DenyAccessRequestResponse = { id: string; requesterKind: DenyAccessRequestRequesterKind | null; requesterId: string | null; requestedExpiresAt: string | null; deploymentId: string; deployment?: DenyAccessRequestDeployment | 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: DenyAccessRequestMaxRisk | null; status: models.AccessRequestStatus; approvedUntil: string | null; }; /** @internal */ export type DenyAccessRequestRequestBody$Outbound = { method: string; actorId?: string | undefined; source?: { [k: string]: any | null } | undefined; }; /** @internal */ export const DenyAccessRequestRequestBody$outboundSchema: z.ZodType< DenyAccessRequestRequestBody$Outbound, DenyAccessRequestRequestBody > = z.object({ method: z.string(), actorId: z.string().optional(), source: z.record(z.string(), z.nullable(z.any())).optional(), }); export function denyAccessRequestRequestBodyToJSON( denyAccessRequestRequestBody: DenyAccessRequestRequestBody, ): string { return JSON.stringify( DenyAccessRequestRequestBody$outboundSchema.parse( denyAccessRequestRequestBody, ), ); } /** @internal */ export type DenyAccessRequestRequest$Outbound = { id: string; RequestBody?: DenyAccessRequestRequestBody$Outbound | undefined; }; /** @internal */ export const DenyAccessRequestRequest$outboundSchema: z.ZodType< DenyAccessRequestRequest$Outbound, DenyAccessRequestRequest > = z.object({ id: z.string(), requestBody: z.lazy(() => DenyAccessRequestRequestBody$outboundSchema) .optional(), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function denyAccessRequestRequestToJSON( denyAccessRequestRequest: DenyAccessRequestRequest, ): string { return JSON.stringify( DenyAccessRequestRequest$outboundSchema.parse(denyAccessRequestRequest), ); } /** @internal */ export const DenyAccessRequestRequesterKind$inboundSchema: z.ZodEnum< typeof DenyAccessRequestRequesterKind > = z.enum(DenyAccessRequestRequesterKind); /** @internal */ export const DenyAccessRequestDeployment$inboundSchema: z.ZodType< DenyAccessRequestDeployment, unknown > = z.object({ id: z.string(), name: z.string(), deploymentGroup: models.DeploymentGroupInfo$inboundSchema.optional(), }); export function denyAccessRequestDeploymentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DenyAccessRequestDeployment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DenyAccessRequestDeployment' from JSON`, ); } /** @internal */ export const DenyAccessRequestTier$inboundSchema: z.ZodEnum< typeof DenyAccessRequestTier > = z.enum(DenyAccessRequestTier); /** @internal */ export const DenyAccessRequestCommand$inboundSchema: z.ZodType< DenyAccessRequestCommand, unknown > = z.object({ command: z.string(), summary: z.string(), params: z.nullable(z.any()).optional(), tier: DenyAccessRequestTier$inboundSchema.optional(), }); export function denyAccessRequestCommandFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DenyAccessRequestCommand$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DenyAccessRequestCommand' from JSON`, ); } /** @internal */ export const DenyAccessRequestMaxRisk$inboundSchema: z.ZodEnum< typeof DenyAccessRequestMaxRisk > = z.enum(DenyAccessRequestMaxRisk); /** @internal */ export const DenyAccessRequestResponse$inboundSchema: z.ZodType< DenyAccessRequestResponse, unknown > = z.object({ id: z.string(), requesterKind: z.nullable(DenyAccessRequestRequesterKind$inboundSchema), requesterId: z.nullable(z.string()), requestedExpiresAt: z.nullable(z.string()), deploymentId: z.string(), deployment: z.lazy(() => DenyAccessRequestDeployment$inboundSchema) .optional(), remediationPlanId: z.nullable(z.string()), title: z.string(), reason: z.nullable(z.string()), commands: z.array(z.lazy(() => DenyAccessRequestCommand$inboundSchema)), operationPattern: z.nullable(z.string()), maxRisk: z.nullable(DenyAccessRequestMaxRisk$inboundSchema), status: models.AccessRequestStatus$inboundSchema, approvedUntil: z.nullable(z.string()), }); export function denyAccessRequestResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DenyAccessRequestResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DenyAccessRequestResponse' from JSON`, ); }