/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 1254ab03f556 */ 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"; export type Selector2 = { /** * Unique identifier for the deployment. */ deploymentId: string; }; export type Selector1 = { /** * Case-sensitive, URL- and header-safe identifier from the integrating application. */ externalId: string; }; export type SelectorUnion = Selector1 | Selector2; export type CreateAwsVirtualKeyRequest = { /** * Filter by project ID or name. */ project?: string | undefined; selector: Selector1 | Selector2; awsAccountId: string; awsRegion: string; idempotencyKey: string; alias?: string | null | undefined; description?: string | null | undefined; deletionWindowDays?: number | undefined; tags?: { [k: string]: string } | undefined; }; export const CreateAwsVirtualKeyStatus = { Provisioning: "provisioning", Ready: "ready", ActionRequired: "action-required", Decommissioning: "decommissioning", DeletionPending: "deletion-pending", Deleted: "deleted", Failed: "failed", } as const; export type CreateAwsVirtualKeyStatus = ClosedEnum< typeof CreateAwsVirtualKeyStatus >; export type CreateAwsVirtualKeyVirtualKey = { /** * Unique identifier for the aws virtual key. */ id: string; projectId: string; status: CreateAwsVirtualKeyStatus; externalKeyId: string; awsAccountId: string; awsRegion: string; customKeyStoreId: string | null; kmsKeyArn: string | null; alias: string | null; description: string | null; deletionWindowDays: number; tags: { [k: string]: string }; observedAt: Date | null; canaryPassedAt: Date | null; deletionScheduledAt: Date | null; finalDeletionObservedAt: Date | null; createdAt: Date; updatedAt: Date; }; export type CreateAwsVirtualKeySetup = { proxyUriEndpoint: string; proxyUriPath: string; accessKeyId: string; secretAccessKey: string; externalKeyId: string; }; /** * Created or resumed Virtual Key */ export type CreateAwsVirtualKeyResponse = { virtualKey: CreateAwsVirtualKeyVirtualKey; setup: CreateAwsVirtualKeySetup; }; /** @internal */ export type Selector2$Outbound = { deploymentId: string; }; /** @internal */ export const Selector2$outboundSchema: z.ZodType< Selector2$Outbound, Selector2 > = z.object({ deploymentId: z.string(), }); export function selector2ToJSON(selector2: Selector2): string { return JSON.stringify(Selector2$outboundSchema.parse(selector2)); } /** @internal */ export type Selector1$Outbound = { externalId: string; }; /** @internal */ export const Selector1$outboundSchema: z.ZodType< Selector1$Outbound, Selector1 > = z.object({ externalId: z.string(), }); export function selector1ToJSON(selector1: Selector1): string { return JSON.stringify(Selector1$outboundSchema.parse(selector1)); } /** @internal */ export type SelectorUnion$Outbound = Selector1$Outbound | Selector2$Outbound; /** @internal */ export const SelectorUnion$outboundSchema: z.ZodType< SelectorUnion$Outbound, SelectorUnion > = z.union([ z.lazy(() => Selector1$outboundSchema), z.lazy(() => Selector2$outboundSchema), ]); export function selectorUnionToJSON(selectorUnion: SelectorUnion): string { return JSON.stringify(SelectorUnion$outboundSchema.parse(selectorUnion)); } /** @internal */ export type CreateAwsVirtualKeyRequest$Outbound = { project?: string | undefined; selector: Selector1$Outbound | Selector2$Outbound; awsAccountId: string; awsRegion: string; idempotencyKey: string; alias?: string | null | undefined; description?: string | null | undefined; deletionWindowDays: number; tags?: { [k: string]: string } | undefined; }; /** @internal */ export const CreateAwsVirtualKeyRequest$outboundSchema: z.ZodType< CreateAwsVirtualKeyRequest$Outbound, CreateAwsVirtualKeyRequest > = z.object({ project: z.string().optional(), selector: z.union([ z.lazy(() => Selector1$outboundSchema), z.lazy(() => Selector2$outboundSchema), ]), awsAccountId: z.string(), awsRegion: z.string(), idempotencyKey: z.string(), alias: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), deletionWindowDays: z.int().default(30), tags: z.record(z.string(), z.string()).optional(), }); export function createAwsVirtualKeyRequestToJSON( createAwsVirtualKeyRequest: CreateAwsVirtualKeyRequest, ): string { return JSON.stringify( CreateAwsVirtualKeyRequest$outboundSchema.parse(createAwsVirtualKeyRequest), ); } /** @internal */ export const CreateAwsVirtualKeyStatus$inboundSchema: z.ZodEnum< typeof CreateAwsVirtualKeyStatus > = z.enum(CreateAwsVirtualKeyStatus); /** @internal */ export const CreateAwsVirtualKeyVirtualKey$inboundSchema: z.ZodType< CreateAwsVirtualKeyVirtualKey, unknown > = z.object({ id: z.string(), projectId: z.string(), status: CreateAwsVirtualKeyStatus$inboundSchema, externalKeyId: z.string(), awsAccountId: z.string(), awsRegion: z.string(), customKeyStoreId: z.nullable(z.string()), kmsKeyArn: z.nullable(z.string()), alias: z.nullable(z.string()), description: z.nullable(z.string()), deletionWindowDays: z.int(), tags: z.record(z.string(), z.string()), observedAt: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ), canaryPassedAt: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ), deletionScheduledAt: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ), finalDeletionObservedAt: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ), createdAt: z.iso.datetime({ offset: true }).transform(v => new Date(v)), updatedAt: z.iso.datetime({ offset: true }).transform(v => new Date(v)), }); export function createAwsVirtualKeyVirtualKeyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateAwsVirtualKeyVirtualKey$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAwsVirtualKeyVirtualKey' from JSON`, ); } /** @internal */ export const CreateAwsVirtualKeySetup$inboundSchema: z.ZodType< CreateAwsVirtualKeySetup, unknown > = z.object({ proxyUriEndpoint: z.string(), proxyUriPath: z.string(), accessKeyId: z.string(), secretAccessKey: z.string(), externalKeyId: z.string(), }); export function createAwsVirtualKeySetupFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateAwsVirtualKeySetup$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAwsVirtualKeySetup' from JSON`, ); } /** @internal */ export const CreateAwsVirtualKeyResponse$inboundSchema: z.ZodType< CreateAwsVirtualKeyResponse, unknown > = z.object({ virtualKey: z.lazy(() => CreateAwsVirtualKeyVirtualKey$inboundSchema), setup: z.lazy(() => CreateAwsVirtualKeySetup$inboundSchema), }); export function createAwsVirtualKeyResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateAwsVirtualKeyResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAwsVirtualKeyResponse' from JSON`, ); }