/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 551a2f8efbb8 */ 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"; export type RotateAwsVirtualKeyCredentialRequestBody = { generation: number; }; export type RotateAwsVirtualKeyCredentialRequest = { /** * Unique identifier for the aws virtual key. */ id: string; requestBody?: RotateAwsVirtualKeyCredentialRequestBody | undefined; }; export const RotateAwsVirtualKeyCredentialStatus = { Provisioning: "provisioning", Ready: "ready", ActionRequired: "action-required", Decommissioning: "decommissioning", DeletionPending: "deletion-pending", Deleted: "deleted", Failed: "failed", } as const; export type RotateAwsVirtualKeyCredentialStatus = ClosedEnum< typeof RotateAwsVirtualKeyCredentialStatus >; export type RotateAwsVirtualKeyCredentialVirtualKey = { /** * Unique identifier for the aws virtual key. */ id: string; projectId: string; status: RotateAwsVirtualKeyCredentialStatus; 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 RotateAwsVirtualKeyCredentialSetup = { proxyUriEndpoint: string; proxyUriPath: string; accessKeyId: string; secretAccessKey: string; externalKeyId: string; }; /** * The resumable XKS proxy credential rotation bundle */ export type RotateAwsVirtualKeyCredentialResponse = { virtualKey: RotateAwsVirtualKeyCredentialVirtualKey; setup: RotateAwsVirtualKeyCredentialSetup; }; /** @internal */ export type RotateAwsVirtualKeyCredentialRequestBody$Outbound = { generation: number; }; /** @internal */ export const RotateAwsVirtualKeyCredentialRequestBody$outboundSchema: z.ZodType< RotateAwsVirtualKeyCredentialRequestBody$Outbound, RotateAwsVirtualKeyCredentialRequestBody > = z.object({ generation: z.int(), }); export function rotateAwsVirtualKeyCredentialRequestBodyToJSON( rotateAwsVirtualKeyCredentialRequestBody: RotateAwsVirtualKeyCredentialRequestBody, ): string { return JSON.stringify( RotateAwsVirtualKeyCredentialRequestBody$outboundSchema.parse( rotateAwsVirtualKeyCredentialRequestBody, ), ); } /** @internal */ export type RotateAwsVirtualKeyCredentialRequest$Outbound = { id: string; RequestBody?: RotateAwsVirtualKeyCredentialRequestBody$Outbound | undefined; }; /** @internal */ export const RotateAwsVirtualKeyCredentialRequest$outboundSchema: z.ZodType< RotateAwsVirtualKeyCredentialRequest$Outbound, RotateAwsVirtualKeyCredentialRequest > = z.object({ id: z.string(), requestBody: z.lazy(() => RotateAwsVirtualKeyCredentialRequestBody$outboundSchema ).optional(), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function rotateAwsVirtualKeyCredentialRequestToJSON( rotateAwsVirtualKeyCredentialRequest: RotateAwsVirtualKeyCredentialRequest, ): string { return JSON.stringify( RotateAwsVirtualKeyCredentialRequest$outboundSchema.parse( rotateAwsVirtualKeyCredentialRequest, ), ); } /** @internal */ export const RotateAwsVirtualKeyCredentialStatus$inboundSchema: z.ZodEnum< typeof RotateAwsVirtualKeyCredentialStatus > = z.enum(RotateAwsVirtualKeyCredentialStatus); /** @internal */ export const RotateAwsVirtualKeyCredentialVirtualKey$inboundSchema: z.ZodType< RotateAwsVirtualKeyCredentialVirtualKey, unknown > = z.object({ id: z.string(), projectId: z.string(), status: RotateAwsVirtualKeyCredentialStatus$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 rotateAwsVirtualKeyCredentialVirtualKeyFromJSON( jsonString: string, ): SafeParseResult< RotateAwsVirtualKeyCredentialVirtualKey, SDKValidationError > { return safeParse( jsonString, (x) => RotateAwsVirtualKeyCredentialVirtualKey$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'RotateAwsVirtualKeyCredentialVirtualKey' from JSON`, ); } /** @internal */ export const RotateAwsVirtualKeyCredentialSetup$inboundSchema: z.ZodType< RotateAwsVirtualKeyCredentialSetup, unknown > = z.object({ proxyUriEndpoint: z.string(), proxyUriPath: z.string(), accessKeyId: z.string(), secretAccessKey: z.string(), externalKeyId: z.string(), }); export function rotateAwsVirtualKeyCredentialSetupFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RotateAwsVirtualKeyCredentialSetup$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RotateAwsVirtualKeyCredentialSetup' from JSON`, ); } /** @internal */ export const RotateAwsVirtualKeyCredentialResponse$inboundSchema: z.ZodType< RotateAwsVirtualKeyCredentialResponse, unknown > = z.object({ virtualKey: z.lazy(() => RotateAwsVirtualKeyCredentialVirtualKey$inboundSchema ), setup: z.lazy(() => RotateAwsVirtualKeyCredentialSetup$inboundSchema), }); export function rotateAwsVirtualKeyCredentialResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RotateAwsVirtualKeyCredentialResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RotateAwsVirtualKeyCredentialResponse' from JSON`, ); }