From a4a69c88be7cc36cee5b56ab71947391f9ffddb8 Mon Sep 17 00:00:00 2001 From: David Crespo Date: Fri, 15 Aug 2025 16:34:05 -0500 Subject: [PATCH 1/4] generate zod validators as baseline --- oxide-api/src/msw-handlers.ts | 3663 +++++++++++++++ oxide-api/src/validate.ts | 8091 +++++++++++++++++++++++++++++++++ tools/gen.sh | 2 +- 3 files changed, 11755 insertions(+), 1 deletion(-) create mode 100644 oxide-api/src/msw-handlers.ts create mode 100644 oxide-api/src/validate.ts diff --git a/oxide-api/src/msw-handlers.ts b/oxide-api/src/msw-handlers.ts new file mode 100644 index 0000000..706c3b9 --- /dev/null +++ b/oxide-api/src/msw-handlers.ts @@ -0,0 +1,3663 @@ +import { + http, + type HttpHandler, + HttpResponse, + type StrictResponse, + type PathParams, +} from "msw"; +import type { + SnakeCasedPropertiesDeep as Snakify, + Promisable, +} from "type-fest"; +import { type ZodSchema } from "zod"; +import type * as Api from "./Api"; +import { snakeify } from "./util"; +import * as schema from "./validate"; + +type HandlerResult = Json | StrictResponse>; +type StatusCode = number; + +// these are used for turning our nice JS-ified API types back into the original +// API JSON types (snake cased and dates as strings) for use in our mock API + +type StringifyDates = T extends Date + ? string + : { + [K in keyof T]: T[K] extends Array + ? Array> + : StringifyDates; + }; + +/** + * Snake case fields and convert dates to strings. Not intended to be a general + * purpose JSON type! + */ +export type Json = Snakify>; +export const json = HttpResponse.json; + +// Shortcut to reduce number of imports required in consumers +export { HttpResponse }; + +export interface MSWHandlers { + /** `POST /device/auth` */ + deviceAuthRequest: (params: { + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /device/confirm` */ + deviceAuthConfirm: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /device/token` */ + deviceAccessToken: (params: { + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /experimental/v1/probes` */ + probeList: (params: { + query: Api.ProbeListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /experimental/v1/probes` */ + probeCreate: (params: { + query: Api.ProbeCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /experimental/v1/probes/:probe` */ + probeView: (params: { + path: Api.ProbeViewPathParams; + query: Api.ProbeViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /experimental/v1/probes/:probe` */ + probeDelete: (params: { + path: Api.ProbeDeletePathParams; + query: Api.ProbeDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /experimental/v1/system/support-bundles` */ + supportBundleList: (params: { + query: Api.SupportBundleListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /experimental/v1/system/support-bundles` */ + supportBundleCreate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /experimental/v1/system/support-bundles/:bundleId` */ + supportBundleView: (params: { + path: Api.SupportBundleViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /experimental/v1/system/support-bundles/:bundleId` */ + supportBundleUpdate: (params: { + path: Api.SupportBundleUpdatePathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /experimental/v1/system/support-bundles/:bundleId` */ + supportBundleDelete: (params: { + path: Api.SupportBundleDeletePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /experimental/v1/system/support-bundles/:bundleId/download` */ + supportBundleDownload: (params: { + path: Api.SupportBundleDownloadPathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `HEAD /experimental/v1/system/support-bundles/:bundleId/download` */ + supportBundleHead: (params: { + path: Api.SupportBundleHeadPathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /experimental/v1/system/support-bundles/:bundleId/download/:file` */ + supportBundleDownloadFile: (params: { + path: Api.SupportBundleDownloadFilePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `HEAD /experimental/v1/system/support-bundles/:bundleId/download/:file` */ + supportBundleHeadFile: (params: { + path: Api.SupportBundleHeadFilePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /experimental/v1/system/support-bundles/:bundleId/index` */ + supportBundleIndex: (params: { + path: Api.SupportBundleIndexPathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /login/:siloName/saml/:providerName` */ + loginSaml: (params: { + path: Api.LoginSamlPathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/affinity-groups` */ + affinityGroupList: (params: { + query: Api.AffinityGroupListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/affinity-groups` */ + affinityGroupCreate: (params: { + query: Api.AffinityGroupCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/affinity-groups/:affinityGroup` */ + affinityGroupView: (params: { + path: Api.AffinityGroupViewPathParams; + query: Api.AffinityGroupViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/affinity-groups/:affinityGroup` */ + affinityGroupUpdate: (params: { + path: Api.AffinityGroupUpdatePathParams; + query: Api.AffinityGroupUpdateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/affinity-groups/:affinityGroup` */ + affinityGroupDelete: (params: { + path: Api.AffinityGroupDeletePathParams; + query: Api.AffinityGroupDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/affinity-groups/:affinityGroup/members` */ + affinityGroupMemberList: (params: { + path: Api.AffinityGroupMemberListPathParams; + query: Api.AffinityGroupMemberListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/affinity-groups/:affinityGroup/members/instance/:instance` */ + affinityGroupMemberInstanceView: (params: { + path: Api.AffinityGroupMemberInstanceViewPathParams; + query: Api.AffinityGroupMemberInstanceViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/affinity-groups/:affinityGroup/members/instance/:instance` */ + affinityGroupMemberInstanceAdd: (params: { + path: Api.AffinityGroupMemberInstanceAddPathParams; + query: Api.AffinityGroupMemberInstanceAddQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/affinity-groups/:affinityGroup/members/instance/:instance` */ + affinityGroupMemberInstanceDelete: (params: { + path: Api.AffinityGroupMemberInstanceDeletePathParams; + query: Api.AffinityGroupMemberInstanceDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/alert-classes` */ + alertClassList: (params: { + query: Api.AlertClassListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/alert-receivers` */ + alertReceiverList: (params: { + query: Api.AlertReceiverListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/alert-receivers/:receiver` */ + alertReceiverView: (params: { + path: Api.AlertReceiverViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/alert-receivers/:receiver` */ + alertReceiverDelete: (params: { + path: Api.AlertReceiverDeletePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/alert-receivers/:receiver/deliveries` */ + alertDeliveryList: (params: { + path: Api.AlertDeliveryListPathParams; + query: Api.AlertDeliveryListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/alert-receivers/:receiver/probe` */ + alertReceiverProbe: (params: { + path: Api.AlertReceiverProbePathParams; + query: Api.AlertReceiverProbeQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/alert-receivers/:receiver/subscriptions` */ + alertReceiverSubscriptionAdd: (params: { + path: Api.AlertReceiverSubscriptionAddPathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/alert-receivers/:receiver/subscriptions/:subscription` */ + alertReceiverSubscriptionRemove: (params: { + path: Api.AlertReceiverSubscriptionRemovePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/alerts/:alertId/resend` */ + alertDeliveryResend: (params: { + path: Api.AlertDeliveryResendPathParams; + query: Api.AlertDeliveryResendQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/anti-affinity-groups` */ + antiAffinityGroupList: (params: { + query: Api.AntiAffinityGroupListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/anti-affinity-groups` */ + antiAffinityGroupCreate: (params: { + query: Api.AntiAffinityGroupCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/anti-affinity-groups/:antiAffinityGroup` */ + antiAffinityGroupView: (params: { + path: Api.AntiAffinityGroupViewPathParams; + query: Api.AntiAffinityGroupViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/anti-affinity-groups/:antiAffinityGroup` */ + antiAffinityGroupUpdate: (params: { + path: Api.AntiAffinityGroupUpdatePathParams; + query: Api.AntiAffinityGroupUpdateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/anti-affinity-groups/:antiAffinityGroup` */ + antiAffinityGroupDelete: (params: { + path: Api.AntiAffinityGroupDeletePathParams; + query: Api.AntiAffinityGroupDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/anti-affinity-groups/:antiAffinityGroup/members` */ + antiAffinityGroupMemberList: (params: { + path: Api.AntiAffinityGroupMemberListPathParams; + query: Api.AntiAffinityGroupMemberListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/anti-affinity-groups/:antiAffinityGroup/members/instance/:instance` */ + antiAffinityGroupMemberInstanceView: (params: { + path: Api.AntiAffinityGroupMemberInstanceViewPathParams; + query: Api.AntiAffinityGroupMemberInstanceViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/anti-affinity-groups/:antiAffinityGroup/members/instance/:instance` */ + antiAffinityGroupMemberInstanceAdd: (params: { + path: Api.AntiAffinityGroupMemberInstanceAddPathParams; + query: Api.AntiAffinityGroupMemberInstanceAddQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/anti-affinity-groups/:antiAffinityGroup/members/instance/:instance` */ + antiAffinityGroupMemberInstanceDelete: (params: { + path: Api.AntiAffinityGroupMemberInstanceDeletePathParams; + query: Api.AntiAffinityGroupMemberInstanceDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/auth-settings` */ + authSettingsView: (params: { + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/auth-settings` */ + authSettingsUpdate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/certificates` */ + certificateList: (params: { + query: Api.CertificateListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/certificates` */ + certificateCreate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/certificates/:certificate` */ + certificateView: (params: { + path: Api.CertificateViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/certificates/:certificate` */ + certificateDelete: (params: { + path: Api.CertificateDeletePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/disks` */ + diskList: (params: { + query: Api.DiskListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/disks` */ + diskCreate: (params: { + query: Api.DiskCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/disks/:disk` */ + diskView: (params: { + path: Api.DiskViewPathParams; + query: Api.DiskViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/disks/:disk` */ + diskDelete: (params: { + path: Api.DiskDeletePathParams; + query: Api.DiskDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/disks/:disk/bulk-write` */ + diskBulkWriteImport: (params: { + path: Api.DiskBulkWriteImportPathParams; + query: Api.DiskBulkWriteImportQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/disks/:disk/bulk-write-start` */ + diskBulkWriteImportStart: (params: { + path: Api.DiskBulkWriteImportStartPathParams; + query: Api.DiskBulkWriteImportStartQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/disks/:disk/bulk-write-stop` */ + diskBulkWriteImportStop: (params: { + path: Api.DiskBulkWriteImportStopPathParams; + query: Api.DiskBulkWriteImportStopQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/disks/:disk/finalize` */ + diskFinalizeImport: (params: { + path: Api.DiskFinalizeImportPathParams; + query: Api.DiskFinalizeImportQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/floating-ips` */ + floatingIpList: (params: { + query: Api.FloatingIpListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/floating-ips` */ + floatingIpCreate: (params: { + query: Api.FloatingIpCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/floating-ips/:floatingIp` */ + floatingIpView: (params: { + path: Api.FloatingIpViewPathParams; + query: Api.FloatingIpViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/floating-ips/:floatingIp` */ + floatingIpUpdate: (params: { + path: Api.FloatingIpUpdatePathParams; + query: Api.FloatingIpUpdateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/floating-ips/:floatingIp` */ + floatingIpDelete: (params: { + path: Api.FloatingIpDeletePathParams; + query: Api.FloatingIpDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/floating-ips/:floatingIp/attach` */ + floatingIpAttach: (params: { + path: Api.FloatingIpAttachPathParams; + query: Api.FloatingIpAttachQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/floating-ips/:floatingIp/detach` */ + floatingIpDetach: (params: { + path: Api.FloatingIpDetachPathParams; + query: Api.FloatingIpDetachQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/groups` */ + groupList: (params: { + query: Api.GroupListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/groups/:groupId` */ + groupView: (params: { + path: Api.GroupViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/images` */ + imageList: (params: { + query: Api.ImageListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/images` */ + imageCreate: (params: { + query: Api.ImageCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/images/:image` */ + imageView: (params: { + path: Api.ImageViewPathParams; + query: Api.ImageViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/images/:image` */ + imageDelete: (params: { + path: Api.ImageDeletePathParams; + query: Api.ImageDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/images/:image/demote` */ + imageDemote: (params: { + path: Api.ImageDemotePathParams; + query: Api.ImageDemoteQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/images/:image/promote` */ + imagePromote: (params: { + path: Api.ImagePromotePathParams; + query: Api.ImagePromoteQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/instances` */ + instanceList: (params: { + query: Api.InstanceListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/instances` */ + instanceCreate: (params: { + query: Api.InstanceCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/instances/:instance` */ + instanceView: (params: { + path: Api.InstanceViewPathParams; + query: Api.InstanceViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/instances/:instance` */ + instanceUpdate: (params: { + path: Api.InstanceUpdatePathParams; + query: Api.InstanceUpdateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/instances/:instance` */ + instanceDelete: (params: { + path: Api.InstanceDeletePathParams; + query: Api.InstanceDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/instances/:instance/affinity-groups` */ + instanceAffinityGroupList: (params: { + path: Api.InstanceAffinityGroupListPathParams; + query: Api.InstanceAffinityGroupListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/instances/:instance/anti-affinity-groups` */ + instanceAntiAffinityGroupList: (params: { + path: Api.InstanceAntiAffinityGroupListPathParams; + query: Api.InstanceAntiAffinityGroupListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/instances/:instance/disks` */ + instanceDiskList: (params: { + path: Api.InstanceDiskListPathParams; + query: Api.InstanceDiskListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/instances/:instance/disks/attach` */ + instanceDiskAttach: (params: { + path: Api.InstanceDiskAttachPathParams; + query: Api.InstanceDiskAttachQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/instances/:instance/disks/detach` */ + instanceDiskDetach: (params: { + path: Api.InstanceDiskDetachPathParams; + query: Api.InstanceDiskDetachQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/instances/:instance/external-ips` */ + instanceExternalIpList: (params: { + path: Api.InstanceExternalIpListPathParams; + query: Api.InstanceExternalIpListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/instances/:instance/external-ips/ephemeral` */ + instanceEphemeralIpAttach: (params: { + path: Api.InstanceEphemeralIpAttachPathParams; + query: Api.InstanceEphemeralIpAttachQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/instances/:instance/external-ips/ephemeral` */ + instanceEphemeralIpDetach: (params: { + path: Api.InstanceEphemeralIpDetachPathParams; + query: Api.InstanceEphemeralIpDetachQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/instances/:instance/reboot` */ + instanceReboot: (params: { + path: Api.InstanceRebootPathParams; + query: Api.InstanceRebootQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/instances/:instance/serial-console` */ + instanceSerialConsole: (params: { + path: Api.InstanceSerialConsolePathParams; + query: Api.InstanceSerialConsoleQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/instances/:instance/serial-console/stream` */ + instanceSerialConsoleStream: (params: { + path: Api.InstanceSerialConsoleStreamPathParams; + query: Api.InstanceSerialConsoleStreamQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/instances/:instance/ssh-public-keys` */ + instanceSshPublicKeyList: (params: { + path: Api.InstanceSshPublicKeyListPathParams; + query: Api.InstanceSshPublicKeyListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/instances/:instance/start` */ + instanceStart: (params: { + path: Api.InstanceStartPathParams; + query: Api.InstanceStartQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/instances/:instance/stop` */ + instanceStop: (params: { + path: Api.InstanceStopPathParams; + query: Api.InstanceStopQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/internet-gateway-ip-addresses` */ + internetGatewayIpAddressList: (params: { + query: Api.InternetGatewayIpAddressListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/internet-gateway-ip-addresses` */ + internetGatewayIpAddressCreate: (params: { + query: Api.InternetGatewayIpAddressCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/internet-gateway-ip-addresses/:address` */ + internetGatewayIpAddressDelete: (params: { + path: Api.InternetGatewayIpAddressDeletePathParams; + query: Api.InternetGatewayIpAddressDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/internet-gateway-ip-pools` */ + internetGatewayIpPoolList: (params: { + query: Api.InternetGatewayIpPoolListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/internet-gateway-ip-pools` */ + internetGatewayIpPoolCreate: (params: { + query: Api.InternetGatewayIpPoolCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/internet-gateway-ip-pools/:pool` */ + internetGatewayIpPoolDelete: (params: { + path: Api.InternetGatewayIpPoolDeletePathParams; + query: Api.InternetGatewayIpPoolDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/internet-gateways` */ + internetGatewayList: (params: { + query: Api.InternetGatewayListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/internet-gateways` */ + internetGatewayCreate: (params: { + query: Api.InternetGatewayCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/internet-gateways/:gateway` */ + internetGatewayView: (params: { + path: Api.InternetGatewayViewPathParams; + query: Api.InternetGatewayViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/internet-gateways/:gateway` */ + internetGatewayDelete: (params: { + path: Api.InternetGatewayDeletePathParams; + query: Api.InternetGatewayDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/ip-pools` */ + projectIpPoolList: (params: { + query: Api.ProjectIpPoolListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/ip-pools/:pool` */ + projectIpPoolView: (params: { + path: Api.ProjectIpPoolViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/login/:siloName/local` */ + loginLocal: (params: { + path: Api.LoginLocalPathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/logout` */ + logout: (params: { + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/me` */ + currentUserView: (params: { + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/me/access-tokens` */ + currentUserAccessTokenList: (params: { + query: Api.CurrentUserAccessTokenListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/me/access-tokens/:tokenId` */ + currentUserAccessTokenDelete: (params: { + path: Api.CurrentUserAccessTokenDeletePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/me/groups` */ + currentUserGroups: (params: { + query: Api.CurrentUserGroupsQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/me/ssh-keys` */ + currentUserSshKeyList: (params: { + query: Api.CurrentUserSshKeyListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/me/ssh-keys` */ + currentUserSshKeyCreate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/me/ssh-keys/:sshKey` */ + currentUserSshKeyView: (params: { + path: Api.CurrentUserSshKeyViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/me/ssh-keys/:sshKey` */ + currentUserSshKeyDelete: (params: { + path: Api.CurrentUserSshKeyDeletePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/metrics/:metricName` */ + siloMetric: (params: { + path: Api.SiloMetricPathParams; + query: Api.SiloMetricQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/network-interfaces` */ + instanceNetworkInterfaceList: (params: { + query: Api.InstanceNetworkInterfaceListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/network-interfaces` */ + instanceNetworkInterfaceCreate: (params: { + query: Api.InstanceNetworkInterfaceCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/network-interfaces/:interface` */ + instanceNetworkInterfaceView: (params: { + path: Api.InstanceNetworkInterfaceViewPathParams; + query: Api.InstanceNetworkInterfaceViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/network-interfaces/:interface` */ + instanceNetworkInterfaceUpdate: (params: { + path: Api.InstanceNetworkInterfaceUpdatePathParams; + query: Api.InstanceNetworkInterfaceUpdateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/network-interfaces/:interface` */ + instanceNetworkInterfaceDelete: (params: { + path: Api.InstanceNetworkInterfaceDeletePathParams; + query: Api.InstanceNetworkInterfaceDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/ping` */ + ping: (params: { + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/policy` */ + policyView: (params: { + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/policy` */ + policyUpdate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/projects` */ + projectList: (params: { + query: Api.ProjectListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/projects` */ + projectCreate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/projects/:project` */ + projectView: (params: { + path: Api.ProjectViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/projects/:project` */ + projectUpdate: (params: { + path: Api.ProjectUpdatePathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/projects/:project` */ + projectDelete: (params: { + path: Api.ProjectDeletePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/projects/:project/policy` */ + projectPolicyView: (params: { + path: Api.ProjectPolicyViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/projects/:project/policy` */ + projectPolicyUpdate: (params: { + path: Api.ProjectPolicyUpdatePathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/snapshots` */ + snapshotList: (params: { + query: Api.SnapshotListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/snapshots` */ + snapshotCreate: (params: { + query: Api.SnapshotCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/snapshots/:snapshot` */ + snapshotView: (params: { + path: Api.SnapshotViewPathParams; + query: Api.SnapshotViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/snapshots/:snapshot` */ + snapshotDelete: (params: { + path: Api.SnapshotDeletePathParams; + query: Api.SnapshotDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/audit-log` */ + auditLogList: (params: { + query: Api.AuditLogListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/hardware/disks` */ + physicalDiskList: (params: { + query: Api.PhysicalDiskListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/hardware/disks/:diskId` */ + physicalDiskView: (params: { + path: Api.PhysicalDiskViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/hardware/rack-switch-port/:rackId/:switchLocation/:port/lldp/neighbors` */ + networkingSwitchPortLldpNeighbors: (params: { + path: Api.NetworkingSwitchPortLldpNeighborsPathParams; + query: Api.NetworkingSwitchPortLldpNeighborsQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/hardware/racks` */ + rackList: (params: { + query: Api.RackListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/hardware/racks/:rackId` */ + rackView: (params: { + path: Api.RackViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/hardware/sleds` */ + sledList: (params: { + query: Api.SledListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/hardware/sleds` */ + sledAdd: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/hardware/sleds/:sledId` */ + sledView: (params: { + path: Api.SledViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/hardware/sleds/:sledId/disks` */ + sledPhysicalDiskList: (params: { + path: Api.SledPhysicalDiskListPathParams; + query: Api.SledPhysicalDiskListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/hardware/sleds/:sledId/instances` */ + sledInstanceList: (params: { + path: Api.SledInstanceListPathParams; + query: Api.SledInstanceListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/system/hardware/sleds/:sledId/provision-policy` */ + sledSetProvisionPolicy: (params: { + path: Api.SledSetProvisionPolicyPathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/hardware/sleds-uninitialized` */ + sledListUninitialized: (params: { + query: Api.SledListUninitializedQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/hardware/switch-port` */ + networkingSwitchPortList: (params: { + query: Api.NetworkingSwitchPortListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/hardware/switch-port/:port/lldp/config` */ + networkingSwitchPortLldpConfigView: (params: { + path: Api.NetworkingSwitchPortLldpConfigViewPathParams; + query: Api.NetworkingSwitchPortLldpConfigViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/hardware/switch-port/:port/lldp/config` */ + networkingSwitchPortLldpConfigUpdate: (params: { + path: Api.NetworkingSwitchPortLldpConfigUpdatePathParams; + query: Api.NetworkingSwitchPortLldpConfigUpdateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/system/hardware/switch-port/:port/settings` */ + networkingSwitchPortApplySettings: (params: { + path: Api.NetworkingSwitchPortApplySettingsPathParams; + query: Api.NetworkingSwitchPortApplySettingsQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable; + /** `DELETE /v1/system/hardware/switch-port/:port/settings` */ + networkingSwitchPortClearSettings: (params: { + path: Api.NetworkingSwitchPortClearSettingsPathParams; + query: Api.NetworkingSwitchPortClearSettingsQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/hardware/switch-port/:port/status` */ + networkingSwitchPortStatus: (params: { + path: Api.NetworkingSwitchPortStatusPathParams; + query: Api.NetworkingSwitchPortStatusQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/hardware/switches` */ + switchList: (params: { + query: Api.SwitchListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/hardware/switches/:switchId` */ + switchView: (params: { + path: Api.SwitchViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/identity-providers` */ + siloIdentityProviderList: (params: { + query: Api.SiloIdentityProviderListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/identity-providers/local/users` */ + localIdpUserCreate: (params: { + query: Api.LocalIdpUserCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/system/identity-providers/local/users/:userId` */ + localIdpUserDelete: (params: { + path: Api.LocalIdpUserDeletePathParams; + query: Api.LocalIdpUserDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/system/identity-providers/local/users/:userId/set-password` */ + localIdpUserSetPassword: (params: { + path: Api.LocalIdpUserSetPasswordPathParams; + query: Api.LocalIdpUserSetPasswordQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/system/identity-providers/saml` */ + samlIdentityProviderCreate: (params: { + query: Api.SamlIdentityProviderCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/identity-providers/saml/:provider` */ + samlIdentityProviderView: (params: { + path: Api.SamlIdentityProviderViewPathParams; + query: Api.SamlIdentityProviderViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/ip-pools` */ + ipPoolList: (params: { + query: Api.IpPoolListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/ip-pools` */ + ipPoolCreate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/ip-pools/:pool` */ + ipPoolView: (params: { + path: Api.IpPoolViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/system/ip-pools/:pool` */ + ipPoolUpdate: (params: { + path: Api.IpPoolUpdatePathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/system/ip-pools/:pool` */ + ipPoolDelete: (params: { + path: Api.IpPoolDeletePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/ip-pools/:pool/ranges` */ + ipPoolRangeList: (params: { + path: Api.IpPoolRangeListPathParams; + query: Api.IpPoolRangeListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/ip-pools/:pool/ranges/add` */ + ipPoolRangeAdd: (params: { + path: Api.IpPoolRangeAddPathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/ip-pools/:pool/ranges/remove` */ + ipPoolRangeRemove: (params: { + path: Api.IpPoolRangeRemovePathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/ip-pools/:pool/silos` */ + ipPoolSiloList: (params: { + path: Api.IpPoolSiloListPathParams; + query: Api.IpPoolSiloListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/ip-pools/:pool/silos` */ + ipPoolSiloLink: (params: { + path: Api.IpPoolSiloLinkPathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/system/ip-pools/:pool/silos/:silo` */ + ipPoolSiloUpdate: (params: { + path: Api.IpPoolSiloUpdatePathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/system/ip-pools/:pool/silos/:silo` */ + ipPoolSiloUnlink: (params: { + path: Api.IpPoolSiloUnlinkPathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/ip-pools/:pool/utilization` */ + ipPoolUtilizationView: (params: { + path: Api.IpPoolUtilizationViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/ip-pools-service` */ + ipPoolServiceView: (params: { + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/ip-pools-service/ranges` */ + ipPoolServiceRangeList: (params: { + query: Api.IpPoolServiceRangeListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/ip-pools-service/ranges/add` */ + ipPoolServiceRangeAdd: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/ip-pools-service/ranges/remove` */ + ipPoolServiceRangeRemove: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/metrics/:metricName` */ + systemMetric: (params: { + path: Api.SystemMetricPathParams; + query: Api.SystemMetricQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/networking/address-lot` */ + networkingAddressLotList: (params: { + query: Api.NetworkingAddressLotListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/networking/address-lot` */ + networkingAddressLotCreate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/system/networking/address-lot/:addressLot` */ + networkingAddressLotDelete: (params: { + path: Api.NetworkingAddressLotDeletePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/networking/address-lot/:addressLot/blocks` */ + networkingAddressLotBlockList: (params: { + path: Api.NetworkingAddressLotBlockListPathParams; + query: Api.NetworkingAddressLotBlockListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/networking/allow-list` */ + networkingAllowListView: (params: { + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/system/networking/allow-list` */ + networkingAllowListUpdate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/networking/bfd-disable` */ + networkingBfdDisable: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/system/networking/bfd-enable` */ + networkingBfdEnable: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/networking/bfd-status` */ + networkingBfdStatus: (params: { + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/networking/bgp` */ + networkingBgpConfigList: (params: { + query: Api.NetworkingBgpConfigListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/networking/bgp` */ + networkingBgpConfigCreate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/system/networking/bgp` */ + networkingBgpConfigDelete: (params: { + query: Api.NetworkingBgpConfigDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/networking/bgp-announce-set` */ + networkingBgpAnnounceSetList: (params: { + query: Api.NetworkingBgpAnnounceSetListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/system/networking/bgp-announce-set` */ + networkingBgpAnnounceSetUpdate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/system/networking/bgp-announce-set/:announceSet` */ + networkingBgpAnnounceSetDelete: (params: { + path: Api.NetworkingBgpAnnounceSetDeletePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/networking/bgp-announce-set/:announceSet/announcement` */ + networkingBgpAnnouncementList: (params: { + path: Api.NetworkingBgpAnnouncementListPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/networking/bgp-exported` */ + networkingBgpExported: (params: { + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/networking/bgp-message-history` */ + networkingBgpMessageHistory: (params: { + query: Api.NetworkingBgpMessageHistoryQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/networking/bgp-routes-ipv4` */ + networkingBgpImportedRoutesIpv4: (params: { + query: Api.NetworkingBgpImportedRoutesIpv4QueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/networking/bgp-status` */ + networkingBgpStatus: (params: { + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/networking/inbound-icmp` */ + networkingInboundIcmpView: (params: { + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/system/networking/inbound-icmp` */ + networkingInboundIcmpUpdate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/networking/loopback-address` */ + networkingLoopbackAddressList: (params: { + query: Api.NetworkingLoopbackAddressListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/networking/loopback-address` */ + networkingLoopbackAddressCreate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/system/networking/loopback-address/:rackId/:switchLocation/:address/:subnetMask` */ + networkingLoopbackAddressDelete: (params: { + path: Api.NetworkingLoopbackAddressDeletePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/networking/switch-port-settings` */ + networkingSwitchPortSettingsList: (params: { + query: Api.NetworkingSwitchPortSettingsListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/networking/switch-port-settings` */ + networkingSwitchPortSettingsCreate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/system/networking/switch-port-settings` */ + networkingSwitchPortSettingsDelete: (params: { + query: Api.NetworkingSwitchPortSettingsDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/networking/switch-port-settings/:port` */ + networkingSwitchPortSettingsView: (params: { + path: Api.NetworkingSwitchPortSettingsViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/policy` */ + systemPolicyView: (params: { + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/system/policy` */ + systemPolicyUpdate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/silo-quotas` */ + systemQuotasList: (params: { + query: Api.SystemQuotasListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/silos` */ + siloList: (params: { + query: Api.SiloListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/silos` */ + siloCreate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/silos/:silo` */ + siloView: (params: { + path: Api.SiloViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/system/silos/:silo` */ + siloDelete: (params: { + path: Api.SiloDeletePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/silos/:silo/ip-pools` */ + siloIpPoolList: (params: { + path: Api.SiloIpPoolListPathParams; + query: Api.SiloIpPoolListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/silos/:silo/policy` */ + siloPolicyView: (params: { + path: Api.SiloPolicyViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/system/silos/:silo/policy` */ + siloPolicyUpdate: (params: { + path: Api.SiloPolicyUpdatePathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/silos/:silo/quotas` */ + siloQuotasView: (params: { + path: Api.SiloQuotasViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/system/silos/:silo/quotas` */ + siloQuotasUpdate: (params: { + path: Api.SiloQuotasUpdatePathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/timeseries/query` */ + systemTimeseriesQuery: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/timeseries/schemas` */ + systemTimeseriesSchemaList: (params: { + query: Api.SystemTimeseriesSchemaListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/system/update/repository` */ + systemUpdatePutRepository: (params: { + query: Api.SystemUpdatePutRepositoryQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/update/repository/:systemVersion` */ + systemUpdateGetRepository: (params: { + path: Api.SystemUpdateGetRepositoryPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/update/target-release` */ + targetReleaseView: (params: { + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/system/update/target-release` */ + targetReleaseUpdate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/update/trust-roots` */ + systemUpdateTrustRootList: (params: { + query: Api.SystemUpdateTrustRootListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/system/update/trust-roots` */ + systemUpdateTrustRootCreate: (params: { + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/update/trust-roots/:trustRootId` */ + systemUpdateTrustRootView: (params: { + path: Api.SystemUpdateTrustRootViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/system/update/trust-roots/:trustRootId` */ + systemUpdateTrustRootDelete: (params: { + path: Api.SystemUpdateTrustRootDeletePathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/system/users` */ + siloUserList: (params: { + query: Api.SiloUserListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/users/:userId` */ + siloUserView: (params: { + path: Api.SiloUserViewPathParams; + query: Api.SiloUserViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/users-builtin` */ + userBuiltinList: (params: { + query: Api.UserBuiltinListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/users-builtin/:user` */ + userBuiltinView: (params: { + path: Api.UserBuiltinViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/utilization/silos` */ + siloUtilizationList: (params: { + query: Api.SiloUtilizationListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/system/utilization/silos/:silo` */ + siloUtilizationView: (params: { + path: Api.SiloUtilizationViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/timeseries/query` */ + timeseriesQuery: (params: { + query: Api.TimeseriesQueryQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/users` */ + userList: (params: { + query: Api.UserListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/users/:userId` */ + userView: (params: { + path: Api.UserViewPathParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/users/:userId/access-tokens` */ + userTokenList: (params: { + path: Api.UserTokenListPathParams; + query: Api.UserTokenListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/users/:userId/logout` */ + userLogout: (params: { + path: Api.UserLogoutPathParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/users/:userId/sessions` */ + userSessionList: (params: { + path: Api.UserSessionListPathParams; + query: Api.UserSessionListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/utilization` */ + utilizationView: (params: { + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/vpc-firewall-rules` */ + vpcFirewallRulesView: (params: { + query: Api.VpcFirewallRulesViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/vpc-firewall-rules` */ + vpcFirewallRulesUpdate: (params: { + query: Api.VpcFirewallRulesUpdateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/vpc-router-routes` */ + vpcRouterRouteList: (params: { + query: Api.VpcRouterRouteListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/vpc-router-routes` */ + vpcRouterRouteCreate: (params: { + query: Api.VpcRouterRouteCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/vpc-router-routes/:route` */ + vpcRouterRouteView: (params: { + path: Api.VpcRouterRouteViewPathParams; + query: Api.VpcRouterRouteViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/vpc-router-routes/:route` */ + vpcRouterRouteUpdate: (params: { + path: Api.VpcRouterRouteUpdatePathParams; + query: Api.VpcRouterRouteUpdateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/vpc-router-routes/:route` */ + vpcRouterRouteDelete: (params: { + path: Api.VpcRouterRouteDeletePathParams; + query: Api.VpcRouterRouteDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/vpc-routers` */ + vpcRouterList: (params: { + query: Api.VpcRouterListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/vpc-routers` */ + vpcRouterCreate: (params: { + query: Api.VpcRouterCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/vpc-routers/:router` */ + vpcRouterView: (params: { + path: Api.VpcRouterViewPathParams; + query: Api.VpcRouterViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/vpc-routers/:router` */ + vpcRouterUpdate: (params: { + path: Api.VpcRouterUpdatePathParams; + query: Api.VpcRouterUpdateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/vpc-routers/:router` */ + vpcRouterDelete: (params: { + path: Api.VpcRouterDeletePathParams; + query: Api.VpcRouterDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/vpc-subnets` */ + vpcSubnetList: (params: { + query: Api.VpcSubnetListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/vpc-subnets` */ + vpcSubnetCreate: (params: { + query: Api.VpcSubnetCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/vpc-subnets/:subnet` */ + vpcSubnetView: (params: { + path: Api.VpcSubnetViewPathParams; + query: Api.VpcSubnetViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/vpc-subnets/:subnet` */ + vpcSubnetUpdate: (params: { + path: Api.VpcSubnetUpdatePathParams; + query: Api.VpcSubnetUpdateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/vpc-subnets/:subnet` */ + vpcSubnetDelete: (params: { + path: Api.VpcSubnetDeletePathParams; + query: Api.VpcSubnetDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/vpc-subnets/:subnet/network-interfaces` */ + vpcSubnetListNetworkInterfaces: (params: { + path: Api.VpcSubnetListNetworkInterfacesPathParams; + query: Api.VpcSubnetListNetworkInterfacesQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/vpcs` */ + vpcList: (params: { + query: Api.VpcListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/vpcs` */ + vpcCreate: (params: { + query: Api.VpcCreateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `GET /v1/vpcs/:vpc` */ + vpcView: (params: { + path: Api.VpcViewPathParams; + query: Api.VpcViewQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/vpcs/:vpc` */ + vpcUpdate: (params: { + path: Api.VpcUpdatePathParams; + query: Api.VpcUpdateQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/vpcs/:vpc` */ + vpcDelete: (params: { + path: Api.VpcDeletePathParams; + query: Api.VpcDeleteQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/webhook-receivers` */ + webhookReceiverCreate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `PUT /v1/webhook-receivers/:receiver` */ + webhookReceiverUpdate: (params: { + path: Api.WebhookReceiverUpdatePathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable; + /** `GET /v1/webhook-secrets` */ + webhookSecretsList: (params: { + query: Api.WebhookSecretsListQueryParams; + req: Request; + cookies: Record; + }) => Promisable>; + /** `POST /v1/webhook-secrets` */ + webhookSecretsAdd: (params: { + query: Api.WebhookSecretsAddQueryParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/webhook-secrets/:secretId` */ + webhookSecretsDelete: (params: { + path: Api.WebhookSecretsDeletePathParams; + req: Request; + cookies: Record; + }) => Promisable; +} + +function validateParams( + schema: S, + req: Request, + pathParams: PathParams, +) { + const rawParams = new URLSearchParams(new URL(req.url).search); + const params: [string, unknown][] = []; + + // Ensure numeric params like `limit` are parsed as numbers + for (const [name, value] of rawParams) { + params.push([name, isNaN(Number(value)) ? value : Number(value)]); + } + + const result = schema.safeParse({ + path: pathParams, + query: Object.fromEntries(params), + }); + + if (result.success) { + return { params: result.data }; + } + + // if any of the errors come from path params, just 404 — the resource cannot + // exist if there's no valid name + const status = result.error.issues.some((e) => e.path[0] === "path") + ? 404 + : 400; + const error_code = status === 404 ? "NotFound" : "InvalidRequest"; + const message = "Zod error for params: " + JSON.stringify(result.error); + return { paramsErr: json({ error_code, message }, { status }) }; +} + +const handler = + ( + handler: MSWHandlers[keyof MSWHandlers], + paramSchema: ZodSchema | null, + bodySchema: ZodSchema | null, + ) => + async ({ + request: req, + params: pathParams, + cookies, + }: { + request: Request; + params: PathParams; + cookies: Record; + }) => { + const { params, paramsErr } = paramSchema + ? validateParams(paramSchema, req, pathParams) + : { params: {}, paramsErr: undefined }; + if (paramsErr) return paramsErr; + + const { path, query } = params; + + let body = undefined; + if (bodySchema) { + const rawBody = await req.json(); + const result = bodySchema.transform(snakeify).safeParse(rawBody); + if (!result.success) { + const message = "Zod error for body: " + JSON.stringify(result.error); + return json({ error_code: "InvalidRequest", message }, { status: 400 }); + } + body = result.data; + } + + try { + // TypeScript can't narrow the handler down because there's not an explicit relationship between the schema + // being present and the shape of the handler API. The type of this function could be resolved such that the + // relevant schema is required if and only if the handler has a type that matches the inferred schema + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const result = await (handler as any).apply(null, [ + { path, query, body, req, cookies }, + ]); + if (typeof result === "number") { + return new HttpResponse(null, { status: result }); + } + if (result instanceof Response) { + return result; + } + return json(result); + } catch (thrown) { + if (typeof thrown === "number") { + return new HttpResponse(null, { status: thrown }); + } + if (typeof thrown === "string") { + return json({ message: thrown }, { status: 400 }); + } + if (thrown instanceof Response) { + return thrown; + } + + // if it's not one of those, then we don't know what to do with it + console.error("Unexpected mock error", thrown); + if (typeof thrown === "function") { + console.error( + "It looks like you've accidentally thrown an error constructor function from a mock handler without calling it!", + ); + } + // rethrow so everything breaks because this isn't supposed to happen + throw thrown; + } + }; + +export function makeHandlers(handlers: MSWHandlers): HttpHandler[] { + return [ + http.post( + "/device/auth", + handler(handlers["deviceAuthRequest"], null, null), + ), + http.post( + "/device/confirm", + handler(handlers["deviceAuthConfirm"], null, schema.DeviceAuthVerify), + ), + http.post( + "/device/token", + handler(handlers["deviceAccessToken"], null, null), + ), + http.get( + "/experimental/v1/probes", + handler(handlers["probeList"], schema.ProbeListParams, null), + ), + http.post( + "/experimental/v1/probes", + handler( + handlers["probeCreate"], + schema.ProbeCreateParams, + schema.ProbeCreate, + ), + ), + http.get( + "/experimental/v1/probes/:probe", + handler(handlers["probeView"], schema.ProbeViewParams, null), + ), + http.delete( + "/experimental/v1/probes/:probe", + handler(handlers["probeDelete"], schema.ProbeDeleteParams, null), + ), + http.get( + "/experimental/v1/system/support-bundles", + handler( + handlers["supportBundleList"], + schema.SupportBundleListParams, + null, + ), + ), + http.post( + "/experimental/v1/system/support-bundles", + handler( + handlers["supportBundleCreate"], + null, + schema.SupportBundleCreate, + ), + ), + http.get( + "/experimental/v1/system/support-bundles/:bundleId", + handler( + handlers["supportBundleView"], + schema.SupportBundleViewParams, + null, + ), + ), + http.put( + "/experimental/v1/system/support-bundles/:bundleId", + handler( + handlers["supportBundleUpdate"], + schema.SupportBundleUpdateParams, + schema.SupportBundleUpdate, + ), + ), + http.delete( + "/experimental/v1/system/support-bundles/:bundleId", + handler( + handlers["supportBundleDelete"], + schema.SupportBundleDeleteParams, + null, + ), + ), + http.get( + "/experimental/v1/system/support-bundles/:bundleId/download", + handler( + handlers["supportBundleDownload"], + schema.SupportBundleDownloadParams, + null, + ), + ), + http.head( + "/experimental/v1/system/support-bundles/:bundleId/download", + handler( + handlers["supportBundleHead"], + schema.SupportBundleHeadParams, + null, + ), + ), + http.get( + "/experimental/v1/system/support-bundles/:bundleId/download/:file", + handler( + handlers["supportBundleDownloadFile"], + schema.SupportBundleDownloadFileParams, + null, + ), + ), + http.head( + "/experimental/v1/system/support-bundles/:bundleId/download/:file", + handler( + handlers["supportBundleHeadFile"], + schema.SupportBundleHeadFileParams, + null, + ), + ), + http.get( + "/experimental/v1/system/support-bundles/:bundleId/index", + handler( + handlers["supportBundleIndex"], + schema.SupportBundleIndexParams, + null, + ), + ), + http.post( + "/login/:siloName/saml/:providerName", + handler(handlers["loginSaml"], schema.LoginSamlParams, null), + ), + http.get( + "/v1/affinity-groups", + handler( + handlers["affinityGroupList"], + schema.AffinityGroupListParams, + null, + ), + ), + http.post( + "/v1/affinity-groups", + handler( + handlers["affinityGroupCreate"], + schema.AffinityGroupCreateParams, + schema.AffinityGroupCreate, + ), + ), + http.get( + "/v1/affinity-groups/:affinityGroup", + handler( + handlers["affinityGroupView"], + schema.AffinityGroupViewParams, + null, + ), + ), + http.put( + "/v1/affinity-groups/:affinityGroup", + handler( + handlers["affinityGroupUpdate"], + schema.AffinityGroupUpdateParams, + schema.AffinityGroupUpdate, + ), + ), + http.delete( + "/v1/affinity-groups/:affinityGroup", + handler( + handlers["affinityGroupDelete"], + schema.AffinityGroupDeleteParams, + null, + ), + ), + http.get( + "/v1/affinity-groups/:affinityGroup/members", + handler( + handlers["affinityGroupMemberList"], + schema.AffinityGroupMemberListParams, + null, + ), + ), + http.get( + "/v1/affinity-groups/:affinityGroup/members/instance/:instance", + handler( + handlers["affinityGroupMemberInstanceView"], + schema.AffinityGroupMemberInstanceViewParams, + null, + ), + ), + http.post( + "/v1/affinity-groups/:affinityGroup/members/instance/:instance", + handler( + handlers["affinityGroupMemberInstanceAdd"], + schema.AffinityGroupMemberInstanceAddParams, + null, + ), + ), + http.delete( + "/v1/affinity-groups/:affinityGroup/members/instance/:instance", + handler( + handlers["affinityGroupMemberInstanceDelete"], + schema.AffinityGroupMemberInstanceDeleteParams, + null, + ), + ), + http.get( + "/v1/alert-classes", + handler(handlers["alertClassList"], schema.AlertClassListParams, null), + ), + http.get( + "/v1/alert-receivers", + handler( + handlers["alertReceiverList"], + schema.AlertReceiverListParams, + null, + ), + ), + http.get( + "/v1/alert-receivers/:receiver", + handler( + handlers["alertReceiverView"], + schema.AlertReceiverViewParams, + null, + ), + ), + http.delete( + "/v1/alert-receivers/:receiver", + handler( + handlers["alertReceiverDelete"], + schema.AlertReceiverDeleteParams, + null, + ), + ), + http.get( + "/v1/alert-receivers/:receiver/deliveries", + handler( + handlers["alertDeliveryList"], + schema.AlertDeliveryListParams, + null, + ), + ), + http.post( + "/v1/alert-receivers/:receiver/probe", + handler( + handlers["alertReceiverProbe"], + schema.AlertReceiverProbeParams, + null, + ), + ), + http.post( + "/v1/alert-receivers/:receiver/subscriptions", + handler( + handlers["alertReceiverSubscriptionAdd"], + schema.AlertReceiverSubscriptionAddParams, + schema.AlertSubscriptionCreate, + ), + ), + http.delete( + "/v1/alert-receivers/:receiver/subscriptions/:subscription", + handler( + handlers["alertReceiverSubscriptionRemove"], + schema.AlertReceiverSubscriptionRemoveParams, + null, + ), + ), + http.post( + "/v1/alerts/:alertId/resend", + handler( + handlers["alertDeliveryResend"], + schema.AlertDeliveryResendParams, + null, + ), + ), + http.get( + "/v1/anti-affinity-groups", + handler( + handlers["antiAffinityGroupList"], + schema.AntiAffinityGroupListParams, + null, + ), + ), + http.post( + "/v1/anti-affinity-groups", + handler( + handlers["antiAffinityGroupCreate"], + schema.AntiAffinityGroupCreateParams, + schema.AntiAffinityGroupCreate, + ), + ), + http.get( + "/v1/anti-affinity-groups/:antiAffinityGroup", + handler( + handlers["antiAffinityGroupView"], + schema.AntiAffinityGroupViewParams, + null, + ), + ), + http.put( + "/v1/anti-affinity-groups/:antiAffinityGroup", + handler( + handlers["antiAffinityGroupUpdate"], + schema.AntiAffinityGroupUpdateParams, + schema.AntiAffinityGroupUpdate, + ), + ), + http.delete( + "/v1/anti-affinity-groups/:antiAffinityGroup", + handler( + handlers["antiAffinityGroupDelete"], + schema.AntiAffinityGroupDeleteParams, + null, + ), + ), + http.get( + "/v1/anti-affinity-groups/:antiAffinityGroup/members", + handler( + handlers["antiAffinityGroupMemberList"], + schema.AntiAffinityGroupMemberListParams, + null, + ), + ), + http.get( + "/v1/anti-affinity-groups/:antiAffinityGroup/members/instance/:instance", + handler( + handlers["antiAffinityGroupMemberInstanceView"], + schema.AntiAffinityGroupMemberInstanceViewParams, + null, + ), + ), + http.post( + "/v1/anti-affinity-groups/:antiAffinityGroup/members/instance/:instance", + handler( + handlers["antiAffinityGroupMemberInstanceAdd"], + schema.AntiAffinityGroupMemberInstanceAddParams, + null, + ), + ), + http.delete( + "/v1/anti-affinity-groups/:antiAffinityGroup/members/instance/:instance", + handler( + handlers["antiAffinityGroupMemberInstanceDelete"], + schema.AntiAffinityGroupMemberInstanceDeleteParams, + null, + ), + ), + http.get( + "/v1/auth-settings", + handler(handlers["authSettingsView"], null, null), + ), + http.put( + "/v1/auth-settings", + handler( + handlers["authSettingsUpdate"], + null, + schema.SiloAuthSettingsUpdate, + ), + ), + http.get( + "/v1/certificates", + handler(handlers["certificateList"], schema.CertificateListParams, null), + ), + http.post( + "/v1/certificates", + handler(handlers["certificateCreate"], null, schema.CertificateCreate), + ), + http.get( + "/v1/certificates/:certificate", + handler(handlers["certificateView"], schema.CertificateViewParams, null), + ), + http.delete( + "/v1/certificates/:certificate", + handler( + handlers["certificateDelete"], + schema.CertificateDeleteParams, + null, + ), + ), + http.get( + "/v1/disks", + handler(handlers["diskList"], schema.DiskListParams, null), + ), + http.post( + "/v1/disks", + handler( + handlers["diskCreate"], + schema.DiskCreateParams, + schema.DiskCreate, + ), + ), + http.get( + "/v1/disks/:disk", + handler(handlers["diskView"], schema.DiskViewParams, null), + ), + http.delete( + "/v1/disks/:disk", + handler(handlers["diskDelete"], schema.DiskDeleteParams, null), + ), + http.post( + "/v1/disks/:disk/bulk-write", + handler( + handlers["diskBulkWriteImport"], + schema.DiskBulkWriteImportParams, + schema.ImportBlocksBulkWrite, + ), + ), + http.post( + "/v1/disks/:disk/bulk-write-start", + handler( + handlers["diskBulkWriteImportStart"], + schema.DiskBulkWriteImportStartParams, + null, + ), + ), + http.post( + "/v1/disks/:disk/bulk-write-stop", + handler( + handlers["diskBulkWriteImportStop"], + schema.DiskBulkWriteImportStopParams, + null, + ), + ), + http.post( + "/v1/disks/:disk/finalize", + handler( + handlers["diskFinalizeImport"], + schema.DiskFinalizeImportParams, + schema.FinalizeDisk, + ), + ), + http.get( + "/v1/floating-ips", + handler(handlers["floatingIpList"], schema.FloatingIpListParams, null), + ), + http.post( + "/v1/floating-ips", + handler( + handlers["floatingIpCreate"], + schema.FloatingIpCreateParams, + schema.FloatingIpCreate, + ), + ), + http.get( + "/v1/floating-ips/:floatingIp", + handler(handlers["floatingIpView"], schema.FloatingIpViewParams, null), + ), + http.put( + "/v1/floating-ips/:floatingIp", + handler( + handlers["floatingIpUpdate"], + schema.FloatingIpUpdateParams, + schema.FloatingIpUpdate, + ), + ), + http.delete( + "/v1/floating-ips/:floatingIp", + handler( + handlers["floatingIpDelete"], + schema.FloatingIpDeleteParams, + null, + ), + ), + http.post( + "/v1/floating-ips/:floatingIp/attach", + handler( + handlers["floatingIpAttach"], + schema.FloatingIpAttachParams, + schema.FloatingIpAttach, + ), + ), + http.post( + "/v1/floating-ips/:floatingIp/detach", + handler( + handlers["floatingIpDetach"], + schema.FloatingIpDetachParams, + null, + ), + ), + http.get( + "/v1/groups", + handler(handlers["groupList"], schema.GroupListParams, null), + ), + http.get( + "/v1/groups/:groupId", + handler(handlers["groupView"], schema.GroupViewParams, null), + ), + http.get( + "/v1/images", + handler(handlers["imageList"], schema.ImageListParams, null), + ), + http.post( + "/v1/images", + handler( + handlers["imageCreate"], + schema.ImageCreateParams, + schema.ImageCreate, + ), + ), + http.get( + "/v1/images/:image", + handler(handlers["imageView"], schema.ImageViewParams, null), + ), + http.delete( + "/v1/images/:image", + handler(handlers["imageDelete"], schema.ImageDeleteParams, null), + ), + http.post( + "/v1/images/:image/demote", + handler(handlers["imageDemote"], schema.ImageDemoteParams, null), + ), + http.post( + "/v1/images/:image/promote", + handler(handlers["imagePromote"], schema.ImagePromoteParams, null), + ), + http.get( + "/v1/instances", + handler(handlers["instanceList"], schema.InstanceListParams, null), + ), + http.post( + "/v1/instances", + handler( + handlers["instanceCreate"], + schema.InstanceCreateParams, + schema.InstanceCreate, + ), + ), + http.get( + "/v1/instances/:instance", + handler(handlers["instanceView"], schema.InstanceViewParams, null), + ), + http.put( + "/v1/instances/:instance", + handler( + handlers["instanceUpdate"], + schema.InstanceUpdateParams, + schema.InstanceUpdate, + ), + ), + http.delete( + "/v1/instances/:instance", + handler(handlers["instanceDelete"], schema.InstanceDeleteParams, null), + ), + http.get( + "/v1/instances/:instance/affinity-groups", + handler( + handlers["instanceAffinityGroupList"], + schema.InstanceAffinityGroupListParams, + null, + ), + ), + http.get( + "/v1/instances/:instance/anti-affinity-groups", + handler( + handlers["instanceAntiAffinityGroupList"], + schema.InstanceAntiAffinityGroupListParams, + null, + ), + ), + http.get( + "/v1/instances/:instance/disks", + handler( + handlers["instanceDiskList"], + schema.InstanceDiskListParams, + null, + ), + ), + http.post( + "/v1/instances/:instance/disks/attach", + handler( + handlers["instanceDiskAttach"], + schema.InstanceDiskAttachParams, + schema.DiskPath, + ), + ), + http.post( + "/v1/instances/:instance/disks/detach", + handler( + handlers["instanceDiskDetach"], + schema.InstanceDiskDetachParams, + schema.DiskPath, + ), + ), + http.get( + "/v1/instances/:instance/external-ips", + handler( + handlers["instanceExternalIpList"], + schema.InstanceExternalIpListParams, + null, + ), + ), + http.post( + "/v1/instances/:instance/external-ips/ephemeral", + handler( + handlers["instanceEphemeralIpAttach"], + schema.InstanceEphemeralIpAttachParams, + schema.EphemeralIpCreate, + ), + ), + http.delete( + "/v1/instances/:instance/external-ips/ephemeral", + handler( + handlers["instanceEphemeralIpDetach"], + schema.InstanceEphemeralIpDetachParams, + null, + ), + ), + http.post( + "/v1/instances/:instance/reboot", + handler(handlers["instanceReboot"], schema.InstanceRebootParams, null), + ), + http.get( + "/v1/instances/:instance/serial-console", + handler( + handlers["instanceSerialConsole"], + schema.InstanceSerialConsoleParams, + null, + ), + ), + http.get( + "/v1/instances/:instance/serial-console/stream", + handler( + handlers["instanceSerialConsoleStream"], + schema.InstanceSerialConsoleStreamParams, + null, + ), + ), + http.get( + "/v1/instances/:instance/ssh-public-keys", + handler( + handlers["instanceSshPublicKeyList"], + schema.InstanceSshPublicKeyListParams, + null, + ), + ), + http.post( + "/v1/instances/:instance/start", + handler(handlers["instanceStart"], schema.InstanceStartParams, null), + ), + http.post( + "/v1/instances/:instance/stop", + handler(handlers["instanceStop"], schema.InstanceStopParams, null), + ), + http.get( + "/v1/internet-gateway-ip-addresses", + handler( + handlers["internetGatewayIpAddressList"], + schema.InternetGatewayIpAddressListParams, + null, + ), + ), + http.post( + "/v1/internet-gateway-ip-addresses", + handler( + handlers["internetGatewayIpAddressCreate"], + schema.InternetGatewayIpAddressCreateParams, + schema.InternetGatewayIpAddressCreate, + ), + ), + http.delete( + "/v1/internet-gateway-ip-addresses/:address", + handler( + handlers["internetGatewayIpAddressDelete"], + schema.InternetGatewayIpAddressDeleteParams, + null, + ), + ), + http.get( + "/v1/internet-gateway-ip-pools", + handler( + handlers["internetGatewayIpPoolList"], + schema.InternetGatewayIpPoolListParams, + null, + ), + ), + http.post( + "/v1/internet-gateway-ip-pools", + handler( + handlers["internetGatewayIpPoolCreate"], + schema.InternetGatewayIpPoolCreateParams, + schema.InternetGatewayIpPoolCreate, + ), + ), + http.delete( + "/v1/internet-gateway-ip-pools/:pool", + handler( + handlers["internetGatewayIpPoolDelete"], + schema.InternetGatewayIpPoolDeleteParams, + null, + ), + ), + http.get( + "/v1/internet-gateways", + handler( + handlers["internetGatewayList"], + schema.InternetGatewayListParams, + null, + ), + ), + http.post( + "/v1/internet-gateways", + handler( + handlers["internetGatewayCreate"], + schema.InternetGatewayCreateParams, + schema.InternetGatewayCreate, + ), + ), + http.get( + "/v1/internet-gateways/:gateway", + handler( + handlers["internetGatewayView"], + schema.InternetGatewayViewParams, + null, + ), + ), + http.delete( + "/v1/internet-gateways/:gateway", + handler( + handlers["internetGatewayDelete"], + schema.InternetGatewayDeleteParams, + null, + ), + ), + http.get( + "/v1/ip-pools", + handler( + handlers["projectIpPoolList"], + schema.ProjectIpPoolListParams, + null, + ), + ), + http.get( + "/v1/ip-pools/:pool", + handler( + handlers["projectIpPoolView"], + schema.ProjectIpPoolViewParams, + null, + ), + ), + http.post( + "/v1/login/:siloName/local", + handler( + handlers["loginLocal"], + schema.LoginLocalParams, + schema.UsernamePasswordCredentials, + ), + ), + http.post("/v1/logout", handler(handlers["logout"], null, null)), + http.get("/v1/me", handler(handlers["currentUserView"], null, null)), + http.get( + "/v1/me/access-tokens", + handler( + handlers["currentUserAccessTokenList"], + schema.CurrentUserAccessTokenListParams, + null, + ), + ), + http.delete( + "/v1/me/access-tokens/:tokenId", + handler( + handlers["currentUserAccessTokenDelete"], + schema.CurrentUserAccessTokenDeleteParams, + null, + ), + ), + http.get( + "/v1/me/groups", + handler( + handlers["currentUserGroups"], + schema.CurrentUserGroupsParams, + null, + ), + ), + http.get( + "/v1/me/ssh-keys", + handler( + handlers["currentUserSshKeyList"], + schema.CurrentUserSshKeyListParams, + null, + ), + ), + http.post( + "/v1/me/ssh-keys", + handler(handlers["currentUserSshKeyCreate"], null, schema.SshKeyCreate), + ), + http.get( + "/v1/me/ssh-keys/:sshKey", + handler( + handlers["currentUserSshKeyView"], + schema.CurrentUserSshKeyViewParams, + null, + ), + ), + http.delete( + "/v1/me/ssh-keys/:sshKey", + handler( + handlers["currentUserSshKeyDelete"], + schema.CurrentUserSshKeyDeleteParams, + null, + ), + ), + http.get( + "/v1/metrics/:metricName", + handler(handlers["siloMetric"], schema.SiloMetricParams, null), + ), + http.get( + "/v1/network-interfaces", + handler( + handlers["instanceNetworkInterfaceList"], + schema.InstanceNetworkInterfaceListParams, + null, + ), + ), + http.post( + "/v1/network-interfaces", + handler( + handlers["instanceNetworkInterfaceCreate"], + schema.InstanceNetworkInterfaceCreateParams, + schema.InstanceNetworkInterfaceCreate, + ), + ), + http.get( + "/v1/network-interfaces/:interface", + handler( + handlers["instanceNetworkInterfaceView"], + schema.InstanceNetworkInterfaceViewParams, + null, + ), + ), + http.put( + "/v1/network-interfaces/:interface", + handler( + handlers["instanceNetworkInterfaceUpdate"], + schema.InstanceNetworkInterfaceUpdateParams, + schema.InstanceNetworkInterfaceUpdate, + ), + ), + http.delete( + "/v1/network-interfaces/:interface", + handler( + handlers["instanceNetworkInterfaceDelete"], + schema.InstanceNetworkInterfaceDeleteParams, + null, + ), + ), + http.get("/v1/ping", handler(handlers["ping"], null, null)), + http.get("/v1/policy", handler(handlers["policyView"], null, null)), + http.put( + "/v1/policy", + handler(handlers["policyUpdate"], null, schema.SiloRolePolicy), + ), + http.get( + "/v1/projects", + handler(handlers["projectList"], schema.ProjectListParams, null), + ), + http.post( + "/v1/projects", + handler(handlers["projectCreate"], null, schema.ProjectCreate), + ), + http.get( + "/v1/projects/:project", + handler(handlers["projectView"], schema.ProjectViewParams, null), + ), + http.put( + "/v1/projects/:project", + handler( + handlers["projectUpdate"], + schema.ProjectUpdateParams, + schema.ProjectUpdate, + ), + ), + http.delete( + "/v1/projects/:project", + handler(handlers["projectDelete"], schema.ProjectDeleteParams, null), + ), + http.get( + "/v1/projects/:project/policy", + handler( + handlers["projectPolicyView"], + schema.ProjectPolicyViewParams, + null, + ), + ), + http.put( + "/v1/projects/:project/policy", + handler( + handlers["projectPolicyUpdate"], + schema.ProjectPolicyUpdateParams, + schema.ProjectRolePolicy, + ), + ), + http.get( + "/v1/snapshots", + handler(handlers["snapshotList"], schema.SnapshotListParams, null), + ), + http.post( + "/v1/snapshots", + handler( + handlers["snapshotCreate"], + schema.SnapshotCreateParams, + schema.SnapshotCreate, + ), + ), + http.get( + "/v1/snapshots/:snapshot", + handler(handlers["snapshotView"], schema.SnapshotViewParams, null), + ), + http.delete( + "/v1/snapshots/:snapshot", + handler(handlers["snapshotDelete"], schema.SnapshotDeleteParams, null), + ), + http.get( + "/v1/system/audit-log", + handler(handlers["auditLogList"], schema.AuditLogListParams, null), + ), + http.get( + "/v1/system/hardware/disks", + handler( + handlers["physicalDiskList"], + schema.PhysicalDiskListParams, + null, + ), + ), + http.get( + "/v1/system/hardware/disks/:diskId", + handler( + handlers["physicalDiskView"], + schema.PhysicalDiskViewParams, + null, + ), + ), + http.get( + "/v1/system/hardware/rack-switch-port/:rackId/:switchLocation/:port/lldp/neighbors", + handler( + handlers["networkingSwitchPortLldpNeighbors"], + schema.NetworkingSwitchPortLldpNeighborsParams, + null, + ), + ), + http.get( + "/v1/system/hardware/racks", + handler(handlers["rackList"], schema.RackListParams, null), + ), + http.get( + "/v1/system/hardware/racks/:rackId", + handler(handlers["rackView"], schema.RackViewParams, null), + ), + http.get( + "/v1/system/hardware/sleds", + handler(handlers["sledList"], schema.SledListParams, null), + ), + http.post( + "/v1/system/hardware/sleds", + handler(handlers["sledAdd"], null, schema.UninitializedSledId), + ), + http.get( + "/v1/system/hardware/sleds/:sledId", + handler(handlers["sledView"], schema.SledViewParams, null), + ), + http.get( + "/v1/system/hardware/sleds/:sledId/disks", + handler( + handlers["sledPhysicalDiskList"], + schema.SledPhysicalDiskListParams, + null, + ), + ), + http.get( + "/v1/system/hardware/sleds/:sledId/instances", + handler( + handlers["sledInstanceList"], + schema.SledInstanceListParams, + null, + ), + ), + http.put( + "/v1/system/hardware/sleds/:sledId/provision-policy", + handler( + handlers["sledSetProvisionPolicy"], + schema.SledSetProvisionPolicyParams, + schema.SledProvisionPolicyParams, + ), + ), + http.get( + "/v1/system/hardware/sleds-uninitialized", + handler( + handlers["sledListUninitialized"], + schema.SledListUninitializedParams, + null, + ), + ), + http.get( + "/v1/system/hardware/switch-port", + handler( + handlers["networkingSwitchPortList"], + schema.NetworkingSwitchPortListParams, + null, + ), + ), + http.get( + "/v1/system/hardware/switch-port/:port/lldp/config", + handler( + handlers["networkingSwitchPortLldpConfigView"], + schema.NetworkingSwitchPortLldpConfigViewParams, + null, + ), + ), + http.post( + "/v1/system/hardware/switch-port/:port/lldp/config", + handler( + handlers["networkingSwitchPortLldpConfigUpdate"], + schema.NetworkingSwitchPortLldpConfigUpdateParams, + schema.LldpLinkConfig, + ), + ), + http.post( + "/v1/system/hardware/switch-port/:port/settings", + handler( + handlers["networkingSwitchPortApplySettings"], + schema.NetworkingSwitchPortApplySettingsParams, + schema.SwitchPortApplySettings, + ), + ), + http.delete( + "/v1/system/hardware/switch-port/:port/settings", + handler( + handlers["networkingSwitchPortClearSettings"], + schema.NetworkingSwitchPortClearSettingsParams, + null, + ), + ), + http.get( + "/v1/system/hardware/switch-port/:port/status", + handler( + handlers["networkingSwitchPortStatus"], + schema.NetworkingSwitchPortStatusParams, + null, + ), + ), + http.get( + "/v1/system/hardware/switches", + handler(handlers["switchList"], schema.SwitchListParams, null), + ), + http.get( + "/v1/system/hardware/switches/:switchId", + handler(handlers["switchView"], schema.SwitchViewParams, null), + ), + http.get( + "/v1/system/identity-providers", + handler( + handlers["siloIdentityProviderList"], + schema.SiloIdentityProviderListParams, + null, + ), + ), + http.post( + "/v1/system/identity-providers/local/users", + handler( + handlers["localIdpUserCreate"], + schema.LocalIdpUserCreateParams, + schema.UserCreate, + ), + ), + http.delete( + "/v1/system/identity-providers/local/users/:userId", + handler( + handlers["localIdpUserDelete"], + schema.LocalIdpUserDeleteParams, + null, + ), + ), + http.post( + "/v1/system/identity-providers/local/users/:userId/set-password", + handler( + handlers["localIdpUserSetPassword"], + schema.LocalIdpUserSetPasswordParams, + schema.UserPassword, + ), + ), + http.post( + "/v1/system/identity-providers/saml", + handler( + handlers["samlIdentityProviderCreate"], + schema.SamlIdentityProviderCreateParams, + schema.SamlIdentityProviderCreate, + ), + ), + http.get( + "/v1/system/identity-providers/saml/:provider", + handler( + handlers["samlIdentityProviderView"], + schema.SamlIdentityProviderViewParams, + null, + ), + ), + http.get( + "/v1/system/ip-pools", + handler(handlers["ipPoolList"], schema.IpPoolListParams, null), + ), + http.post( + "/v1/system/ip-pools", + handler(handlers["ipPoolCreate"], null, schema.IpPoolCreate), + ), + http.get( + "/v1/system/ip-pools/:pool", + handler(handlers["ipPoolView"], schema.IpPoolViewParams, null), + ), + http.put( + "/v1/system/ip-pools/:pool", + handler( + handlers["ipPoolUpdate"], + schema.IpPoolUpdateParams, + schema.IpPoolUpdate, + ), + ), + http.delete( + "/v1/system/ip-pools/:pool", + handler(handlers["ipPoolDelete"], schema.IpPoolDeleteParams, null), + ), + http.get( + "/v1/system/ip-pools/:pool/ranges", + handler(handlers["ipPoolRangeList"], schema.IpPoolRangeListParams, null), + ), + http.post( + "/v1/system/ip-pools/:pool/ranges/add", + handler( + handlers["ipPoolRangeAdd"], + schema.IpPoolRangeAddParams, + schema.IpRange, + ), + ), + http.post( + "/v1/system/ip-pools/:pool/ranges/remove", + handler( + handlers["ipPoolRangeRemove"], + schema.IpPoolRangeRemoveParams, + schema.IpRange, + ), + ), + http.get( + "/v1/system/ip-pools/:pool/silos", + handler(handlers["ipPoolSiloList"], schema.IpPoolSiloListParams, null), + ), + http.post( + "/v1/system/ip-pools/:pool/silos", + handler( + handlers["ipPoolSiloLink"], + schema.IpPoolSiloLinkParams, + schema.IpPoolLinkSilo, + ), + ), + http.put( + "/v1/system/ip-pools/:pool/silos/:silo", + handler( + handlers["ipPoolSiloUpdate"], + schema.IpPoolSiloUpdateParams, + schema.IpPoolSiloUpdate, + ), + ), + http.delete( + "/v1/system/ip-pools/:pool/silos/:silo", + handler( + handlers["ipPoolSiloUnlink"], + schema.IpPoolSiloUnlinkParams, + null, + ), + ), + http.get( + "/v1/system/ip-pools/:pool/utilization", + handler( + handlers["ipPoolUtilizationView"], + schema.IpPoolUtilizationViewParams, + null, + ), + ), + http.get( + "/v1/system/ip-pools-service", + handler(handlers["ipPoolServiceView"], null, null), + ), + http.get( + "/v1/system/ip-pools-service/ranges", + handler( + handlers["ipPoolServiceRangeList"], + schema.IpPoolServiceRangeListParams, + null, + ), + ), + http.post( + "/v1/system/ip-pools-service/ranges/add", + handler(handlers["ipPoolServiceRangeAdd"], null, schema.IpRange), + ), + http.post( + "/v1/system/ip-pools-service/ranges/remove", + handler(handlers["ipPoolServiceRangeRemove"], null, schema.IpRange), + ), + http.get( + "/v1/system/metrics/:metricName", + handler(handlers["systemMetric"], schema.SystemMetricParams, null), + ), + http.get( + "/v1/system/networking/address-lot", + handler( + handlers["networkingAddressLotList"], + schema.NetworkingAddressLotListParams, + null, + ), + ), + http.post( + "/v1/system/networking/address-lot", + handler( + handlers["networkingAddressLotCreate"], + null, + schema.AddressLotCreate, + ), + ), + http.delete( + "/v1/system/networking/address-lot/:addressLot", + handler( + handlers["networkingAddressLotDelete"], + schema.NetworkingAddressLotDeleteParams, + null, + ), + ), + http.get( + "/v1/system/networking/address-lot/:addressLot/blocks", + handler( + handlers["networkingAddressLotBlockList"], + schema.NetworkingAddressLotBlockListParams, + null, + ), + ), + http.get( + "/v1/system/networking/allow-list", + handler(handlers["networkingAllowListView"], null, null), + ), + http.put( + "/v1/system/networking/allow-list", + handler( + handlers["networkingAllowListUpdate"], + null, + schema.AllowListUpdate, + ), + ), + http.post( + "/v1/system/networking/bfd-disable", + handler(handlers["networkingBfdDisable"], null, schema.BfdSessionDisable), + ), + http.post( + "/v1/system/networking/bfd-enable", + handler(handlers["networkingBfdEnable"], null, schema.BfdSessionEnable), + ), + http.get( + "/v1/system/networking/bfd-status", + handler(handlers["networkingBfdStatus"], null, null), + ), + http.get( + "/v1/system/networking/bgp", + handler( + handlers["networkingBgpConfigList"], + schema.NetworkingBgpConfigListParams, + null, + ), + ), + http.post( + "/v1/system/networking/bgp", + handler( + handlers["networkingBgpConfigCreate"], + null, + schema.BgpConfigCreate, + ), + ), + http.delete( + "/v1/system/networking/bgp", + handler( + handlers["networkingBgpConfigDelete"], + schema.NetworkingBgpConfigDeleteParams, + null, + ), + ), + http.get( + "/v1/system/networking/bgp-announce-set", + handler( + handlers["networkingBgpAnnounceSetList"], + schema.NetworkingBgpAnnounceSetListParams, + null, + ), + ), + http.put( + "/v1/system/networking/bgp-announce-set", + handler( + handlers["networkingBgpAnnounceSetUpdate"], + null, + schema.BgpAnnounceSetCreate, + ), + ), + http.delete( + "/v1/system/networking/bgp-announce-set/:announceSet", + handler( + handlers["networkingBgpAnnounceSetDelete"], + schema.NetworkingBgpAnnounceSetDeleteParams, + null, + ), + ), + http.get( + "/v1/system/networking/bgp-announce-set/:announceSet/announcement", + handler( + handlers["networkingBgpAnnouncementList"], + schema.NetworkingBgpAnnouncementListParams, + null, + ), + ), + http.get( + "/v1/system/networking/bgp-exported", + handler(handlers["networkingBgpExported"], null, null), + ), + http.get( + "/v1/system/networking/bgp-message-history", + handler( + handlers["networkingBgpMessageHistory"], + schema.NetworkingBgpMessageHistoryParams, + null, + ), + ), + http.get( + "/v1/system/networking/bgp-routes-ipv4", + handler( + handlers["networkingBgpImportedRoutesIpv4"], + schema.NetworkingBgpImportedRoutesIpv4Params, + null, + ), + ), + http.get( + "/v1/system/networking/bgp-status", + handler(handlers["networkingBgpStatus"], null, null), + ), + http.get( + "/v1/system/networking/inbound-icmp", + handler(handlers["networkingInboundIcmpView"], null, null), + ), + http.put( + "/v1/system/networking/inbound-icmp", + handler( + handlers["networkingInboundIcmpUpdate"], + null, + schema.ServiceIcmpConfig, + ), + ), + http.get( + "/v1/system/networking/loopback-address", + handler( + handlers["networkingLoopbackAddressList"], + schema.NetworkingLoopbackAddressListParams, + null, + ), + ), + http.post( + "/v1/system/networking/loopback-address", + handler( + handlers["networkingLoopbackAddressCreate"], + null, + schema.LoopbackAddressCreate, + ), + ), + http.delete( + "/v1/system/networking/loopback-address/:rackId/:switchLocation/:address/:subnetMask", + handler( + handlers["networkingLoopbackAddressDelete"], + schema.NetworkingLoopbackAddressDeleteParams, + null, + ), + ), + http.get( + "/v1/system/networking/switch-port-settings", + handler( + handlers["networkingSwitchPortSettingsList"], + schema.NetworkingSwitchPortSettingsListParams, + null, + ), + ), + http.post( + "/v1/system/networking/switch-port-settings", + handler( + handlers["networkingSwitchPortSettingsCreate"], + null, + schema.SwitchPortSettingsCreate, + ), + ), + http.delete( + "/v1/system/networking/switch-port-settings", + handler( + handlers["networkingSwitchPortSettingsDelete"], + schema.NetworkingSwitchPortSettingsDeleteParams, + null, + ), + ), + http.get( + "/v1/system/networking/switch-port-settings/:port", + handler( + handlers["networkingSwitchPortSettingsView"], + schema.NetworkingSwitchPortSettingsViewParams, + null, + ), + ), + http.get( + "/v1/system/policy", + handler(handlers["systemPolicyView"], null, null), + ), + http.put( + "/v1/system/policy", + handler(handlers["systemPolicyUpdate"], null, schema.FleetRolePolicy), + ), + http.get( + "/v1/system/silo-quotas", + handler( + handlers["systemQuotasList"], + schema.SystemQuotasListParams, + null, + ), + ), + http.get( + "/v1/system/silos", + handler(handlers["siloList"], schema.SiloListParams, null), + ), + http.post( + "/v1/system/silos", + handler(handlers["siloCreate"], null, schema.SiloCreate), + ), + http.get( + "/v1/system/silos/:silo", + handler(handlers["siloView"], schema.SiloViewParams, null), + ), + http.delete( + "/v1/system/silos/:silo", + handler(handlers["siloDelete"], schema.SiloDeleteParams, null), + ), + http.get( + "/v1/system/silos/:silo/ip-pools", + handler(handlers["siloIpPoolList"], schema.SiloIpPoolListParams, null), + ), + http.get( + "/v1/system/silos/:silo/policy", + handler(handlers["siloPolicyView"], schema.SiloPolicyViewParams, null), + ), + http.put( + "/v1/system/silos/:silo/policy", + handler( + handlers["siloPolicyUpdate"], + schema.SiloPolicyUpdateParams, + schema.SiloRolePolicy, + ), + ), + http.get( + "/v1/system/silos/:silo/quotas", + handler(handlers["siloQuotasView"], schema.SiloQuotasViewParams, null), + ), + http.put( + "/v1/system/silos/:silo/quotas", + handler( + handlers["siloQuotasUpdate"], + schema.SiloQuotasUpdateParams, + schema.SiloQuotasUpdate, + ), + ), + http.post( + "/v1/system/timeseries/query", + handler(handlers["systemTimeseriesQuery"], null, schema.TimeseriesQuery), + ), + http.get( + "/v1/system/timeseries/schemas", + handler( + handlers["systemTimeseriesSchemaList"], + schema.SystemTimeseriesSchemaListParams, + null, + ), + ), + http.put( + "/v1/system/update/repository", + handler( + handlers["systemUpdatePutRepository"], + schema.SystemUpdatePutRepositoryParams, + null, + ), + ), + http.get( + "/v1/system/update/repository/:systemVersion", + handler( + handlers["systemUpdateGetRepository"], + schema.SystemUpdateGetRepositoryParams, + null, + ), + ), + http.get( + "/v1/system/update/target-release", + handler(handlers["targetReleaseView"], null, null), + ), + http.put( + "/v1/system/update/target-release", + handler( + handlers["targetReleaseUpdate"], + null, + schema.SetTargetReleaseParams, + ), + ), + http.get( + "/v1/system/update/trust-roots", + handler( + handlers["systemUpdateTrustRootList"], + schema.SystemUpdateTrustRootListParams, + null, + ), + ), + http.post( + "/v1/system/update/trust-roots", + handler(handlers["systemUpdateTrustRootCreate"], null, null), + ), + http.get( + "/v1/system/update/trust-roots/:trustRootId", + handler( + handlers["systemUpdateTrustRootView"], + schema.SystemUpdateTrustRootViewParams, + null, + ), + ), + http.delete( + "/v1/system/update/trust-roots/:trustRootId", + handler( + handlers["systemUpdateTrustRootDelete"], + schema.SystemUpdateTrustRootDeleteParams, + null, + ), + ), + http.get( + "/v1/system/users", + handler(handlers["siloUserList"], schema.SiloUserListParams, null), + ), + http.get( + "/v1/system/users/:userId", + handler(handlers["siloUserView"], schema.SiloUserViewParams, null), + ), + http.get( + "/v1/system/users-builtin", + handler(handlers["userBuiltinList"], schema.UserBuiltinListParams, null), + ), + http.get( + "/v1/system/users-builtin/:user", + handler(handlers["userBuiltinView"], schema.UserBuiltinViewParams, null), + ), + http.get( + "/v1/system/utilization/silos", + handler( + handlers["siloUtilizationList"], + schema.SiloUtilizationListParams, + null, + ), + ), + http.get( + "/v1/system/utilization/silos/:silo", + handler( + handlers["siloUtilizationView"], + schema.SiloUtilizationViewParams, + null, + ), + ), + http.post( + "/v1/timeseries/query", + handler( + handlers["timeseriesQuery"], + schema.TimeseriesQueryParams, + schema.TimeseriesQuery, + ), + ), + http.get( + "/v1/users", + handler(handlers["userList"], schema.UserListParams, null), + ), + http.get( + "/v1/users/:userId", + handler(handlers["userView"], schema.UserViewParams, null), + ), + http.get( + "/v1/users/:userId/access-tokens", + handler(handlers["userTokenList"], schema.UserTokenListParams, null), + ), + http.post( + "/v1/users/:userId/logout", + handler(handlers["userLogout"], schema.UserLogoutParams, null), + ), + http.get( + "/v1/users/:userId/sessions", + handler(handlers["userSessionList"], schema.UserSessionListParams, null), + ), + http.get( + "/v1/utilization", + handler(handlers["utilizationView"], null, null), + ), + http.get( + "/v1/vpc-firewall-rules", + handler( + handlers["vpcFirewallRulesView"], + schema.VpcFirewallRulesViewParams, + null, + ), + ), + http.put( + "/v1/vpc-firewall-rules", + handler( + handlers["vpcFirewallRulesUpdate"], + schema.VpcFirewallRulesUpdateParams, + schema.VpcFirewallRuleUpdateParams, + ), + ), + http.get( + "/v1/vpc-router-routes", + handler( + handlers["vpcRouterRouteList"], + schema.VpcRouterRouteListParams, + null, + ), + ), + http.post( + "/v1/vpc-router-routes", + handler( + handlers["vpcRouterRouteCreate"], + schema.VpcRouterRouteCreateParams, + schema.RouterRouteCreate, + ), + ), + http.get( + "/v1/vpc-router-routes/:route", + handler( + handlers["vpcRouterRouteView"], + schema.VpcRouterRouteViewParams, + null, + ), + ), + http.put( + "/v1/vpc-router-routes/:route", + handler( + handlers["vpcRouterRouteUpdate"], + schema.VpcRouterRouteUpdateParams, + schema.RouterRouteUpdate, + ), + ), + http.delete( + "/v1/vpc-router-routes/:route", + handler( + handlers["vpcRouterRouteDelete"], + schema.VpcRouterRouteDeleteParams, + null, + ), + ), + http.get( + "/v1/vpc-routers", + handler(handlers["vpcRouterList"], schema.VpcRouterListParams, null), + ), + http.post( + "/v1/vpc-routers", + handler( + handlers["vpcRouterCreate"], + schema.VpcRouterCreateParams, + schema.VpcRouterCreate, + ), + ), + http.get( + "/v1/vpc-routers/:router", + handler(handlers["vpcRouterView"], schema.VpcRouterViewParams, null), + ), + http.put( + "/v1/vpc-routers/:router", + handler( + handlers["vpcRouterUpdate"], + schema.VpcRouterUpdateParams, + schema.VpcRouterUpdate, + ), + ), + http.delete( + "/v1/vpc-routers/:router", + handler(handlers["vpcRouterDelete"], schema.VpcRouterDeleteParams, null), + ), + http.get( + "/v1/vpc-subnets", + handler(handlers["vpcSubnetList"], schema.VpcSubnetListParams, null), + ), + http.post( + "/v1/vpc-subnets", + handler( + handlers["vpcSubnetCreate"], + schema.VpcSubnetCreateParams, + schema.VpcSubnetCreate, + ), + ), + http.get( + "/v1/vpc-subnets/:subnet", + handler(handlers["vpcSubnetView"], schema.VpcSubnetViewParams, null), + ), + http.put( + "/v1/vpc-subnets/:subnet", + handler( + handlers["vpcSubnetUpdate"], + schema.VpcSubnetUpdateParams, + schema.VpcSubnetUpdate, + ), + ), + http.delete( + "/v1/vpc-subnets/:subnet", + handler(handlers["vpcSubnetDelete"], schema.VpcSubnetDeleteParams, null), + ), + http.get( + "/v1/vpc-subnets/:subnet/network-interfaces", + handler( + handlers["vpcSubnetListNetworkInterfaces"], + schema.VpcSubnetListNetworkInterfacesParams, + null, + ), + ), + http.get( + "/v1/vpcs", + handler(handlers["vpcList"], schema.VpcListParams, null), + ), + http.post( + "/v1/vpcs", + handler(handlers["vpcCreate"], schema.VpcCreateParams, schema.VpcCreate), + ), + http.get( + "/v1/vpcs/:vpc", + handler(handlers["vpcView"], schema.VpcViewParams, null), + ), + http.put( + "/v1/vpcs/:vpc", + handler(handlers["vpcUpdate"], schema.VpcUpdateParams, schema.VpcUpdate), + ), + http.delete( + "/v1/vpcs/:vpc", + handler(handlers["vpcDelete"], schema.VpcDeleteParams, null), + ), + http.post( + "/v1/webhook-receivers", + handler(handlers["webhookReceiverCreate"], null, schema.WebhookCreate), + ), + http.put( + "/v1/webhook-receivers/:receiver", + handler( + handlers["webhookReceiverUpdate"], + schema.WebhookReceiverUpdateParams, + schema.WebhookReceiverUpdate, + ), + ), + http.get( + "/v1/webhook-secrets", + handler( + handlers["webhookSecretsList"], + schema.WebhookSecretsListParams, + null, + ), + ), + http.post( + "/v1/webhook-secrets", + handler( + handlers["webhookSecretsAdd"], + schema.WebhookSecretsAddParams, + schema.WebhookSecretCreate, + ), + ), + http.delete( + "/v1/webhook-secrets/:secretId", + handler( + handlers["webhookSecretsDelete"], + schema.WebhookSecretsDeleteParams, + null, + ), + ), + ]; +} diff --git a/oxide-api/src/validate.ts b/oxide-api/src/validate.ts new file mode 100644 index 0000000..fa7e153 --- /dev/null +++ b/oxide-api/src/validate.ts @@ -0,0 +1,8091 @@ +/* eslint-disable */ + +import { z, ZodType } from "zod"; +import { processResponseBody, uniqueItems } from "./util"; + +/** + * Zod only supports string enums at the moment. A previous issue was opened + * and closed as stale but it provided a hint on how to implement it. + * + * @see https://github.com/colinhacks/zod/issues/1118 + * TODO: PR an update for zod to support other native enum types + */ +const IntEnum = (values: T) => + z.number().refine((v) => values.includes(v)) as ZodType; + +/** Helper to ensure booleans provided as strings end up with the correct value */ +const SafeBoolean = z.preprocess( + (v) => (v === "false" ? false : v), + z.coerce.boolean(), +); + +/** + * An IPv4 subnet + * + * An IPv4 subnet, including prefix and prefix length + */ +export const Ipv4Net = z.preprocess( + processResponseBody, + z + .string() + .regex( + /^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\/([0-9]|1[0-9]|2[0-9]|3[0-2])$/, + ), +); + +/** + * An IPv6 subnet + * + * An IPv6 subnet, including prefix and subnet mask + */ +export const Ipv6Net = z.preprocess( + processResponseBody, + z + .string() + .regex( + /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])$/, + ), +); + +export const IpNet = z.preprocess( + processResponseBody, + z.union([Ipv4Net, Ipv6Net]), +); + +/** + * A name unique within the parent collection + * + * Names must begin with a lower case ASCII letter, be composed exclusively of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end with a '-'. Names cannot be a UUID, but they may contain a UUID. They can be at most 63 characters long. + */ +export const Name = z.preprocess( + processResponseBody, + z + .string() + .min(1) + .max(63) + .regex( + /^(?![0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)^[a-z]([a-zA-Z0-9-]*[a-zA-Z0-9]+)?$/, + ), +); + +export const NameOrId = z.preprocess( + processResponseBody, + z.union([z.string().uuid(), Name]), +); + +/** + * An address tied to an address lot. + */ +export const Address = z.preprocess( + processResponseBody, + z.object({ + address: IpNet, + addressLot: NameOrId, + vlanId: z.number().min(0).max(65535).nullable().optional(), + }), +); + +/** + * A set of addresses associated with a port configuration. + */ +export const AddressConfig = z.preprocess( + processResponseBody, + z.object({ addresses: Address.array(), linkName: Name }), +); + +/** + * The kind associated with an address lot. + */ +export const AddressLotKind = z.preprocess( + processResponseBody, + z.enum(["infra", "pool"]), +); + +/** + * Represents an address lot object, containing the id of the lot that can be used in other API calls. + */ +export const AddressLot = z.preprocess( + processResponseBody, + z.object({ + description: z.string(), + id: z.string().uuid(), + kind: AddressLotKind, + name: Name, + timeCreated: z.coerce.date(), + timeModified: z.coerce.date(), + }), +); + +/** + * An address lot block is a part of an address lot and contains a range of addresses. The range is inclusive. + */ +export const AddressLotBlock = z.preprocess( + processResponseBody, + z.object({ + firstAddress: z.string().ip(), + id: z.string().uuid(), + lastAddress: z.string().ip(), + }), +); + +/** + * Parameters for creating an address lot block. Fist and last addresses are inclusive. + */ +export const AddressLotBlockCreate = z.preprocess( + processResponseBody, + z.object({ firstAddress: z.string().ip(), lastAddress: z.string().ip() }), +); + +/** + * A single page of results + */ +export const AddressLotBlockResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: AddressLotBlock.array(), + nextPage: z.string().nullable().optional(), + }), +); + +/** + * Parameters for creating an address lot. + */ +export const AddressLotCreate = z.preprocess( + processResponseBody, + z.object({ + blocks: AddressLotBlockCreate.array(), + description: z.string(), + kind: AddressLotKind, + name: Name, + }), +); + +/** + * An address lot and associated blocks resulting from creating an address lot. + */ +export const AddressLotCreateResponse = z.preprocess( + processResponseBody, + z.object({ blocks: AddressLotBlock.array(), lot: AddressLot }), +); + +/** + * A single page of results + */ +export const AddressLotResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: AddressLot.array(), + nextPage: z.string().nullable().optional(), + }), +); + +/** + * Describes the scope of affinity for the purposes of co-location. + */ +export const FailureDomain = z.preprocess( + processResponseBody, + z.enum(["sled"]), +); + +/** + * Affinity policy used to describe "what to do when a request cannot be satisfied" + * + * Used for both Affinity and Anti-Affinity Groups + */ +export const AffinityPolicy = z.preprocess( + processResponseBody, + z.enum(["allow", "fail"]), +); + +/** + * View of an Affinity Group + */ +export const AffinityGroup = z.preprocess( + processResponseBody, + z.object({ + description: z.string(), + failureDomain: FailureDomain, + id: z.string().uuid(), + name: Name, + policy: AffinityPolicy, + projectId: z.string().uuid(), + timeCreated: z.coerce.date(), + timeModified: z.coerce.date(), + }), +); + +/** + * Create-time parameters for an `AffinityGroup` + */ +export const AffinityGroupCreate = z.preprocess( + processResponseBody, + z.object({ + description: z.string(), + failureDomain: FailureDomain, + name: Name, + policy: AffinityPolicy, + }), +); + +export const TypedUuidForInstanceKind = z.preprocess( + processResponseBody, + z.string().uuid(), +); + +/** + * Running state of an Instance (primarily: booted or stopped) + * + * This typically reflects whether it's starting, running, stopping, or stopped, but also includes states related to the Instance's lifecycle + */ +export const InstanceState = z.preprocess( + processResponseBody, + z.enum([ + "creating", + "starting", + "running", + "stopping", + "stopped", + "rebooting", + "migrating", + "repairing", + "failed", + "destroyed", + ]), +); + +/** + * A member of an Affinity Group + * + * Membership in a group is not exclusive - members may belong to multiple affinity / anti-affinity groups. + * + * Affinity Groups can contain up to 32 members. + */ +export const AffinityGroupMember = z.preprocess( + processResponseBody, + z.object({ + type: z.enum(["instance"]), + value: z.object({ + id: TypedUuidForInstanceKind, + name: Name, + runState: InstanceState, + }), + }), +); + +/** + * A single page of results + */ +export const AffinityGroupMemberResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: AffinityGroupMember.array(), + nextPage: z.string().nullable().optional(), + }), +); + +/** + * A single page of results + */ +export const AffinityGroupResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: AffinityGroup.array(), + nextPage: z.string().nullable().optional(), + }), +); + +/** + * Updateable properties of an `AffinityGroup` + */ +export const AffinityGroupUpdate = z.preprocess( + processResponseBody, + z.object({ + description: z.string().nullable().optional(), + name: Name.nullable().optional(), + }), +); + +export const BgpMessageHistory = z.preprocess( + processResponseBody, + z.record(z.unknown()), +); + +/** + * Identifies switch physical location + */ +export const SwitchLocation = z.preprocess( + processResponseBody, + z.enum(["switch0", "switch1"]), +); + +/** + * BGP message history for a particular switch. + */ +export const SwitchBgpHistory = z.preprocess( + processResponseBody, + z.object({ + history: z.record(z.string().min(1), BgpMessageHistory), + switch: SwitchLocation, + }), +); + +/** + * BGP message history for rack switches. + */ +export const AggregateBgpMessageHistory = z.preprocess( + processResponseBody, + z.object({ switchHistories: SwitchBgpHistory.array() }), +); + +/** + * An alert class. + */ +export const AlertClass = z.preprocess( + processResponseBody, + z.object({ description: z.string(), name: z.string() }), +); + +/** + * A single page of results + */ +export const AlertClassResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: AlertClass.array(), + nextPage: z.string().nullable().optional(), + }), +); + +export const TypedUuidForAlertKind = z.preprocess( + processResponseBody, + z.string().uuid(), +); + +/** + * The response received from a webhook receiver endpoint. + */ +export const WebhookDeliveryResponse = z.preprocess( + processResponseBody, + z.object({ + durationMs: z.number().min(0), + status: z.number().min(0).max(65535), + }), +); + +export const WebhookDeliveryAttemptResult = z.preprocess( + processResponseBody, + z.enum([ + "succeeded", + "failed_http_error", + "failed_unreachable", + "failed_timeout", + ]), +); + +/** + * An individual delivery attempt for a webhook event. + * + * This represents a single HTTP request that was sent to the receiver, and its outcome. + */ +export const WebhookDeliveryAttempt = z.preprocess( + processResponseBody, + z.object({ + attempt: z.number().min(0), + response: WebhookDeliveryResponse.nullable().optional(), + result: WebhookDeliveryAttemptResult, + timeSent: z.coerce.date(), + }), +); + +/** + * A list of attempts to deliver an alert to a receiver. + * + * The type of the delivery attempt model depends on the receiver type, as it may contain information specific to that delivery mechanism. For example, webhook delivery attempts contain the HTTP status code of the webhook request. + */ +export const AlertDeliveryAttempts = z.preprocess( + processResponseBody, + z.object({ webhook: WebhookDeliveryAttempt.array() }), +); + +export const TypedUuidForAlertReceiverKind = z.preprocess( + processResponseBody, + z.string().uuid(), +); + +/** + * The state of a webhook delivery attempt. + */ +export const AlertDeliveryState = z.preprocess( + processResponseBody, + z.enum(["pending", "delivered", "failed"]), +); + +/** + * The reason an alert was delivered + */ +export const AlertDeliveryTrigger = z.preprocess( + processResponseBody, + z.enum(["alert", "resend", "probe"]), +); + +/** + * A delivery of a webhook event. + */ +export const AlertDelivery = z.preprocess( + processResponseBody, + z.object({ + alertClass: z.string(), + alertId: TypedUuidForAlertKind, + attempts: AlertDeliveryAttempts, + id: z.string().uuid(), + receiverId: TypedUuidForAlertReceiverKind, + state: AlertDeliveryState, + timeStarted: z.coerce.date(), + trigger: AlertDeliveryTrigger, + }), +); + +export const AlertDeliveryId = z.preprocess( + processResponseBody, + z.object({ deliveryId: z.string().uuid() }), +); + +/** + * A single page of results + */ +export const AlertDeliveryResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: AlertDelivery.array(), + nextPage: z.string().nullable().optional(), + }), +); + +/** + * Data describing the result of an alert receiver liveness probe attempt. + */ +export const AlertProbeResult = z.preprocess( + processResponseBody, + z.object({ + probe: AlertDelivery, + resendsStarted: z.number().min(0).nullable().optional(), + }), +); + +/** + * A view of a shared secret key assigned to a webhook receiver. + * + * Once a secret is created, the value of the secret is not available in the API, as it must remain secret. Instead, secrets are referenced by their unique IDs assigned when they are created. + */ +export const WebhookSecret = z.preprocess( + processResponseBody, + z.object({ id: z.string().uuid(), timeCreated: z.coerce.date() }), +); + +/** + * The possible alert delivery mechanisms for an alert receiver. + */ +export const AlertReceiverKind = z.preprocess( + processResponseBody, + z.object({ + endpoint: z.string(), + kind: z.enum(["webhook"]), + secrets: WebhookSecret.array(), + }), +); + +/** + * A webhook event class subscription + * + * A webhook event class subscription matches either a single event class exactly, or a glob pattern including wildcards that may match multiple event classes + */ +export const AlertSubscription = z.preprocess( + processResponseBody, + z.string().regex(/^([a-zA-Z0-9_]+|\*|\*\*)(\.([a-zA-Z0-9_]+|\*|\*\*))*$/), +); + +/** + * The configuration for an alert receiver. + */ +export const AlertReceiver = z.preprocess( + processResponseBody, + z.object({ + description: z.string(), + id: z.string().uuid(), + kind: AlertReceiverKind, + name: Name, + subscriptions: AlertSubscription.array(), + timeCreated: z.coerce.date(), + timeModified: z.coerce.date(), + }), +); + +/** + * A single page of results + */ +export const AlertReceiverResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: AlertReceiver.array(), + nextPage: z.string().nullable().optional(), + }), +); + +export const AlertSubscriptionCreate = z.preprocess( + processResponseBody, + z.object({ subscription: AlertSubscription }), +); + +export const AlertSubscriptionCreated = z.preprocess( + processResponseBody, + z.object({ subscription: AlertSubscription }), +); + +/** + * Description of source IPs allowed to reach rack services. + */ +export const AllowedSourceIps = z.preprocess( + processResponseBody, + z.union([ + z.object({ allow: z.enum(["any"]) }), + z.object({ allow: z.enum(["list"]), ips: IpNet.array() }), + ]), +); + +/** + * Allowlist of IPs or subnets that can make requests to user-facing services. + */ +export const AllowList = z.preprocess( + processResponseBody, + z.object({ + allowedIps: AllowedSourceIps, + timeCreated: z.coerce.date(), + timeModified: z.coerce.date(), + }), +); + +/** + * Parameters for updating allowed source IPs + */ +export const AllowListUpdate = z.preprocess( + processResponseBody, + z.object({ allowedIps: AllowedSourceIps }), +); + +/** + * View of an Anti-Affinity Group + */ +export const AntiAffinityGroup = z.preprocess( + processResponseBody, + z.object({ + description: z.string(), + failureDomain: FailureDomain, + id: z.string().uuid(), + name: Name, + policy: AffinityPolicy, + projectId: z.string().uuid(), + timeCreated: z.coerce.date(), + timeModified: z.coerce.date(), + }), +); + +/** + * Create-time parameters for an `AntiAffinityGroup` + */ +export const AntiAffinityGroupCreate = z.preprocess( + processResponseBody, + z.object({ + description: z.string(), + failureDomain: FailureDomain, + name: Name, + policy: AffinityPolicy, + }), +); + +/** + * A member of an Anti-Affinity Group + * + * Membership in a group is not exclusive - members may belong to multiple affinity / anti-affinity groups. + * + * Anti-Affinity Groups can contain up to 32 members. + */ +export const AntiAffinityGroupMember = z.preprocess( + processResponseBody, + z.object({ + type: z.enum(["instance"]), + value: z.object({ + id: TypedUuidForInstanceKind, + name: Name, + runState: InstanceState, + }), + }), +); + +/** + * A single page of results + */ +export const AntiAffinityGroupMemberResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: AntiAffinityGroupMember.array(), + nextPage: z.string().nullable().optional(), + }), +); + +/** + * A single page of results + */ +export const AntiAffinityGroupResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: AntiAffinityGroup.array(), + nextPage: z.string().nullable().optional(), + }), +); + +/** + * Updateable properties of an `AntiAffinityGroup` + */ +export const AntiAffinityGroupUpdate = z.preprocess( + processResponseBody, + z.object({ + description: z.string().nullable().optional(), + name: Name.nullable().optional(), + }), +); + +/** + * An identifier for an artifact. + */ +export const ArtifactId = z.preprocess( + processResponseBody, + z.object({ kind: z.string(), name: z.string(), version: z.string() }), +); + +export const AuditLogEntryActor = z.preprocess( + processResponseBody, + z.union([ + z.object({ + kind: z.enum(["user_builtin"]), + userBuiltinId: z.string().uuid(), + }), + z.object({ + kind: z.enum(["silo_user"]), + siloId: z.string().uuid(), + siloUserId: z.string().uuid(), + }), + z.object({ kind: z.enum(["unauthenticated"]) }), + ]), +); + +/** + * Result of an audit log entry + */ +export const AuditLogEntryResult = z.preprocess( + processResponseBody, + z.union([ + z.object({ + httpStatusCode: z.number().min(0).max(65535), + kind: z.enum(["success"]), + }), + z.object({ + errorCode: z.string().nullable().optional(), + errorMessage: z.string(), + httpStatusCode: z.number().min(0).max(65535), + kind: z.enum(["error"]), + }), + z.object({ kind: z.enum(["unknown"]) }), + ]), +); + +/** + * Audit log entry + */ +export const AuditLogEntry = z.preprocess( + processResponseBody, + z.object({ + actor: AuditLogEntryActor, + authMethod: z.string().nullable().optional(), + id: z.string().uuid(), + operationId: z.string(), + requestId: z.string(), + requestUri: z.string(), + result: AuditLogEntryResult, + sourceIp: z.string().ip(), + timeCompleted: z.coerce.date(), + timeStarted: z.coerce.date(), + userAgent: z.string().nullable().optional(), + }), +); + +/** + * A single page of results + */ +export const AuditLogEntryResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: AuditLogEntry.array(), + nextPage: z.string().nullable().optional(), + }), +); + +/** + * Authorization scope for a timeseries. + * + * This describes the level at which a user must be authorized to read data from a timeseries. For example, fleet-scoping means the data is only visible to an operator or fleet reader. Project-scoped, on the other hand, indicates that a user will see data limited to the projects on which they have read permissions. + */ +export const AuthzScope = z.preprocess( + processResponseBody, + z.enum(["fleet", "silo", "project", "viewable_to_all"]), +); + +/** + * Properties that uniquely identify an Oxide hardware component + */ +export const Baseboard = z.preprocess( + processResponseBody, + z.object({ + part: z.string(), + revision: z.number().min(0).max(4294967295), + serial: z.string(), + }), +); + +/** + * BFD connection mode. + */ +export const BfdMode = z.preprocess( + processResponseBody, + z.enum(["single_hop", "multi_hop"]), +); + +/** + * Information needed to disable a BFD session + */ +export const BfdSessionDisable = z.preprocess( + processResponseBody, + z.object({ remote: z.string().ip(), switch: Name }), +); + +/** + * Information about a bidirectional forwarding detection (BFD) session. + */ +export const BfdSessionEnable = z.preprocess( + processResponseBody, + z.object({ + detectionThreshold: z.number().min(0).max(255), + local: z.string().ip().nullable().optional(), + mode: BfdMode, + remote: z.string().ip(), + requiredRx: z.number().min(0), + switch: Name, + }), +); + +export const BfdState = z.preprocess( + processResponseBody, + z.enum(["admin_down", "down", "init", "up"]), +); + +export const BfdStatus = z.preprocess( + processResponseBody, + z.object({ + detectionThreshold: z.number().min(0).max(255), + local: z.string().ip().nullable().optional(), + mode: BfdMode, + peer: z.string().ip(), + requiredRx: z.number().min(0), + state: BfdState, + switch: Name, + }), +); + +/** + * Represents a BGP announce set by id. The id can be used with other API calls to view and manage the announce set. + */ +export const BgpAnnounceSet = z.preprocess( + processResponseBody, + z.object({ + description: z.string(), + id: z.string().uuid(), + name: Name, + timeCreated: z.coerce.date(), + timeModified: z.coerce.date(), + }), +); + +/** + * A BGP announcement tied to a particular address lot block. + */ +export const BgpAnnouncementCreate = z.preprocess( + processResponseBody, + z.object({ addressLotBlock: NameOrId, network: IpNet }), +); + +/** + * Parameters for creating a named set of BGP announcements. + */ +export const BgpAnnounceSetCreate = z.preprocess( + processResponseBody, + z.object({ + announcement: BgpAnnouncementCreate.array(), + description: z.string(), + name: Name, + }), +); + +/** + * A BGP announcement tied to an address lot block. + */ +export const BgpAnnouncement = z.preprocess( + processResponseBody, + z.object({ + addressLotBlockId: z.string().uuid(), + announceSetId: z.string().uuid(), + network: IpNet, + }), +); + +/** + * A base BGP configuration. + */ +export const BgpConfig = z.preprocess( + processResponseBody, + z.object({ + asn: z.number().min(0).max(4294967295), + description: z.string(), + id: z.string().uuid(), + name: Name, + timeCreated: z.coerce.date(), + timeModified: z.coerce.date(), + vrf: z.string().nullable().optional(), + }), +); + +/** + * Parameters for creating a BGP configuration. This includes and autonomous system number (ASN) and a virtual routing and forwarding (VRF) identifier. + */ +export const BgpConfigCreate = z.preprocess( + processResponseBody, + z.object({ + asn: z.number().min(0).max(4294967295), + bgpAnnounceSetId: NameOrId, + description: z.string(), + name: Name, + vrf: Name.nullable().optional(), + }), +); + +/** + * A single page of results + */ +export const BgpConfigResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: BgpConfig.array(), + nextPage: z.string().nullable().optional(), + }), +); + +/** + * The current status of a BGP peer. + */ +export const BgpExported = z.preprocess( + processResponseBody, + z.object({ exports: z.record(z.string().min(1), Ipv4Net.array()) }), +); + +/** + * A route imported from a BGP peer. + */ +export const BgpImportedRouteIpv4 = z.preprocess( + processResponseBody, + z.object({ + id: z.number().min(0).max(4294967295), + nexthop: z.string().ip({ version: "v4" }), + prefix: Ipv4Net, + switch: SwitchLocation, + }), +); + +/** + * Define policy relating to the import and export of prefixes from a BGP peer. + */ +export const ImportExportPolicy = z.preprocess( + processResponseBody, + z.union([ + z.object({ type: z.enum(["no_filtering"]) }), + z.object({ type: z.enum(["allow"]), value: IpNet.array() }), + ]), +); + +/** + * A BGP peer configuration for an interface. Includes the set of announcements that will be advertised to the peer identified by `addr`. The `bgp_config` parameter is a reference to global BGP parameters. The `interface_name` indicates what interface the peer should be contacted on. + */ +export const BgpPeer = z.preprocess( + processResponseBody, + z.object({ + addr: z.string().ip(), + allowedExport: ImportExportPolicy, + allowedImport: ImportExportPolicy, + bgpConfig: NameOrId, + communities: z.number().min(0).max(4294967295).array(), + connectRetry: z.number().min(0).max(4294967295), + delayOpen: z.number().min(0).max(4294967295), + enforceFirstAs: SafeBoolean, + holdTime: z.number().min(0).max(4294967295), + idleHoldTime: z.number().min(0).max(4294967295), + interfaceName: Name, + keepalive: z.number().min(0).max(4294967295), + localPref: z.number().min(0).max(4294967295).nullable().optional(), + md5AuthKey: z.string().nullable().optional(), + minTtl: z.number().min(0).max(255).nullable().optional(), + multiExitDiscriminator: z + .number() + .min(0) + .max(4294967295) + .nullable() + .optional(), + remoteAsn: z.number().min(0).max(4294967295).nullable().optional(), + vlanId: z.number().min(0).max(65535).nullable().optional(), + }), +); + +export const BgpPeerConfig = z.preprocess( + processResponseBody, + z.object({ linkName: Name, peers: BgpPeer.array() }), +); + +/** + * The current state of a BGP peer. + */ +export const BgpPeerState = z.preprocess( + processResponseBody, + z.enum([ + "idle", + "connect", + "active", + "open_sent", + "open_confirm", + "session_setup", + "established", + ]), +); + +/** + * The current status of a BGP peer. + */ +export const BgpPeerStatus = z.preprocess( + processResponseBody, + z.object({ + addr: z.string().ip(), + localAsn: z.number().min(0).max(4294967295), + remoteAsn: z.number().min(0).max(4294967295), + state: BgpPeerState, + stateDurationMillis: z.number().min(0), + switch: SwitchLocation, + }), +); + +/** + * A type storing a range over `T`. + * + * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. + */ +export const BinRangedouble = z.preprocess( + processResponseBody, + z.union([ + z.object({ end: z.number(), type: z.enum(["range_to"]) }), + z.object({ end: z.number(), start: z.number(), type: z.enum(["range"]) }), + z.object({ start: z.number(), type: z.enum(["range_from"]) }), + ]), +); + +/** + * A type storing a range over `T`. + * + * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. + */ +export const BinRangefloat = z.preprocess( + processResponseBody, + z.union([ + z.object({ end: z.number(), type: z.enum(["range_to"]) }), + z.object({ end: z.number(), start: z.number(), type: z.enum(["range"]) }), + z.object({ start: z.number(), type: z.enum(["range_from"]) }), + ]), +); + +/** + * A type storing a range over `T`. + * + * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. + */ +export const BinRangeint16 = z.preprocess( + processResponseBody, + z.union([ + z.object({ + end: z.number().min(-32767).max(32767), + type: z.enum(["range_to"]), + }), + z.object({ + end: z.number().min(-32767).max(32767), + start: z.number().min(-32767).max(32767), + type: z.enum(["range"]), + }), + z.object({ + start: z.number().min(-32767).max(32767), + type: z.enum(["range_from"]), + }), + ]), +); + +/** + * A type storing a range over `T`. + * + * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. + */ +export const BinRangeint32 = z.preprocess( + processResponseBody, + z.union([ + z.object({ + end: z.number().min(-2147483647).max(2147483647), + type: z.enum(["range_to"]), + }), + z.object({ + end: z.number().min(-2147483647).max(2147483647), + start: z.number().min(-2147483647).max(2147483647), + type: z.enum(["range"]), + }), + z.object({ + start: z.number().min(-2147483647).max(2147483647), + type: z.enum(["range_from"]), + }), + ]), +); + +/** + * A type storing a range over `T`. + * + * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. + */ +export const BinRangeint64 = z.preprocess( + processResponseBody, + z.union([ + z.object({ end: z.number(), type: z.enum(["range_to"]) }), + z.object({ end: z.number(), start: z.number(), type: z.enum(["range"]) }), + z.object({ start: z.number(), type: z.enum(["range_from"]) }), + ]), +); + +/** + * A type storing a range over `T`. + * + * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. + */ +export const BinRangeint8 = z.preprocess( + processResponseBody, + z.union([ + z.object({ + end: z.number().min(-127).max(127), + type: z.enum(["range_to"]), + }), + z.object({ + end: z.number().min(-127).max(127), + start: z.number().min(-127).max(127), + type: z.enum(["range"]), + }), + z.object({ + start: z.number().min(-127).max(127), + type: z.enum(["range_from"]), + }), + ]), +); + +/** + * A type storing a range over `T`. + * + * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. + */ +export const BinRangeuint16 = z.preprocess( + processResponseBody, + z.union([ + z.object({ end: z.number().min(0).max(65535), type: z.enum(["range_to"]) }), + z.object({ + end: z.number().min(0).max(65535), + start: z.number().min(0).max(65535), + type: z.enum(["range"]), + }), + z.object({ + start: z.number().min(0).max(65535), + type: z.enum(["range_from"]), + }), + ]), +); + +/** + * A type storing a range over `T`. + * + * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. + */ +export const BinRangeuint32 = z.preprocess( + processResponseBody, + z.union([ + z.object({ + end: z.number().min(0).max(4294967295), + type: z.enum(["range_to"]), + }), + z.object({ + end: z.number().min(0).max(4294967295), + start: z.number().min(0).max(4294967295), + type: z.enum(["range"]), + }), + z.object({ + start: z.number().min(0).max(4294967295), + type: z.enum(["range_from"]), + }), + ]), +); + +/** + * A type storing a range over `T`. + * + * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. + */ +export const BinRangeuint64 = z.preprocess( + processResponseBody, + z.union([ + z.object({ end: z.number().min(0), type: z.enum(["range_to"]) }), + z.object({ + end: z.number().min(0), + start: z.number().min(0), + type: z.enum(["range"]), + }), + z.object({ start: z.number().min(0), type: z.enum(["range_from"]) }), + ]), +); + +/** + * A type storing a range over `T`. + * + * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. + */ +export const BinRangeuint8 = z.preprocess( + processResponseBody, + z.union([ + z.object({ end: z.number().min(0).max(255), type: z.enum(["range_to"]) }), + z.object({ + end: z.number().min(0).max(255), + start: z.number().min(0).max(255), + type: z.enum(["range"]), + }), + z.object({ + start: z.number().min(0).max(255), + type: z.enum(["range_from"]), + }), + ]), +); + +/** + * Type storing bin edges and a count of samples within it. + */ +export const Bindouble = z.preprocess( + processResponseBody, + z.object({ count: z.number().min(0), range: BinRangedouble }), +); + +/** + * Type storing bin edges and a count of samples within it. + */ +export const Binfloat = z.preprocess( + processResponseBody, + z.object({ count: z.number().min(0), range: BinRangefloat }), +); + +/** + * Type storing bin edges and a count of samples within it. + */ +export const Binint16 = z.preprocess( + processResponseBody, + z.object({ count: z.number().min(0), range: BinRangeint16 }), +); + +/** + * Type storing bin edges and a count of samples within it. + */ +export const Binint32 = z.preprocess( + processResponseBody, + z.object({ count: z.number().min(0), range: BinRangeint32 }), +); + +/** + * Type storing bin edges and a count of samples within it. + */ +export const Binint64 = z.preprocess( + processResponseBody, + z.object({ count: z.number().min(0), range: BinRangeint64 }), +); + +/** + * Type storing bin edges and a count of samples within it. + */ +export const Binint8 = z.preprocess( + processResponseBody, + z.object({ count: z.number().min(0), range: BinRangeint8 }), +); + +/** + * Type storing bin edges and a count of samples within it. + */ +export const Binuint16 = z.preprocess( + processResponseBody, + z.object({ count: z.number().min(0), range: BinRangeuint16 }), +); + +/** + * Type storing bin edges and a count of samples within it. + */ +export const Binuint32 = z.preprocess( + processResponseBody, + z.object({ count: z.number().min(0), range: BinRangeuint32 }), +); + +/** + * Type storing bin edges and a count of samples within it. + */ +export const Binuint64 = z.preprocess( + processResponseBody, + z.object({ count: z.number().min(0), range: BinRangeuint64 }), +); + +/** + * Type storing bin edges and a count of samples within it. + */ +export const Binuint8 = z.preprocess( + processResponseBody, + z.object({ count: z.number().min(0), range: BinRangeuint8 }), +); + +/** + * disk block size in bytes + */ +export const BlockSize = z.preprocess( + processResponseBody, + IntEnum([512, 2048, 4096] as const), +); + +/** + * Byte count to express memory or storage capacity. + */ +export const ByteCount = z.preprocess(processResponseBody, z.number().min(0)); + +/** + * The service intended to use this certificate. + */ +export const ServiceUsingCertificate = z.preprocess( + processResponseBody, + z.enum(["external_api"]), +); + +/** + * View of a Certificate + */ +export const Certificate = z.preprocess( + processResponseBody, + z.object({ + cert: z.string(), + description: z.string(), + id: z.string().uuid(), + name: Name, + service: ServiceUsingCertificate, + timeCreated: z.coerce.date(), + timeModified: z.coerce.date(), + }), +); + +/** + * Create-time parameters for a `Certificate` + */ +export const CertificateCreate = z.preprocess( + processResponseBody, + z.object({ + cert: z.string(), + description: z.string(), + key: z.string(), + name: Name, + service: ServiceUsingCertificate, + }), +); + +/** + * A single page of results + */ +export const CertificateResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: Certificate.array(), + nextPage: z.string().nullable().optional(), + }), +); + +/** + * View of a console session + */ +export const ConsoleSession = z.preprocess( + processResponseBody, + z.object({ + id: z.string().uuid(), + timeCreated: z.coerce.date(), + timeLastUsed: z.coerce.date(), + }), +); + +/** + * A single page of results + */ +export const ConsoleSessionResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: ConsoleSession.array(), + nextPage: z.string().nullable().optional(), + }), +); + +/** + * A cumulative or counter data type. + */ +export const Cumulativedouble = z.preprocess( + processResponseBody, + z.object({ startTime: z.coerce.date(), value: z.number() }), +); + +/** + * A cumulative or counter data type. + */ +export const Cumulativefloat = z.preprocess( + processResponseBody, + z.object({ startTime: z.coerce.date(), value: z.number() }), +); + +/** + * A cumulative or counter data type. + */ +export const Cumulativeint64 = z.preprocess( + processResponseBody, + z.object({ startTime: z.coerce.date(), value: z.number() }), +); + +/** + * A cumulative or counter data type. + */ +export const Cumulativeuint64 = z.preprocess( + processResponseBody, + z.object({ startTime: z.coerce.date(), value: z.number().min(0) }), +); + +/** + * Info about the current user + */ +export const CurrentUser = z.preprocess( + processResponseBody, + z.object({ + displayName: z.string(), + id: z.string().uuid(), + siloId: z.string().uuid(), + siloName: Name, + }), +); + +/** + * Structure for estimating the p-quantile of a population. + * + * This is based on the P² algorithm for estimating quantiles using constant space. + * + * The algorithm consists of maintaining five markers: the minimum, the p/2-, p-, and (1 + p)/2 quantiles, and the maximum. + */ +export const Quantile = z.preprocess( + processResponseBody, + z.object({ + desiredMarkerPositions: z.number().array(), + markerHeights: z.number().array(), + markerPositions: z.number().min(0).array(), + p: z.number(), + }), +); + +/** + * Histogram metric + * + * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. + * + * Note that any gaps, unsorted bins, or non-finite values will result in an error. + */ +export const Histogramint8 = z.preprocess( + processResponseBody, + z.object({ + bins: Binint8.array(), + max: z.number().min(-127).max(127), + min: z.number().min(-127).max(127), + nSamples: z.number().min(0), + p50: Quantile, + p90: Quantile, + p99: Quantile, + squaredMean: z.number(), + startTime: z.coerce.date(), + sumOfSamples: z.number(), + }), +); + +/** + * Histogram metric + * + * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. + * + * Note that any gaps, unsorted bins, or non-finite values will result in an error. + */ +export const Histogramuint8 = z.preprocess( + processResponseBody, + z.object({ + bins: Binuint8.array(), + max: z.number().min(0).max(255), + min: z.number().min(0).max(255), + nSamples: z.number().min(0), + p50: Quantile, + p90: Quantile, + p99: Quantile, + squaredMean: z.number(), + startTime: z.coerce.date(), + sumOfSamples: z.number(), + }), +); + +/** + * Histogram metric + * + * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. + * + * Note that any gaps, unsorted bins, or non-finite values will result in an error. + */ +export const Histogramint16 = z.preprocess( + processResponseBody, + z.object({ + bins: Binint16.array(), + max: z.number().min(-32767).max(32767), + min: z.number().min(-32767).max(32767), + nSamples: z.number().min(0), + p50: Quantile, + p90: Quantile, + p99: Quantile, + squaredMean: z.number(), + startTime: z.coerce.date(), + sumOfSamples: z.number(), + }), +); + +/** + * Histogram metric + * + * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. + * + * Note that any gaps, unsorted bins, or non-finite values will result in an error. + */ +export const Histogramuint16 = z.preprocess( + processResponseBody, + z.object({ + bins: Binuint16.array(), + max: z.number().min(0).max(65535), + min: z.number().min(0).max(65535), + nSamples: z.number().min(0), + p50: Quantile, + p90: Quantile, + p99: Quantile, + squaredMean: z.number(), + startTime: z.coerce.date(), + sumOfSamples: z.number(), + }), +); + +/** + * Histogram metric + * + * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. + * + * Note that any gaps, unsorted bins, or non-finite values will result in an error. + */ +export const Histogramint32 = z.preprocess( + processResponseBody, + z.object({ + bins: Binint32.array(), + max: z.number().min(-2147483647).max(2147483647), + min: z.number().min(-2147483647).max(2147483647), + nSamples: z.number().min(0), + p50: Quantile, + p90: Quantile, + p99: Quantile, + squaredMean: z.number(), + startTime: z.coerce.date(), + sumOfSamples: z.number(), + }), +); + +/** + * Histogram metric + * + * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. + * + * Note that any gaps, unsorted bins, or non-finite values will result in an error. + */ +export const Histogramuint32 = z.preprocess( + processResponseBody, + z.object({ + bins: Binuint32.array(), + max: z.number().min(0).max(4294967295), + min: z.number().min(0).max(4294967295), + nSamples: z.number().min(0), + p50: Quantile, + p90: Quantile, + p99: Quantile, + squaredMean: z.number(), + startTime: z.coerce.date(), + sumOfSamples: z.number(), + }), +); + +/** + * Histogram metric + * + * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. + * + * Note that any gaps, unsorted bins, or non-finite values will result in an error. + */ +export const Histogramint64 = z.preprocess( + processResponseBody, + z.object({ + bins: Binint64.array(), + max: z.number(), + min: z.number(), + nSamples: z.number().min(0), + p50: Quantile, + p90: Quantile, + p99: Quantile, + squaredMean: z.number(), + startTime: z.coerce.date(), + sumOfSamples: z.number(), + }), +); + +/** + * Histogram metric + * + * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. + * + * Note that any gaps, unsorted bins, or non-finite values will result in an error. + */ +export const Histogramuint64 = z.preprocess( + processResponseBody, + z.object({ + bins: Binuint64.array(), + max: z.number().min(0), + min: z.number().min(0), + nSamples: z.number().min(0), + p50: Quantile, + p90: Quantile, + p99: Quantile, + squaredMean: z.number(), + startTime: z.coerce.date(), + sumOfSamples: z.number(), + }), +); + +/** + * Histogram metric + * + * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. + * + * Note that any gaps, unsorted bins, or non-finite values will result in an error. + */ +export const Histogramfloat = z.preprocess( + processResponseBody, + z.object({ + bins: Binfloat.array(), + max: z.number(), + min: z.number(), + nSamples: z.number().min(0), + p50: Quantile, + p90: Quantile, + p99: Quantile, + squaredMean: z.number(), + startTime: z.coerce.date(), + sumOfSamples: z.number(), + }), +); + +/** + * Histogram metric + * + * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. + * + * Note that any gaps, unsorted bins, or non-finite values will result in an error. + */ +export const Histogramdouble = z.preprocess( + processResponseBody, + z.object({ + bins: Bindouble.array(), + max: z.number(), + min: z.number(), + nSamples: z.number().min(0), + p50: Quantile, + p90: Quantile, + p99: Quantile, + squaredMean: z.number(), + startTime: z.coerce.date(), + sumOfSamples: z.number(), + }), +); + +/** + * The type of an individual datum of a metric. + */ +export const DatumType = z.preprocess( + processResponseBody, + z.enum([ + "bool", + "i8", + "u8", + "i16", + "u16", + "i32", + "u32", + "i64", + "u64", + "f32", + "f64", + "string", + "bytes", + "cumulative_i64", + "cumulative_u64", + "cumulative_f32", + "cumulative_f64", + "histogram_i8", + "histogram_u8", + "histogram_i16", + "histogram_u16", + "histogram_i32", + "histogram_u32", + "histogram_i64", + "histogram_u64", + "histogram_f32", + "histogram_f64", + ]), +); + +export const MissingDatum = z.preprocess( + processResponseBody, + z.object({ + datumType: DatumType, + startTime: z.coerce.date().nullable().optional(), + }), +); + +/** + * A `Datum` is a single sampled data point from a metric. + */ +export const Datum = z.preprocess( + processResponseBody, + z.union([ + z.object({ datum: SafeBoolean, type: z.enum(["bool"]) }), + z.object({ datum: z.number().min(-127).max(127), type: z.enum(["i8"]) }), + z.object({ datum: z.number().min(0).max(255), type: z.enum(["u8"]) }), + z.object({ + datum: z.number().min(-32767).max(32767), + type: z.enum(["i16"]), + }), + z.object({ datum: z.number().min(0).max(65535), type: z.enum(["u16"]) }), + z.object({ + datum: z.number().min(-2147483647).max(2147483647), + type: z.enum(["i32"]), + }), + z.object({ + datum: z.number().min(0).max(4294967295), + type: z.enum(["u32"]), + }), + z.object({ datum: z.number(), type: z.enum(["i64"]) }), + z.object({ datum: z.number().min(0), type: z.enum(["u64"]) }), + z.object({ datum: z.number(), type: z.enum(["f32"]) }), + z.object({ datum: z.number(), type: z.enum(["f64"]) }), + z.object({ datum: z.string(), type: z.enum(["string"]) }), + z.object({ + datum: z.number().min(0).max(255).array(), + type: z.enum(["bytes"]), + }), + z.object({ datum: Cumulativeint64, type: z.enum(["cumulative_i64"]) }), + z.object({ datum: Cumulativeuint64, type: z.enum(["cumulative_u64"]) }), + z.object({ datum: Cumulativefloat, type: z.enum(["cumulative_f32"]) }), + z.object({ datum: Cumulativedouble, type: z.enum(["cumulative_f64"]) }), + z.object({ datum: Histogramint8, type: z.enum(["histogram_i8"]) }), + z.object({ datum: Histogramuint8, type: z.enum(["histogram_u8"]) }), + z.object({ datum: Histogramint16, type: z.enum(["histogram_i16"]) }), + z.object({ datum: Histogramuint16, type: z.enum(["histogram_u16"]) }), + z.object({ datum: Histogramint32, type: z.enum(["histogram_i32"]) }), + z.object({ datum: Histogramuint32, type: z.enum(["histogram_u32"]) }), + z.object({ datum: Histogramint64, type: z.enum(["histogram_i64"]) }), + z.object({ datum: Histogramuint64, type: z.enum(["histogram_u64"]) }), + z.object({ datum: Histogramfloat, type: z.enum(["histogram_f32"]) }), + z.object({ datum: Histogramdouble, type: z.enum(["histogram_f64"]) }), + z.object({ datum: MissingDatum, type: z.enum(["missing"]) }), + ]), +); + +export const DerEncodedKeyPair = z.preprocess( + processResponseBody, + z.object({ privateKey: z.string(), publicCert: z.string() }), +); + +/** + * View of a device access token + */ +export const DeviceAccessToken = z.preprocess( + processResponseBody, + z.object({ + id: z.string().uuid(), + timeCreated: z.coerce.date(), + timeExpires: z.coerce.date().nullable().optional(), + }), +); + +export const DeviceAccessTokenRequest = z.preprocess( + processResponseBody, + z.object({ + clientId: z.string().uuid(), + deviceCode: z.string(), + grantType: z.string(), + }), +); + +/** + * A single page of results + */ +export const DeviceAccessTokenResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: DeviceAccessToken.array(), + nextPage: z.string().nullable().optional(), + }), +); + +export const DeviceAuthRequest = z.preprocess( + processResponseBody, + z.object({ + clientId: z.string().uuid(), + ttlSeconds: z.number().min(1).max(4294967295).nullable().optional(), + }), +); + +export const DeviceAuthVerify = z.preprocess( + processResponseBody, + z.object({ userCode: z.string() }), +); + +export const Digest = z.preprocess( + processResponseBody, + z.object({ type: z.enum(["sha256"]), value: z.string() }), +); + +/** + * State of a Disk + */ +export const DiskState = z.preprocess( + processResponseBody, + z.union([ + z.object({ state: z.enum(["creating"]) }), + z.object({ state: z.enum(["detached"]) }), + z.object({ state: z.enum(["import_ready"]) }), + z.object({ state: z.enum(["importing_from_url"]) }), + z.object({ state: z.enum(["importing_from_bulk_writes"]) }), + z.object({ state: z.enum(["finalizing"]) }), + z.object({ state: z.enum(["maintenance"]) }), + z.object({ instance: z.string().uuid(), state: z.enum(["attaching"]) }), + z.object({ instance: z.string().uuid(), state: z.enum(["attached"]) }), + z.object({ instance: z.string().uuid(), state: z.enum(["detaching"]) }), + z.object({ state: z.enum(["destroyed"]) }), + z.object({ state: z.enum(["faulted"]) }), + ]), +); + +/** + * View of a Disk + */ +export const Disk = z.preprocess( + processResponseBody, + z.object({ + blockSize: ByteCount, + description: z.string(), + devicePath: z.string(), + id: z.string().uuid(), + imageId: z.string().uuid().nullable().optional(), + name: Name, + projectId: z.string().uuid(), + size: ByteCount, + snapshotId: z.string().uuid().nullable().optional(), + state: DiskState, + timeCreated: z.coerce.date(), + timeModified: z.coerce.date(), + }), +); + +/** + * Different sources for a disk + */ +export const DiskSource = z.preprocess( + processResponseBody, + z.union([ + z.object({ blockSize: BlockSize, type: z.enum(["blank"]) }), + z.object({ snapshotId: z.string().uuid(), type: z.enum(["snapshot"]) }), + z.object({ imageId: z.string().uuid(), type: z.enum(["image"]) }), + z.object({ blockSize: BlockSize, type: z.enum(["importing_blocks"]) }), + ]), +); + +/** + * Create-time parameters for a `Disk` + */ +export const DiskCreate = z.preprocess( + processResponseBody, + z.object({ + description: z.string(), + diskSource: DiskSource, + name: Name, + size: ByteCount, + }), +); + +export const DiskPath = z.preprocess( + processResponseBody, + z.object({ disk: NameOrId }), +); + +/** + * A single page of results + */ +export const DiskResultsPage = z.preprocess( + processResponseBody, + z.object({ items: Disk.array(), nextPage: z.string().nullable().optional() }), +); + +/** + * A distribution is a sequence of bins and counts in those bins, and some statistical information tracked to compute the mean, standard deviation, and quantile estimates. + * + * Min, max, and the p-* quantiles are treated as optional due to the possibility of distribution operations, like subtraction. + */ +export const Distributiondouble = z.preprocess( + processResponseBody, + z.object({ + bins: z.number().array(), + counts: z.number().min(0).array(), + max: z.number().nullable().optional(), + min: z.number().nullable().optional(), + p50: Quantile.nullable().optional(), + p90: Quantile.nullable().optional(), + p99: Quantile.nullable().optional(), + squaredMean: z.number(), + sumOfSamples: z.number(), + }), +); + +/** + * A distribution is a sequence of bins and counts in those bins, and some statistical information tracked to compute the mean, standard deviation, and quantile estimates. + * + * Min, max, and the p-* quantiles are treated as optional due to the possibility of distribution operations, like subtraction. + */ +export const Distributionint64 = z.preprocess( + processResponseBody, + z.object({ + bins: z.number().array(), + counts: z.number().min(0).array(), + max: z.number().nullable().optional(), + min: z.number().nullable().optional(), + p50: Quantile.nullable().optional(), + p90: Quantile.nullable().optional(), + p99: Quantile.nullable().optional(), + squaredMean: z.number(), + sumOfSamples: z.number(), + }), +); + +/** + * Parameters for creating an ephemeral IP address for an instance. + */ +export const EphemeralIpCreate = z.preprocess( + processResponseBody, + z.object({ pool: NameOrId.nullable().optional() }), +); + +/** + * Error information from a response. + */ +export const Error = z.preprocess( + processResponseBody, + z.object({ + errorCode: z.string().optional(), + message: z.string(), + requestId: z.string(), + }), +); + +export const ExternalIp = z.preprocess( + processResponseBody, + z.union([ + z.object({ + firstPort: z.number().min(0).max(65535), + ip: z.string().ip(), + ipPoolId: z.string().uuid(), + kind: z.enum(["snat"]), + lastPort: z.number().min(0).max(65535), + }), + z.object({ + ip: z.string().ip(), + ipPoolId: z.string().uuid(), + kind: z.enum(["ephemeral"]), + }), + z.object({ + description: z.string(), + id: z.string().uuid(), + instanceId: z.string().uuid().nullable().optional(), + ip: z.string().ip(), + ipPoolId: z.string().uuid(), + kind: z.enum(["floating"]), + name: Name, + projectId: z.string().uuid(), + timeCreated: z.coerce.date(), + timeModified: z.coerce.date(), + }), + ]), +); + +/** + * Parameters for creating an external IP address for instances. + */ +export const ExternalIpCreate = z.preprocess( + processResponseBody, + z.union([ + z.object({ + pool: NameOrId.nullable().optional(), + type: z.enum(["ephemeral"]), + }), + z.object({ floatingIp: NameOrId, type: z.enum(["floating"]) }), + ]), +); + +/** + * A single page of results + */ +export const ExternalIpResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: ExternalIp.array(), + nextPage: z.string().nullable().optional(), + }), +); + +/** + * The `FieldType` identifies the data type of a target or metric field. + */ +export const FieldType = z.preprocess( + processResponseBody, + z.enum([ + "string", + "i8", + "u8", + "i16", + "u16", + "i32", + "u32", + "i64", + "u64", + "ip_addr", + "uuid", + "bool", + ]), +); + +/** + * The source from which a field is derived, the target or metric. + */ +export const FieldSource = z.preprocess( + processResponseBody, + z.enum(["target", "metric"]), +); + +/** + * The name and type information for a field of a timeseries schema. + */ +export const FieldSchema = z.preprocess( + processResponseBody, + z.object({ + description: z.string(), + fieldType: FieldType, + name: z.string(), + source: FieldSource, + }), +); + +/** + * The `FieldValue` contains the value of a target or metric field. + */ +export const FieldValue = z.preprocess( + processResponseBody, + z.union([ + z.object({ type: z.enum(["string"]), value: z.string() }), + z.object({ type: z.enum(["i8"]), value: z.number().min(-127).max(127) }), + z.object({ type: z.enum(["u8"]), value: z.number().min(0).max(255) }), + z.object({ + type: z.enum(["i16"]), + value: z.number().min(-32767).max(32767), + }), + z.object({ type: z.enum(["u16"]), value: z.number().min(0).max(65535) }), + z.object({ + type: z.enum(["i32"]), + value: z.number().min(-2147483647).max(2147483647), + }), + z.object({ + type: z.enum(["u32"]), + value: z.number().min(0).max(4294967295), + }), + z.object({ type: z.enum(["i64"]), value: z.number() }), + z.object({ type: z.enum(["u64"]), value: z.number().min(0) }), + z.object({ type: z.enum(["ip_addr"]), value: z.string().ip() }), + z.object({ type: z.enum(["uuid"]), value: z.string().uuid() }), + z.object({ type: z.enum(["bool"]), value: SafeBoolean }), + ]), +); + +/** + * Parameters for finalizing a disk + */ +export const FinalizeDisk = z.preprocess( + processResponseBody, + z.object({ snapshotName: Name.nullable().optional() }), +); + +export const FleetRole = z.preprocess( + processResponseBody, + z.enum(["admin", "collaborator", "viewer"]), +); + +/** + * Describes what kind of identity is described by an id + */ +export const IdentityType = z.preprocess( + processResponseBody, + z.enum(["silo_user", "silo_group"]), +); + +/** + * Describes the assignment of a particular role on a particular resource to a particular identity (user, group, etc.) + * + * The resource is not part of this structure. Rather, `RoleAssignment`s are put into a `Policy` and that Policy is applied to a particular resource. + */ +export const FleetRoleRoleAssignment = z.preprocess( + processResponseBody, + z.object({ + identityId: z.string().uuid(), + identityType: IdentityType, + roleName: FleetRole, + }), +); + +/** + * Policy for a particular resource + * + * Note that the Policy only describes access granted explicitly for this resource. The policies of parent resources can also cause a user to have access to this resource. + */ +export const FleetRolePolicy = z.preprocess( + processResponseBody, + z.object({ roleAssignments: FleetRoleRoleAssignment.array() }), +); + +/** + * A Floating IP is a well-known IP address which can be attached and detached from instances. + */ +export const FloatingIp = z.preprocess( + processResponseBody, + z.object({ + description: z.string(), + id: z.string().uuid(), + instanceId: z.string().uuid().nullable().optional(), + ip: z.string().ip(), + ipPoolId: z.string().uuid(), + name: Name, + projectId: z.string().uuid(), + timeCreated: z.coerce.date(), + timeModified: z.coerce.date(), + }), +); + +/** + * The type of resource that a floating IP is attached to + */ +export const FloatingIpParentKind = z.preprocess( + processResponseBody, + z.enum(["instance"]), +); + +/** + * Parameters for attaching a floating IP address to another resource + */ +export const FloatingIpAttach = z.preprocess( + processResponseBody, + z.object({ kind: FloatingIpParentKind, parent: NameOrId }), +); + +/** + * Parameters for creating a new floating IP address for instances. + */ +export const FloatingIpCreate = z.preprocess( + processResponseBody, + z.object({ + description: z.string(), + ip: z.string().ip().nullable().optional(), + name: Name, + pool: NameOrId.nullable().optional(), + }), +); + +/** + * A single page of results + */ +export const FloatingIpResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: FloatingIp.array(), + nextPage: z.string().nullable().optional(), + }), +); + +/** + * Updateable identity-related parameters + */ +export const FloatingIpUpdate = z.preprocess( + processResponseBody, + z.object({ + description: z.string().nullable().optional(), + name: Name.nullable().optional(), + }), +); + +/** + * View of a Group + */ +export const Group = z.preprocess( + processResponseBody, + z.object({ + displayName: z.string(), + id: z.string().uuid(), + siloId: z.string().uuid(), + }), +); + +/** + * A single page of results + */ +export const GroupResultsPage = z.preprocess( + processResponseBody, + z.object({ + items: Group.array(), + nextPage: z.string().nullable().optional(), + }), +); + +/** + * An RFC-1035-compliant hostname + * + * A hostname identifies a host on a network, and is usually a dot-delimited sequence of labels, where each label contains only letters, digits, or the hyphen. See RFCs 1035 and 952 for more details. + */ +export const Hostname = z.preprocess( + processResponseBody, + z + .string() + .min(1) + .max(253) + .regex( + /^([a-zA-Z0-9]+[a-zA-Z0-9\-]*(? Date: Fri, 15 Aug 2025 16:25:10 -0500 Subject: [PATCH 2/4] zod v4 --- oxide-api/src/msw-handlers.ts | 9 +- oxide-api/src/validate.ts | 498 ++++++++---------- .../src/client/msw-handlers.ts | 8 +- .../src/client/zodValidators.ts | 2 +- oxide-openapi-gen-ts/src/schema/zod.ts | 52 +- 5 files changed, 266 insertions(+), 303 deletions(-) diff --git a/oxide-api/src/msw-handlers.ts b/oxide-api/src/msw-handlers.ts index 706c3b9..65bf704 100644 --- a/oxide-api/src/msw-handlers.ts +++ b/oxide-api/src/msw-handlers.ts @@ -9,7 +9,7 @@ import type { SnakeCasedPropertiesDeep as Snakify, Promisable, } from "type-fest"; -import { type ZodSchema } from "zod"; +import { type ZodType } from "zod/v4"; import type * as Api from "./Api"; import { snakeify } from "./util"; import * as schema from "./validate"; @@ -1802,7 +1802,7 @@ export interface MSWHandlers { }) => Promisable; } -function validateParams( +function validateParams( schema: S, req: Request, pathParams: PathParams, @@ -1837,8 +1837,9 @@ function validateParams( const handler = ( handler: MSWHandlers[keyof MSWHandlers], - paramSchema: ZodSchema | null, - bodySchema: ZodSchema | null, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + paramSchema: ZodType | null, + bodySchema: ZodType | null, ) => async ({ request: req, diff --git a/oxide-api/src/validate.ts b/oxide-api/src/validate.ts index fa7e153..47bb7ac 100644 --- a/oxide-api/src/validate.ts +++ b/oxide-api/src/validate.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -import { z, ZodType } from "zod"; +import { z, ZodType } from "zod/v4"; import { processResponseBody, uniqueItems } from "./util"; /** @@ -70,7 +70,7 @@ export const Name = z.preprocess( export const NameOrId = z.preprocess( processResponseBody, - z.union([z.string().uuid(), Name]), + z.union([z.uuid(), Name]), ); /** @@ -108,7 +108,7 @@ export const AddressLot = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), kind: AddressLotKind, name: Name, timeCreated: z.coerce.date(), @@ -121,11 +121,7 @@ export const AddressLot = z.preprocess( */ export const AddressLotBlock = z.preprocess( processResponseBody, - z.object({ - firstAddress: z.string().ip(), - id: z.string().uuid(), - lastAddress: z.string().ip(), - }), + z.object({ firstAddress: z.ipv4(), id: z.uuid(), lastAddress: z.ipv4() }), ); /** @@ -133,7 +129,7 @@ export const AddressLotBlock = z.preprocess( */ export const AddressLotBlockCreate = z.preprocess( processResponseBody, - z.object({ firstAddress: z.string().ip(), lastAddress: z.string().ip() }), + z.object({ firstAddress: z.ipv4(), lastAddress: z.ipv4() }), ); /** @@ -205,10 +201,10 @@ export const AffinityGroup = z.preprocess( z.object({ description: z.string(), failureDomain: FailureDomain, - id: z.string().uuid(), + id: z.uuid(), name: Name, policy: AffinityPolicy, - projectId: z.string().uuid(), + projectId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }), @@ -229,7 +225,7 @@ export const AffinityGroupCreate = z.preprocess( export const TypedUuidForInstanceKind = z.preprocess( processResponseBody, - z.string().uuid(), + z.uuid(), ); /** @@ -307,7 +303,7 @@ export const AffinityGroupUpdate = z.preprocess( export const BgpMessageHistory = z.preprocess( processResponseBody, - z.record(z.unknown()), + z.record(z.string(), z.unknown()), ); /** @@ -324,7 +320,7 @@ export const SwitchLocation = z.preprocess( export const SwitchBgpHistory = z.preprocess( processResponseBody, z.object({ - history: z.record(z.string().min(1), BgpMessageHistory), + history: z.record(z.string(), BgpMessageHistory), switch: SwitchLocation, }), ); @@ -358,7 +354,7 @@ export const AlertClassResultsPage = z.preprocess( export const TypedUuidForAlertKind = z.preprocess( processResponseBody, - z.string().uuid(), + z.uuid(), ); /** @@ -409,7 +405,7 @@ export const AlertDeliveryAttempts = z.preprocess( export const TypedUuidForAlertReceiverKind = z.preprocess( processResponseBody, - z.string().uuid(), + z.uuid(), ); /** @@ -437,7 +433,7 @@ export const AlertDelivery = z.preprocess( alertClass: z.string(), alertId: TypedUuidForAlertKind, attempts: AlertDeliveryAttempts, - id: z.string().uuid(), + id: z.uuid(), receiverId: TypedUuidForAlertReceiverKind, state: AlertDeliveryState, timeStarted: z.coerce.date(), @@ -447,7 +443,7 @@ export const AlertDelivery = z.preprocess( export const AlertDeliveryId = z.preprocess( processResponseBody, - z.object({ deliveryId: z.string().uuid() }), + z.object({ deliveryId: z.uuid() }), ); /** @@ -479,7 +475,7 @@ export const AlertProbeResult = z.preprocess( */ export const WebhookSecret = z.preprocess( processResponseBody, - z.object({ id: z.string().uuid(), timeCreated: z.coerce.date() }), + z.object({ id: z.uuid(), timeCreated: z.coerce.date() }), ); /** @@ -511,7 +507,7 @@ export const AlertReceiver = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), kind: AlertReceiverKind, name: Name, subscriptions: AlertSubscription.array(), @@ -580,10 +576,10 @@ export const AntiAffinityGroup = z.preprocess( z.object({ description: z.string(), failureDomain: FailureDomain, - id: z.string().uuid(), + id: z.uuid(), name: Name, policy: AffinityPolicy, - projectId: z.string().uuid(), + projectId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }), @@ -665,14 +661,11 @@ export const ArtifactId = z.preprocess( export const AuditLogEntryActor = z.preprocess( processResponseBody, z.union([ - z.object({ - kind: z.enum(["user_builtin"]), - userBuiltinId: z.string().uuid(), - }), + z.object({ kind: z.enum(["user_builtin"]), userBuiltinId: z.uuid() }), z.object({ kind: z.enum(["silo_user"]), - siloId: z.string().uuid(), - siloUserId: z.string().uuid(), + siloId: z.uuid(), + siloUserId: z.uuid(), }), z.object({ kind: z.enum(["unauthenticated"]) }), ]), @@ -706,12 +699,12 @@ export const AuditLogEntry = z.preprocess( z.object({ actor: AuditLogEntryActor, authMethod: z.string().nullable().optional(), - id: z.string().uuid(), + id: z.uuid(), operationId: z.string(), requestId: z.string(), requestUri: z.string(), result: AuditLogEntryResult, - sourceIp: z.string().ip(), + sourceIp: z.ipv4(), timeCompleted: z.coerce.date(), timeStarted: z.coerce.date(), userAgent: z.string().nullable().optional(), @@ -764,7 +757,7 @@ export const BfdMode = z.preprocess( */ export const BfdSessionDisable = z.preprocess( processResponseBody, - z.object({ remote: z.string().ip(), switch: Name }), + z.object({ remote: z.ipv4(), switch: Name }), ); /** @@ -774,9 +767,9 @@ export const BfdSessionEnable = z.preprocess( processResponseBody, z.object({ detectionThreshold: z.number().min(0).max(255), - local: z.string().ip().nullable().optional(), + local: z.ipv4().nullable().optional(), mode: BfdMode, - remote: z.string().ip(), + remote: z.ipv4(), requiredRx: z.number().min(0), switch: Name, }), @@ -791,9 +784,9 @@ export const BfdStatus = z.preprocess( processResponseBody, z.object({ detectionThreshold: z.number().min(0).max(255), - local: z.string().ip().nullable().optional(), + local: z.ipv4().nullable().optional(), mode: BfdMode, - peer: z.string().ip(), + peer: z.ipv4(), requiredRx: z.number().min(0), state: BfdState, switch: Name, @@ -807,7 +800,7 @@ export const BgpAnnounceSet = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -840,8 +833,8 @@ export const BgpAnnounceSetCreate = z.preprocess( export const BgpAnnouncement = z.preprocess( processResponseBody, z.object({ - addressLotBlockId: z.string().uuid(), - announceSetId: z.string().uuid(), + addressLotBlockId: z.uuid(), + announceSetId: z.uuid(), network: IpNet, }), ); @@ -854,7 +847,7 @@ export const BgpConfig = z.preprocess( z.object({ asn: z.number().min(0).max(4294967295), description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -892,7 +885,7 @@ export const BgpConfigResultsPage = z.preprocess( */ export const BgpExported = z.preprocess( processResponseBody, - z.object({ exports: z.record(z.string().min(1), Ipv4Net.array()) }), + z.object({ exports: z.record(z.string(), Ipv4Net.array()) }), ); /** @@ -902,7 +895,7 @@ export const BgpImportedRouteIpv4 = z.preprocess( processResponseBody, z.object({ id: z.number().min(0).max(4294967295), - nexthop: z.string().ip({ version: "v4" }), + nexthop: z.ipv4(), prefix: Ipv4Net, switch: SwitchLocation, }), @@ -925,7 +918,7 @@ export const ImportExportPolicy = z.preprocess( export const BgpPeer = z.preprocess( processResponseBody, z.object({ - addr: z.string().ip(), + addr: z.ipv4(), allowedExport: ImportExportPolicy, allowedImport: ImportExportPolicy, bgpConfig: NameOrId, @@ -978,7 +971,7 @@ export const BgpPeerState = z.preprocess( export const BgpPeerStatus = z.preprocess( processResponseBody, z.object({ - addr: z.string().ip(), + addr: z.ipv4(), localAsn: z.number().min(0).max(4294967295), remoteAsn: z.number().min(0).max(4294967295), state: BgpPeerState, @@ -1294,7 +1287,7 @@ export const Certificate = z.preprocess( z.object({ cert: z.string(), description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, service: ServiceUsingCertificate, timeCreated: z.coerce.date(), @@ -1333,7 +1326,7 @@ export const CertificateResultsPage = z.preprocess( export const ConsoleSession = z.preprocess( processResponseBody, z.object({ - id: z.string().uuid(), + id: z.uuid(), timeCreated: z.coerce.date(), timeLastUsed: z.coerce.date(), }), @@ -1389,8 +1382,8 @@ export const CurrentUser = z.preprocess( processResponseBody, z.object({ displayName: z.string(), - id: z.string().uuid(), - siloId: z.string().uuid(), + id: z.uuid(), + siloId: z.uuid(), siloName: Name, }), ); @@ -1746,7 +1739,7 @@ export const DerEncodedKeyPair = z.preprocess( export const DeviceAccessToken = z.preprocess( processResponseBody, z.object({ - id: z.string().uuid(), + id: z.uuid(), timeCreated: z.coerce.date(), timeExpires: z.coerce.date().nullable().optional(), }), @@ -1755,7 +1748,7 @@ export const DeviceAccessToken = z.preprocess( export const DeviceAccessTokenRequest = z.preprocess( processResponseBody, z.object({ - clientId: z.string().uuid(), + clientId: z.uuid(), deviceCode: z.string(), grantType: z.string(), }), @@ -1775,7 +1768,7 @@ export const DeviceAccessTokenResultsPage = z.preprocess( export const DeviceAuthRequest = z.preprocess( processResponseBody, z.object({ - clientId: z.string().uuid(), + clientId: z.uuid(), ttlSeconds: z.number().min(1).max(4294967295).nullable().optional(), }), ); @@ -1803,9 +1796,9 @@ export const DiskState = z.preprocess( z.object({ state: z.enum(["importing_from_bulk_writes"]) }), z.object({ state: z.enum(["finalizing"]) }), z.object({ state: z.enum(["maintenance"]) }), - z.object({ instance: z.string().uuid(), state: z.enum(["attaching"]) }), - z.object({ instance: z.string().uuid(), state: z.enum(["attached"]) }), - z.object({ instance: z.string().uuid(), state: z.enum(["detaching"]) }), + z.object({ instance: z.uuid(), state: z.enum(["attaching"]) }), + z.object({ instance: z.uuid(), state: z.enum(["attached"]) }), + z.object({ instance: z.uuid(), state: z.enum(["detaching"]) }), z.object({ state: z.enum(["destroyed"]) }), z.object({ state: z.enum(["faulted"]) }), ]), @@ -1820,12 +1813,12 @@ export const Disk = z.preprocess( blockSize: ByteCount, description: z.string(), devicePath: z.string(), - id: z.string().uuid(), - imageId: z.string().uuid().nullable().optional(), + id: z.uuid(), + imageId: z.uuid().nullable().optional(), name: Name, - projectId: z.string().uuid(), + projectId: z.uuid(), size: ByteCount, - snapshotId: z.string().uuid().nullable().optional(), + snapshotId: z.uuid().nullable().optional(), state: DiskState, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -1839,8 +1832,8 @@ export const DiskSource = z.preprocess( processResponseBody, z.union([ z.object({ blockSize: BlockSize, type: z.enum(["blank"]) }), - z.object({ snapshotId: z.string().uuid(), type: z.enum(["snapshot"]) }), - z.object({ imageId: z.string().uuid(), type: z.enum(["image"]) }), + z.object({ snapshotId: z.uuid(), type: z.enum(["snapshot"]) }), + z.object({ imageId: z.uuid(), type: z.enum(["image"]) }), z.object({ blockSize: BlockSize, type: z.enum(["importing_blocks"]) }), ]), ); @@ -1936,25 +1929,21 @@ export const ExternalIp = z.preprocess( z.union([ z.object({ firstPort: z.number().min(0).max(65535), - ip: z.string().ip(), - ipPoolId: z.string().uuid(), + ip: z.ipv4(), + ipPoolId: z.uuid(), kind: z.enum(["snat"]), lastPort: z.number().min(0).max(65535), }), - z.object({ - ip: z.string().ip(), - ipPoolId: z.string().uuid(), - kind: z.enum(["ephemeral"]), - }), + z.object({ ip: z.ipv4(), ipPoolId: z.uuid(), kind: z.enum(["ephemeral"]) }), z.object({ description: z.string(), - id: z.string().uuid(), - instanceId: z.string().uuid().nullable().optional(), - ip: z.string().ip(), - ipPoolId: z.string().uuid(), + id: z.uuid(), + instanceId: z.uuid().nullable().optional(), + ip: z.ipv4(), + ipPoolId: z.uuid(), kind: z.enum(["floating"]), name: Name, - projectId: z.string().uuid(), + projectId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }), @@ -2052,8 +2041,8 @@ export const FieldValue = z.preprocess( }), z.object({ type: z.enum(["i64"]), value: z.number() }), z.object({ type: z.enum(["u64"]), value: z.number().min(0) }), - z.object({ type: z.enum(["ip_addr"]), value: z.string().ip() }), - z.object({ type: z.enum(["uuid"]), value: z.string().uuid() }), + z.object({ type: z.enum(["ip_addr"]), value: z.ipv4() }), + z.object({ type: z.enum(["uuid"]), value: z.uuid() }), z.object({ type: z.enum(["bool"]), value: SafeBoolean }), ]), ); @@ -2087,7 +2076,7 @@ export const IdentityType = z.preprocess( export const FleetRoleRoleAssignment = z.preprocess( processResponseBody, z.object({ - identityId: z.string().uuid(), + identityId: z.uuid(), identityType: IdentityType, roleName: FleetRole, }), @@ -2110,12 +2099,12 @@ export const FloatingIp = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), - instanceId: z.string().uuid().nullable().optional(), - ip: z.string().ip(), - ipPoolId: z.string().uuid(), + id: z.uuid(), + instanceId: z.uuid().nullable().optional(), + ip: z.ipv4(), + ipPoolId: z.uuid(), name: Name, - projectId: z.string().uuid(), + projectId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }), @@ -2144,7 +2133,7 @@ export const FloatingIpCreate = z.preprocess( processResponseBody, z.object({ description: z.string(), - ip: z.string().ip().nullable().optional(), + ip: z.ipv4().nullable().optional(), name: Name, pool: NameOrId.nullable().optional(), }), @@ -2177,11 +2166,7 @@ export const FloatingIpUpdate = z.preprocess( */ export const Group = z.preprocess( processResponseBody, - z.object({ - displayName: z.string(), - id: z.string().uuid(), - siloId: z.string().uuid(), - }), + z.object({ displayName: z.string(), id: z.uuid(), siloId: z.uuid() }), ); /** @@ -2237,7 +2222,7 @@ export const IdentityProvider = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, providerType: IdentityProviderType, timeCreated: z.coerce.date(), @@ -2275,10 +2260,10 @@ export const Image = z.preprocess( blockSize: ByteCount, description: z.string(), digest: Digest.nullable().optional(), - id: z.string().uuid(), + id: z.uuid(), name: Name, os: z.string(), - projectId: z.string().uuid().nullable().optional(), + projectId: z.uuid().nullable().optional(), size: ByteCount, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -2291,7 +2276,7 @@ export const Image = z.preprocess( */ export const ImageSource = z.preprocess( processResponseBody, - z.object({ id: z.string().uuid(), type: z.enum(["snapshot"]) }), + z.object({ id: z.uuid(), type: z.enum(["snapshot"]) }), ); /** @@ -2352,14 +2337,14 @@ export const Instance = z.preprocess( autoRestartCooldownExpiration: z.coerce.date().nullable().optional(), autoRestartEnabled: SafeBoolean, autoRestartPolicy: InstanceAutoRestartPolicy.nullable().optional(), - bootDiskId: z.string().uuid().nullable().optional(), + bootDiskId: z.uuid().nullable().optional(), description: z.string(), hostname: z.string(), - id: z.string().uuid(), + id: z.uuid(), memory: ByteCount, name: Name, ncpus: InstanceCpuCount, - projectId: z.string().uuid(), + projectId: z.uuid(), runState: InstanceState, timeCreated: z.coerce.date(), timeLastAutoRestarted: z.coerce.date().nullable().optional(), @@ -2392,7 +2377,7 @@ export const InstanceNetworkInterfaceCreate = z.preprocess( processResponseBody, z.object({ description: z.string(), - ip: z.string().ip().nullable().optional(), + ip: z.ipv4().nullable().optional(), name: Name, subnetName: Name, vpcName: Name, @@ -2421,10 +2406,10 @@ export const InstanceCreate = z.preprocess( processResponseBody, z.object({ antiAffinityGroups: NameOrId.array().default([]).optional(), - autoRestartPolicy: InstanceAutoRestartPolicy.default(null) - .nullable() + autoRestartPolicy: InstanceAutoRestartPolicy.nullable() + .default(null) .optional(), - bootDisk: InstanceDiskAttachment.default(null).nullable().optional(), + bootDisk: InstanceDiskAttachment.nullable().default(null).optional(), description: z.string(), disks: InstanceDiskAttachment.array().default([]).optional(), externalIps: ExternalIpCreate.array().default([]).optional(), @@ -2462,17 +2447,17 @@ export const InstanceNetworkInterface = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), - instanceId: z.string().uuid(), - ip: z.string().ip(), + id: z.uuid(), + instanceId: z.uuid(), + ip: z.ipv4(), mac: MacAddr, name: Name, primary: SafeBoolean, - subnetId: z.string().uuid(), + subnetId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), transitIps: IpNet.array().default([]).optional(), - vpcId: z.string().uuid(), + vpcId: z.uuid(), }), ); @@ -2553,11 +2538,11 @@ export const InternetGateway = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), - vpcId: z.string().uuid(), + vpcId: z.uuid(), }), ); @@ -2575,10 +2560,10 @@ export const InternetGatewayCreate = z.preprocess( export const InternetGatewayIpAddress = z.preprocess( processResponseBody, z.object({ - address: z.string().ip(), + address: z.ipv4(), description: z.string(), - id: z.string().uuid(), - internetGatewayId: z.string().uuid(), + id: z.uuid(), + internetGatewayId: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -2590,7 +2575,7 @@ export const InternetGatewayIpAddress = z.preprocess( */ export const InternetGatewayIpAddressCreate = z.preprocess( processResponseBody, - z.object({ address: z.string().ip(), description: z.string(), name: Name }), + z.object({ address: z.ipv4(), description: z.string(), name: Name }), ); /** @@ -2611,9 +2596,9 @@ export const InternetGatewayIpPool = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), - internetGatewayId: z.string().uuid(), - ipPoolId: z.string().uuid(), + id: z.uuid(), + internetGatewayId: z.uuid(), + ipPoolId: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -2657,7 +2642,7 @@ export const IpPool = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -2684,10 +2669,7 @@ export const IpPoolLinkSilo = z.preprocess( */ export const Ipv4Range = z.preprocess( processResponseBody, - z.object({ - first: z.string().ip({ version: "v4" }), - last: z.string().ip({ version: "v4" }), - }), + z.object({ first: z.ipv4(), last: z.ipv4() }), ); /** @@ -2697,10 +2679,7 @@ export const Ipv4Range = z.preprocess( */ export const Ipv6Range = z.preprocess( processResponseBody, - z.object({ - first: z.string().ip({ version: "v6" }), - last: z.string().ip({ version: "v6" }), - }), + z.object({ first: z.ipv6(), last: z.ipv6() }), ); export const IpRange = z.preprocess( @@ -2711,8 +2690,8 @@ export const IpRange = z.preprocess( export const IpPoolRange = z.preprocess( processResponseBody, z.object({ - id: z.string().uuid(), - ipPoolId: z.string().uuid(), + id: z.uuid(), + ipPoolId: z.uuid(), range: IpRange, timeCreated: z.coerce.date(), }), @@ -2745,11 +2724,7 @@ export const IpPoolResultsPage = z.preprocess( */ export const IpPoolSiloLink = z.preprocess( processResponseBody, - z.object({ - ipPoolId: z.string().uuid(), - isDefault: SafeBoolean, - siloId: z.string().uuid(), - }), + z.object({ ipPoolId: z.uuid(), isDefault: SafeBoolean, siloId: z.uuid() }), ); /** @@ -2829,7 +2804,7 @@ export const LldpLinkConfigCreate = z.preprocess( enabled: SafeBoolean, linkDescription: z.string().nullable().optional(), linkName: z.string().nullable().optional(), - managementIp: z.string().ip().nullable().optional(), + managementIp: z.ipv4().nullable().optional(), systemDescription: z.string().nullable().optional(), systemName: z.string().nullable().optional(), }), @@ -2891,10 +2866,10 @@ export const LldpLinkConfig = z.preprocess( z.object({ chassisId: z.string().nullable().optional(), enabled: SafeBoolean, - id: z.string().uuid(), + id: z.uuid(), linkDescription: z.string().nullable().optional(), linkName: z.string().nullable().optional(), - managementIp: z.string().ip().nullable().optional(), + managementIp: z.ipv4().nullable().optional(), systemDescription: z.string().nullable().optional(), systemName: z.string().nullable().optional(), }), @@ -2903,7 +2878,7 @@ export const LldpLinkConfig = z.preprocess( export const NetworkAddress = z.preprocess( processResponseBody, z.union([ - z.object({ ipAddr: z.string().ip() }), + z.object({ ipAddr: z.ipv4() }), z.object({ iEEE802: z.number().min(0).max(255).array() }), ]), ); @@ -2953,9 +2928,9 @@ export const LoopbackAddress = z.preprocess( processResponseBody, z.object({ address: IpNet, - addressLotBlockId: z.string().uuid(), - id: z.string().uuid(), - rackId: z.string().uuid(), + addressLotBlockId: z.uuid(), + id: z.uuid(), + rackId: z.uuid(), switchLocation: z.string(), }), ); @@ -2966,11 +2941,11 @@ export const LoopbackAddress = z.preprocess( export const LoopbackAddressCreate = z.preprocess( processResponseBody, z.object({ - address: z.string().ip(), + address: z.ipv4(), addressLot: NameOrId, anycast: SafeBoolean, mask: z.number().min(0).max(255), - rackId: z.string().uuid(), + rackId: z.uuid(), switchLocation: Name, }), ); @@ -3019,9 +2994,9 @@ export const MetricType = z.preprocess( export const NetworkInterfaceKind = z.preprocess( processResponseBody, z.union([ - z.object({ id: z.string().uuid(), type: z.enum(["instance"]) }), - z.object({ id: z.string().uuid(), type: z.enum(["service"]) }), - z.object({ id: z.string().uuid(), type: z.enum(["probe"]) }), + z.object({ id: z.uuid(), type: z.enum(["instance"]) }), + z.object({ id: z.uuid(), type: z.enum(["service"]) }), + z.object({ id: z.uuid(), type: z.enum(["probe"]) }), ]), ); @@ -3039,8 +3014,8 @@ export const Vni = z.preprocess( export const NetworkInterface = z.preprocess( processResponseBody, z.object({ - id: z.string().uuid(), - ip: z.string().ip(), + id: z.uuid(), + ip: z.ipv4(), kind: NetworkInterfaceKind, mac: MacAddr, name: Name, @@ -3114,7 +3089,7 @@ export const Points = z.preprocess( */ export const Timeseries = z.preprocess( processResponseBody, - z.object({ fields: z.record(z.string().min(1), FieldValue), points: Points }), + z.object({ fields: z.record(z.string(), FieldValue), points: Points }), ); /** @@ -3124,10 +3099,7 @@ export const Timeseries = z.preprocess( */ export const Table = z.preprocess( processResponseBody, - z.object({ - name: z.string(), - timeseries: z.record(z.string().min(1), Timeseries), - }), + z.object({ name: z.string(), timeseries: z.record(z.string(), Timeseries) }), ); /** @@ -3181,11 +3153,11 @@ export const PhysicalDisk = z.preprocess( processResponseBody, z.object({ formFactor: PhysicalDiskKind, - id: z.string().uuid(), + id: z.uuid(), model: z.string(), policy: PhysicalDiskPolicy, serial: z.string(), - sledId: z.string().uuid().nullable().optional(), + sledId: z.uuid().nullable().optional(), state: PhysicalDiskState, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -3218,9 +3190,9 @@ export const Probe = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, - sled: z.string().uuid(), + sled: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }), @@ -3235,7 +3207,7 @@ export const ProbeCreate = z.preprocess( description: z.string(), ipPool: NameOrId.nullable().optional(), name: Name, - sled: z.string().uuid(), + sled: z.uuid(), }), ); @@ -3248,7 +3220,7 @@ export const ProbeExternalIp = z.preprocess( processResponseBody, z.object({ firstPort: z.number().min(0).max(65535), - ip: z.string().ip(), + ip: z.ipv4(), kind: ProbeExternalIpKind, lastPort: z.number().min(0).max(65535), }), @@ -3258,10 +3230,10 @@ export const ProbeInfo = z.preprocess( processResponseBody, z.object({ externalIps: ProbeExternalIp.array(), - id: z.string().uuid(), + id: z.uuid(), interface: NetworkInterface, name: Name, - sled: z.string().uuid(), + sled: z.uuid(), }), ); @@ -3283,7 +3255,7 @@ export const Project = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -3322,7 +3294,7 @@ export const ProjectRole = z.preprocess( export const ProjectRoleRoleAssignment = z.preprocess( processResponseBody, z.object({ - identityId: z.string().uuid(), + identityId: z.uuid(), identityType: IdentityType, roleName: ProjectRole, }), @@ -3355,7 +3327,7 @@ export const ProjectUpdate = z.preprocess( export const Rack = z.preprocess( processResponseBody, z.object({ - id: z.string().uuid(), + id: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }), @@ -3376,7 +3348,7 @@ export const Route = z.preprocess( processResponseBody, z.object({ dst: IpNet, - gw: z.string().ip(), + gw: z.ipv4(), ribPriority: z.number().min(0).max(255).nullable().optional(), vid: z.number().min(0).max(65535).nullable().optional(), }), @@ -3398,7 +3370,7 @@ export const RouteConfig = z.preprocess( export const RouteDestination = z.preprocess( processResponseBody, z.union([ - z.object({ type: z.enum(["ip"]), value: z.string().ip() }), + z.object({ type: z.enum(["ip"]), value: z.ipv4() }), z.object({ type: z.enum(["ip_net"]), value: IpNet }), z.object({ type: z.enum(["vpc"]), value: Name }), z.object({ type: z.enum(["subnet"]), value: Name }), @@ -3411,7 +3383,7 @@ export const RouteDestination = z.preprocess( export const RouteTarget = z.preprocess( processResponseBody, z.union([ - z.object({ type: z.enum(["ip"]), value: z.string().ip() }), + z.object({ type: z.enum(["ip"]), value: z.ipv4() }), z.object({ type: z.enum(["vpc"]), value: Name }), z.object({ type: z.enum(["subnet"]), value: Name }), z.object({ type: z.enum(["instance"]), value: Name }), @@ -3438,13 +3410,13 @@ export const RouterRoute = z.preprocess( z.object({ description: z.string(), destination: RouteDestination, - id: z.string().uuid(), + id: z.uuid(), kind: RouterRouteKind, name: Name, target: RouteTarget, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), - vpcRouterId: z.string().uuid(), + vpcRouterId: z.uuid(), }), ); @@ -3494,7 +3466,7 @@ export const SamlIdentityProvider = z.preprocess( acsUrl: z.string(), description: z.string(), groupAttributeName: z.string().nullable().optional(), - id: z.string().uuid(), + id: z.uuid(), idpEntityId: z.string(), name: Name, publicCert: z.string().nullable().optional(), @@ -3518,7 +3490,7 @@ export const SamlIdentityProviderCreate = z.preprocess( idpEntityId: z.string(), idpMetadataSource: IdpMetadataSource, name: Name, - signingKeypair: DerEncodedKeyPair.default(null).nullable().optional(), + signingKeypair: DerEncodedKeyPair.nullable().default(null).optional(), sloUrl: z.string(), spClientId: z.string(), technicalContactEmail: z.string(), @@ -3565,10 +3537,10 @@ export const Silo = z.preprocess( z.object({ description: z.string(), discoverable: SafeBoolean, - id: z.string().uuid(), + id: z.uuid(), identityMode: SiloIdentityMode, mappedFleetRoles: z.record( - z.string().min(1), + z.string(), FleetRole.array().refine(...uniqueItems), ), name: Name, @@ -3589,7 +3561,7 @@ export const SiloAuthSettings = z.preprocess( .max(4294967295) .nullable() .optional(), - siloId: z.string().uuid(), + siloId: z.uuid(), }), ); @@ -3622,7 +3594,7 @@ export const SiloCreate = z.preprocess( discoverable: SafeBoolean, identityMode: SiloIdentityMode, mappedFleetRoles: z - .record(z.string().min(1), FleetRole.array().refine(...uniqueItems)) + .record(z.string(), FleetRole.array().refine(...uniqueItems)) .optional(), name: Name, quotas: SiloQuotasCreate, @@ -3637,7 +3609,7 @@ export const SiloIpPool = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), isDefault: SafeBoolean, name: Name, timeCreated: z.coerce.date(), @@ -3664,7 +3636,7 @@ export const SiloQuotas = z.preprocess( z.object({ cpus: z.number(), memory: ByteCount, - siloId: z.string().uuid(), + siloId: z.uuid(), storage: ByteCount, }), ); @@ -3713,7 +3685,7 @@ export const SiloRole = z.preprocess( export const SiloRoleRoleAssignment = z.preprocess( processResponseBody, z.object({ - identityId: z.string().uuid(), + identityId: z.uuid(), identityType: IdentityType, roleName: SiloRole, }), @@ -3745,7 +3717,7 @@ export const SiloUtilization = z.preprocess( z.object({ allocated: VirtualResourceCounts, provisioned: VirtualResourceCounts, - siloId: z.string().uuid(), + siloId: z.uuid(), siloName: Name, }), ); @@ -3800,9 +3772,9 @@ export const Sled = z.preprocess( processResponseBody, z.object({ baseboard: Baseboard, - id: z.string().uuid(), + id: z.uuid(), policy: SledPolicy, - rackId: z.string().uuid(), + rackId: z.uuid(), state: SledState, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -3816,7 +3788,7 @@ export const Sled = z.preprocess( */ export const SledId = z.preprocess( processResponseBody, - z.object({ id: z.string().uuid() }), + z.object({ id: z.uuid() }), ); /** @@ -3825,10 +3797,10 @@ export const SledId = z.preprocess( export const SledInstance = z.preprocess( processResponseBody, z.object({ - activeSledId: z.string().uuid(), - id: z.string().uuid(), + activeSledId: z.uuid(), + id: z.uuid(), memory: z.number(), - migrationId: z.string().uuid().nullable().optional(), + migrationId: z.uuid().nullable().optional(), name: Name, ncpus: z.number(), projectName: Name, @@ -3886,10 +3858,10 @@ export const Snapshot = z.preprocess( processResponseBody, z.object({ description: z.string(), - diskId: z.string().uuid(), - id: z.string().uuid(), + diskId: z.uuid(), + id: z.uuid(), name: Name, - projectId: z.string().uuid(), + projectId: z.uuid(), size: ByteCount, state: SnapshotState, timeCreated: z.coerce.date(), @@ -3923,10 +3895,10 @@ export const SshKey = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, publicKey: z.string(), - siloUserId: z.string().uuid(), + siloUserId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }), @@ -3958,7 +3930,7 @@ export const SupportBundleCreate = z.preprocess( export const TypedUuidForSupportBundleKind = z.preprocess( processResponseBody, - z.string().uuid(), + z.uuid(), ); export const SupportBundleState = z.preprocess( @@ -4001,8 +3973,8 @@ export const Switch = z.preprocess( processResponseBody, z.object({ baseboard: Baseboard, - id: z.string().uuid(), - rackId: z.string().uuid(), + id: z.uuid(), + rackId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }), @@ -4022,10 +3994,10 @@ export const SwitchInterfaceKind2 = z.preprocess( export const SwitchInterfaceConfig = z.preprocess( processResponseBody, z.object({ - id: z.string().uuid(), + id: z.uuid(), interfaceName: Name, kind: SwitchInterfaceKind2, - portSettingsId: z.string().uuid(), + portSettingsId: z.uuid(), v6Enabled: SafeBoolean, }), ); @@ -4056,7 +4028,7 @@ export const SwitchInterfaceConfigCreate = z.preprocess( export const SwitchLinkState = z.preprocess( processResponseBody, - z.record(z.unknown()), + z.record(z.string(), z.unknown()), ); /** @@ -4065,10 +4037,10 @@ export const SwitchLinkState = z.preprocess( export const SwitchPort = z.preprocess( processResponseBody, z.object({ - id: z.string().uuid(), + id: z.uuid(), portName: Name, - portSettingsId: z.string().uuid().nullable().optional(), - rackId: z.string().uuid(), + portSettingsId: z.uuid().nullable().optional(), + rackId: z.uuid(), switchLocation: z.string(), }), ); @@ -4080,11 +4052,11 @@ export const SwitchPortAddressView = z.preprocess( processResponseBody, z.object({ address: IpNet, - addressLotBlockId: z.string().uuid(), - addressLotId: z.string().uuid(), + addressLotBlockId: z.uuid(), + addressLotId: z.uuid(), addressLotName: Name, interfaceName: Name, - portSettingsId: z.string().uuid(), + portSettingsId: z.uuid(), vlanId: z.number().min(0).max(65535).nullable().optional(), }), ); @@ -4110,10 +4082,7 @@ export const SwitchPortGeometry2 = z.preprocess( */ export const SwitchPortConfig = z.preprocess( processResponseBody, - z.object({ - geometry: SwitchPortGeometry2, - portSettingsId: z.string().uuid(), - }), + z.object({ geometry: SwitchPortGeometry2, portSettingsId: z.uuid() }), ); /** @@ -4157,7 +4126,7 @@ export const SwitchPortLinkConfig = z.preprocess( linkName: Name, lldpLinkConfig: LldpLinkConfig.nullable().optional(), mtu: z.number().min(0).max(65535), - portSettingsId: z.string().uuid(), + portSettingsId: z.uuid(), speed: LinkSpeed, txEqConfig: TxEqConfig2.nullable().optional(), }), @@ -4181,9 +4150,9 @@ export const SwitchPortRouteConfig = z.preprocess( processResponseBody, z.object({ dst: IpNet, - gw: z.string().ip(), + gw: z.ipv4(), interfaceName: Name, - portSettingsId: z.string().uuid(), + portSettingsId: z.uuid(), ribPriority: z.number().min(0).max(255).nullable().optional(), vlanId: z.number().min(0).max(65535).nullable().optional(), }), @@ -4194,10 +4163,7 @@ export const SwitchPortRouteConfig = z.preprocess( */ export const SwitchPortSettingsGroups = z.preprocess( processResponseBody, - z.object({ - portSettingsGroupId: z.string().uuid(), - portSettingsId: z.string().uuid(), - }), + z.object({ portSettingsGroupId: z.uuid(), portSettingsId: z.uuid() }), ); /** @@ -4206,7 +4172,7 @@ export const SwitchPortSettingsGroups = z.preprocess( export const SwitchVlanInterfaceConfig = z.preprocess( processResponseBody, z.object({ - interfaceConfigId: z.string().uuid(), + interfaceConfigId: z.uuid(), vlanId: z.number().min(0).max(65535), }), ); @@ -4221,7 +4187,7 @@ export const SwitchPortSettings = z.preprocess( bgpPeers: BgpPeer.array(), description: z.string(), groups: SwitchPortSettingsGroups.array(), - id: z.string().uuid(), + id: z.uuid(), interfaces: SwitchInterfaceConfig.array(), links: SwitchPortLinkConfig.array(), name: Name, @@ -4258,7 +4224,7 @@ export const SwitchPortSettingsIdentity = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -4475,7 +4441,7 @@ export const UninitializedSled = z.preprocess( z.object({ baseboard: Baseboard, cubby: z.number().min(0).max(65535), - rackId: z.string().uuid(), + rackId: z.uuid(), }), ); @@ -4504,8 +4470,8 @@ export const UninitializedSledResultsPage = z.preprocess( export const UpdatesTrustRoot = z.preprocess( processResponseBody, z.object({ - id: z.string().uuid(), - rootRole: z.record(z.unknown()), + id: z.uuid(), + rootRole: z.record(z.string(), z.unknown()), timeCreated: z.coerce.date(), }), ); @@ -4526,11 +4492,7 @@ export const UpdatesTrustRootResultsPage = z.preprocess( */ export const User = z.preprocess( processResponseBody, - z.object({ - displayName: z.string(), - id: z.string().uuid(), - siloId: z.string().uuid(), - }), + z.object({ displayName: z.string(), id: z.uuid(), siloId: z.uuid() }), ); /** @@ -4542,7 +4504,7 @@ export const UserBuiltin = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -4630,11 +4592,11 @@ export const Vpc = z.preprocess( z.object({ description: z.string(), dnsName: Name, - id: z.string().uuid(), + id: z.uuid(), ipv6Prefix: Ipv6Net, name: Name, - projectId: z.string().uuid(), - systemRouterId: z.string().uuid(), + projectId: z.uuid(), + systemRouterId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }), @@ -4680,7 +4642,7 @@ export const VpcFirewallRuleHostFilter = z.preprocess( z.object({ type: z.enum(["vpc"]), value: Name }), z.object({ type: z.enum(["subnet"]), value: Name }), z.object({ type: z.enum(["instance"]), value: Name }), - z.object({ type: z.enum(["ip"]), value: z.string().ip() }), + z.object({ type: z.enum(["ip"]), value: z.ipv4() }), z.object({ type: z.enum(["ip_net"]), value: IpNet }), ]), ); @@ -4726,7 +4688,7 @@ export const VpcFirewallRuleTarget = z.preprocess( z.object({ type: z.enum(["vpc"]), value: Name }), z.object({ type: z.enum(["subnet"]), value: Name }), z.object({ type: z.enum(["instance"]), value: Name }), - z.object({ type: z.enum(["ip"]), value: z.string().ip() }), + z.object({ type: z.enum(["ip"]), value: z.ipv4() }), z.object({ type: z.enum(["ip_net"]), value: IpNet }), ]), ); @@ -4741,14 +4703,14 @@ export const VpcFirewallRule = z.preprocess( description: z.string(), direction: VpcFirewallRuleDirection, filters: VpcFirewallRuleFilter, - id: z.string().uuid(), + id: z.uuid(), name: Name, priority: z.number().min(0).max(65535), status: VpcFirewallRuleStatus, targets: VpcFirewallRuleTarget.array(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), - vpcId: z.string().uuid(), + vpcId: z.uuid(), }), ); @@ -4805,12 +4767,12 @@ export const VpcRouter = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), kind: VpcRouterKind, name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), - vpcId: z.string().uuid(), + vpcId: z.uuid(), }), ); @@ -4850,15 +4812,15 @@ export const VpcRouterUpdate = z.preprocess( export const VpcSubnet = z.preprocess( processResponseBody, z.object({ - customRouterId: z.string().uuid().nullable().optional(), + customRouterId: z.uuid().nullable().optional(), description: z.string(), - id: z.string().uuid(), + id: z.uuid(), ipv4Block: Ipv4Net, ipv6Block: Ipv6Net, name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), - vpcId: z.string().uuid(), + vpcId: z.uuid(), }), ); @@ -4933,7 +4895,7 @@ export const WebhookReceiver = z.preprocess( z.object({ description: z.string(), endpoint: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, secrets: WebhookSecret.array(), subscriptions: AlertSubscription.array(), @@ -5115,7 +5077,7 @@ export const SupportBundleViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), }), query: z.object({}), }), @@ -5125,7 +5087,7 @@ export const SupportBundleUpdateParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), }), query: z.object({}), }), @@ -5135,7 +5097,7 @@ export const SupportBundleDeleteParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), }), query: z.object({}), }), @@ -5145,7 +5107,7 @@ export const SupportBundleDownloadParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), }), query: z.object({}), }), @@ -5155,7 +5117,7 @@ export const SupportBundleHeadParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), }), query: z.object({}), }), @@ -5165,7 +5127,7 @@ export const SupportBundleDownloadFileParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), file: z.string(), }), query: z.object({}), @@ -5176,7 +5138,7 @@ export const SupportBundleHeadFileParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), file: z.string(), }), query: z.object({}), @@ -5187,7 +5149,7 @@ export const SupportBundleIndexParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), }), query: z.object({}), }), @@ -5415,7 +5377,7 @@ export const AlertDeliveryResendParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - alertId: z.string().uuid(), + alertId: z.uuid(), }), query: z.object({ receiver: NameOrId, @@ -5786,7 +5748,7 @@ export const GroupViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - groupId: z.string().uuid(), + groupId: z.uuid(), }), query: z.object({}), }), @@ -6306,7 +6268,7 @@ export const CurrentUserAccessTokenDeleteParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - tokenId: z.string().uuid(), + tokenId: z.uuid(), }), query: z.object({}), }), @@ -6616,7 +6578,7 @@ export const PhysicalDiskViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - diskId: z.string().uuid(), + diskId: z.uuid(), }), query: z.object({}), }), @@ -6627,7 +6589,7 @@ export const NetworkingSwitchPortLldpNeighborsParams = z.preprocess( z.object({ path: z.object({ port: Name, - rackId: z.string().uuid(), + rackId: z.uuid(), switchLocation: Name, }), query: z.object({ @@ -6654,7 +6616,7 @@ export const RackViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - rackId: z.string().uuid(), + rackId: z.uuid(), }), query: z.object({}), }), @@ -6684,7 +6646,7 @@ export const SledViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - sledId: z.string().uuid(), + sledId: z.uuid(), }), query: z.object({}), }), @@ -6694,7 +6656,7 @@ export const SledPhysicalDiskListParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - sledId: z.string().uuid(), + sledId: z.uuid(), }), query: z.object({ limit: z.number().min(1).max(4294967295).nullable().optional(), @@ -6708,7 +6670,7 @@ export const SledInstanceListParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - sledId: z.string().uuid(), + sledId: z.uuid(), }), query: z.object({ limit: z.number().min(1).max(4294967295).nullable().optional(), @@ -6722,7 +6684,7 @@ export const SledSetProvisionPolicyParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - sledId: z.string().uuid(), + sledId: z.uuid(), }), query: z.object({}), }), @@ -6747,7 +6709,7 @@ export const NetworkingSwitchPortListParams = z.preprocess( limit: z.number().min(1).max(4294967295).nullable().optional(), pageToken: z.string().nullable().optional(), sortBy: IdSortMode.optional(), - switchPortId: z.string().uuid().nullable().optional(), + switchPortId: z.uuid().nullable().optional(), }), }), ); @@ -6759,7 +6721,7 @@ export const NetworkingSwitchPortLldpConfigViewParams = z.preprocess( port: Name, }), query: z.object({ - rackId: z.string().uuid(), + rackId: z.uuid(), switchLocation: Name, }), }), @@ -6772,7 +6734,7 @@ export const NetworkingSwitchPortLldpConfigUpdateParams = z.preprocess( port: Name, }), query: z.object({ - rackId: z.string().uuid(), + rackId: z.uuid(), switchLocation: Name, }), }), @@ -6785,7 +6747,7 @@ export const NetworkingSwitchPortApplySettingsParams = z.preprocess( port: Name, }), query: z.object({ - rackId: z.string().uuid(), + rackId: z.uuid(), switchLocation: Name, }), }), @@ -6798,7 +6760,7 @@ export const NetworkingSwitchPortClearSettingsParams = z.preprocess( port: Name, }), query: z.object({ - rackId: z.string().uuid(), + rackId: z.uuid(), switchLocation: Name, }), }), @@ -6811,7 +6773,7 @@ export const NetworkingSwitchPortStatusParams = z.preprocess( port: Name, }), query: z.object({ - rackId: z.string().uuid(), + rackId: z.uuid(), switchLocation: Name, }), }), @@ -6833,7 +6795,7 @@ export const SwitchViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - switchId: z.string().uuid(), + switchId: z.uuid(), }), query: z.object({}), }), @@ -6866,7 +6828,7 @@ export const LocalIdpUserDeleteParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - userId: z.string().uuid(), + userId: z.uuid(), }), query: z.object({ silo: NameOrId, @@ -6878,7 +6840,7 @@ export const LocalIdpUserSetPasswordParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - userId: z.string().uuid(), + userId: z.uuid(), }), query: z.object({ silo: NameOrId, @@ -7329,8 +7291,8 @@ export const NetworkingLoopbackAddressDeleteParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - address: z.string().ip(), - rackId: z.string().uuid(), + address: z.ipv4(), + rackId: z.uuid(), subnetMask: z.number().min(0).max(255), switchLocation: Name, }), @@ -7584,7 +7546,7 @@ export const SystemUpdateTrustRootViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - trustRootId: z.string().uuid(), + trustRootId: z.uuid(), }), query: z.object({}), }), @@ -7594,7 +7556,7 @@ export const SystemUpdateTrustRootDeleteParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - trustRootId: z.string().uuid(), + trustRootId: z.uuid(), }), query: z.object({}), }), @@ -7617,7 +7579,7 @@ export const SiloUserViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - userId: z.string().uuid(), + userId: z.uuid(), }), query: z.object({ silo: NameOrId, @@ -7684,7 +7646,7 @@ export const UserListParams = z.preprocess( z.object({ path: z.object({}), query: z.object({ - group: z.string().uuid().nullable().optional(), + group: z.uuid().nullable().optional(), limit: z.number().min(1).max(4294967295).nullable().optional(), pageToken: z.string().nullable().optional(), sortBy: IdSortMode.optional(), @@ -7696,7 +7658,7 @@ export const UserViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - userId: z.string().uuid(), + userId: z.uuid(), }), query: z.object({}), }), @@ -7706,7 +7668,7 @@ export const UserTokenListParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - userId: z.string().uuid(), + userId: z.uuid(), }), query: z.object({ limit: z.number().min(1).max(4294967295).nullable().optional(), @@ -7720,7 +7682,7 @@ export const UserLogoutParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - userId: z.string().uuid(), + userId: z.uuid(), }), query: z.object({}), }), @@ -7730,7 +7692,7 @@ export const UserSessionListParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - userId: z.string().uuid(), + userId: z.uuid(), }), query: z.object({ limit: z.number().min(1).max(4294967295).nullable().optional(), @@ -8084,7 +8046,7 @@ export const WebhookSecretsDeleteParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - secretId: z.string().uuid(), + secretId: z.uuid(), }), query: z.object({}), }), diff --git a/oxide-openapi-gen-ts/src/client/msw-handlers.ts b/oxide-openapi-gen-ts/src/client/msw-handlers.ts index cab01a7..ed4f44f 100644 --- a/oxide-openapi-gen-ts/src/client/msw-handlers.ts +++ b/oxide-openapi-gen-ts/src/client/msw-handlers.ts @@ -33,7 +33,7 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document, destDir: string) { type PathParams, } from "msw"; import type { SnakeCasedPropertiesDeep as Snakify, Promisable } from "type-fest"; - import { type ZodSchema } from "zod"; + import { type ZodType } from "zod/v4"; import type * as Api from "./Api"; import { snakeify } from "./util"; import * as schema from "./validate"; @@ -105,7 +105,7 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document, destDir: string) { w("}"); w(` - function validateParams(schema: S, req: Request, pathParams: PathParams) { + function validateParams(schema: S, req: Request, pathParams: PathParams) { const rawParams = new URLSearchParams(new URL(req.url).search) const params: [string, unknown][] = [] @@ -131,7 +131,9 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document, destDir: string) { return { paramsErr: json({ error_code, message }, { status }) } } - const handler = (handler: MSWHandlers[keyof MSWHandlers], paramSchema: ZodSchema | null, bodySchema: ZodSchema | null) => + const handler = (handler: MSWHandlers[keyof MSWHandlers], + // eslint-disable-next-line @typescript-eslint/no-explicit-any + paramSchema: ZodType | null, bodySchema: ZodType | null) => async ({ request: req, params: pathParams, diff --git a/oxide-openapi-gen-ts/src/client/zodValidators.ts b/oxide-openapi-gen-ts/src/client/zodValidators.ts index 7bb7cac..4a6a589 100644 --- a/oxide-openapi-gen-ts/src/client/zodValidators.ts +++ b/oxide-openapi-gen-ts/src/client/zodValidators.ts @@ -29,7 +29,7 @@ export function generateZodValidators( w(`/* eslint-disable */ - import { z, ZodType } from 'zod'; + import { z, ZodType } from 'zod/v4'; import { processResponseBody, uniqueItems } from './util'; /** diff --git a/oxide-openapi-gen-ts/src/schema/zod.ts b/oxide-openapi-gen-ts/src/schema/zod.ts index 56092ba..30fb04f 100644 --- a/oxide-openapi-gen-ts/src/schema/zod.ts +++ b/oxide-openapi-gen-ts/src/schema/zod.ts @@ -38,33 +38,33 @@ export const schemaToZod = makeSchemaGenerator({ }, string(schema, { w0 }) { - w0(`z.string()`); - - if ("default" in schema) { - w0(`.default(${JSON.stringify(schema.default)})`); - } + // Handle special formats that become standalone in Zod v4 if (schema.format === "uuid") { - w0(".uuid()"); - } - - if (schema.format === "ip") { - w0(".ip()"); + w0("z.uuid()"); + } else if (schema.format === "ip") { + // Generic IP becomes IPv4 for backward compatibility + w0("z.ipv4()"); } else if (schema.format === "ipv4") { - w0(".ip({ version: 'v4' })"); + w0("z.ipv4()"); } else if (schema.format === "ipv6") { - w0(".ip({ version: 'v6' })"); - } + w0("z.ipv6()"); + } else { + // Regular string handling + w0(`z.string()`); - if ("minLength" in schema) { - w0(`.min(${schema.minLength})`); - } - if ("maxLength" in schema) { - w0(`.max(${schema.maxLength})`); - } - if ("pattern" in schema) { - w0(`.regex(${new RegExp(schema.pattern!).toString()})`); + if ("minLength" in schema) { + w0(`.min(${schema.minLength})`); + } + if ("maxLength" in schema) { + w0(`.max(${schema.maxLength})`); + } + if ("pattern" in schema) { + w0(`.regex(${new RegExp(schema.pattern!).toString()})`); + } } + if (schema.nullable) w0(".nullable()"); + if ("default" in schema) w0(`.default(${JSON.stringify(schema.default)})`); }, date(schema, { w0 }) { @@ -98,7 +98,7 @@ export const schemaToZod = makeSchemaGenerator({ const { w0, w } = io; // record type, which only tells us the type of the values if (!schema.properties || Object.keys(schema.properties).length === 0) { - w0("z.record(z.string().min(1),"); + w0("z.record(z.string(),"); if (typeof schema.additionalProperties === "object") { schemaToZod(schema.additionalProperties, io); } else { @@ -179,14 +179,12 @@ export const schemaToZod = makeSchemaGenerator({ w("])"); } - if ("default" in schema) { - w0(`.default(${JSON.stringify(schema.default)})`); - } - if (schema.nullable) io.w0(".nullable()"); + if (schema.nullable) w0(".nullable()"); + if ("default" in schema) w0(`.default(${JSON.stringify(schema.default)})`); }, empty({ w0 }) { - w0("z.record(z.unknown())"); + w0("z.record(z.string(), z.unknown())"); }, default(schema) { From c1e216fbb08d2250d3bfe81c78a61ab7519d31fa Mon Sep 17 00:00:00 2001 From: David Crespo Date: Fri, 15 Aug 2025 16:39:09 -0500 Subject: [PATCH 3/4] remove msw and zod from the repo --- oxide-api/src/msw-handlers.ts | 3664 --------------- oxide-api/src/validate.ts | 8053 --------------------------------- tools/gen.sh | 2 +- 3 files changed, 1 insertion(+), 11718 deletions(-) delete mode 100644 oxide-api/src/msw-handlers.ts delete mode 100644 oxide-api/src/validate.ts diff --git a/oxide-api/src/msw-handlers.ts b/oxide-api/src/msw-handlers.ts deleted file mode 100644 index 65bf704..0000000 --- a/oxide-api/src/msw-handlers.ts +++ /dev/null @@ -1,3664 +0,0 @@ -import { - http, - type HttpHandler, - HttpResponse, - type StrictResponse, - type PathParams, -} from "msw"; -import type { - SnakeCasedPropertiesDeep as Snakify, - Promisable, -} from "type-fest"; -import { type ZodType } from "zod/v4"; -import type * as Api from "./Api"; -import { snakeify } from "./util"; -import * as schema from "./validate"; - -type HandlerResult = Json | StrictResponse>; -type StatusCode = number; - -// these are used for turning our nice JS-ified API types back into the original -// API JSON types (snake cased and dates as strings) for use in our mock API - -type StringifyDates = T extends Date - ? string - : { - [K in keyof T]: T[K] extends Array - ? Array> - : StringifyDates; - }; - -/** - * Snake case fields and convert dates to strings. Not intended to be a general - * purpose JSON type! - */ -export type Json = Snakify>; -export const json = HttpResponse.json; - -// Shortcut to reduce number of imports required in consumers -export { HttpResponse }; - -export interface MSWHandlers { - /** `POST /device/auth` */ - deviceAuthRequest: (params: { - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /device/confirm` */ - deviceAuthConfirm: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /device/token` */ - deviceAccessToken: (params: { - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /experimental/v1/probes` */ - probeList: (params: { - query: Api.ProbeListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /experimental/v1/probes` */ - probeCreate: (params: { - query: Api.ProbeCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /experimental/v1/probes/:probe` */ - probeView: (params: { - path: Api.ProbeViewPathParams; - query: Api.ProbeViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /experimental/v1/probes/:probe` */ - probeDelete: (params: { - path: Api.ProbeDeletePathParams; - query: Api.ProbeDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /experimental/v1/system/support-bundles` */ - supportBundleList: (params: { - query: Api.SupportBundleListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /experimental/v1/system/support-bundles` */ - supportBundleCreate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /experimental/v1/system/support-bundles/:bundleId` */ - supportBundleView: (params: { - path: Api.SupportBundleViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /experimental/v1/system/support-bundles/:bundleId` */ - supportBundleUpdate: (params: { - path: Api.SupportBundleUpdatePathParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /experimental/v1/system/support-bundles/:bundleId` */ - supportBundleDelete: (params: { - path: Api.SupportBundleDeletePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /experimental/v1/system/support-bundles/:bundleId/download` */ - supportBundleDownload: (params: { - path: Api.SupportBundleDownloadPathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `HEAD /experimental/v1/system/support-bundles/:bundleId/download` */ - supportBundleHead: (params: { - path: Api.SupportBundleHeadPathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /experimental/v1/system/support-bundles/:bundleId/download/:file` */ - supportBundleDownloadFile: (params: { - path: Api.SupportBundleDownloadFilePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `HEAD /experimental/v1/system/support-bundles/:bundleId/download/:file` */ - supportBundleHeadFile: (params: { - path: Api.SupportBundleHeadFilePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /experimental/v1/system/support-bundles/:bundleId/index` */ - supportBundleIndex: (params: { - path: Api.SupportBundleIndexPathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /login/:siloName/saml/:providerName` */ - loginSaml: (params: { - path: Api.LoginSamlPathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/affinity-groups` */ - affinityGroupList: (params: { - query: Api.AffinityGroupListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/affinity-groups` */ - affinityGroupCreate: (params: { - query: Api.AffinityGroupCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/affinity-groups/:affinityGroup` */ - affinityGroupView: (params: { - path: Api.AffinityGroupViewPathParams; - query: Api.AffinityGroupViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/affinity-groups/:affinityGroup` */ - affinityGroupUpdate: (params: { - path: Api.AffinityGroupUpdatePathParams; - query: Api.AffinityGroupUpdateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/affinity-groups/:affinityGroup` */ - affinityGroupDelete: (params: { - path: Api.AffinityGroupDeletePathParams; - query: Api.AffinityGroupDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/affinity-groups/:affinityGroup/members` */ - affinityGroupMemberList: (params: { - path: Api.AffinityGroupMemberListPathParams; - query: Api.AffinityGroupMemberListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/affinity-groups/:affinityGroup/members/instance/:instance` */ - affinityGroupMemberInstanceView: (params: { - path: Api.AffinityGroupMemberInstanceViewPathParams; - query: Api.AffinityGroupMemberInstanceViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/affinity-groups/:affinityGroup/members/instance/:instance` */ - affinityGroupMemberInstanceAdd: (params: { - path: Api.AffinityGroupMemberInstanceAddPathParams; - query: Api.AffinityGroupMemberInstanceAddQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/affinity-groups/:affinityGroup/members/instance/:instance` */ - affinityGroupMemberInstanceDelete: (params: { - path: Api.AffinityGroupMemberInstanceDeletePathParams; - query: Api.AffinityGroupMemberInstanceDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/alert-classes` */ - alertClassList: (params: { - query: Api.AlertClassListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/alert-receivers` */ - alertReceiverList: (params: { - query: Api.AlertReceiverListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/alert-receivers/:receiver` */ - alertReceiverView: (params: { - path: Api.AlertReceiverViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/alert-receivers/:receiver` */ - alertReceiverDelete: (params: { - path: Api.AlertReceiverDeletePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/alert-receivers/:receiver/deliveries` */ - alertDeliveryList: (params: { - path: Api.AlertDeliveryListPathParams; - query: Api.AlertDeliveryListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/alert-receivers/:receiver/probe` */ - alertReceiverProbe: (params: { - path: Api.AlertReceiverProbePathParams; - query: Api.AlertReceiverProbeQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/alert-receivers/:receiver/subscriptions` */ - alertReceiverSubscriptionAdd: (params: { - path: Api.AlertReceiverSubscriptionAddPathParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/alert-receivers/:receiver/subscriptions/:subscription` */ - alertReceiverSubscriptionRemove: (params: { - path: Api.AlertReceiverSubscriptionRemovePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /v1/alerts/:alertId/resend` */ - alertDeliveryResend: (params: { - path: Api.AlertDeliveryResendPathParams; - query: Api.AlertDeliveryResendQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/anti-affinity-groups` */ - antiAffinityGroupList: (params: { - query: Api.AntiAffinityGroupListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/anti-affinity-groups` */ - antiAffinityGroupCreate: (params: { - query: Api.AntiAffinityGroupCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/anti-affinity-groups/:antiAffinityGroup` */ - antiAffinityGroupView: (params: { - path: Api.AntiAffinityGroupViewPathParams; - query: Api.AntiAffinityGroupViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/anti-affinity-groups/:antiAffinityGroup` */ - antiAffinityGroupUpdate: (params: { - path: Api.AntiAffinityGroupUpdatePathParams; - query: Api.AntiAffinityGroupUpdateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/anti-affinity-groups/:antiAffinityGroup` */ - antiAffinityGroupDelete: (params: { - path: Api.AntiAffinityGroupDeletePathParams; - query: Api.AntiAffinityGroupDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/anti-affinity-groups/:antiAffinityGroup/members` */ - antiAffinityGroupMemberList: (params: { - path: Api.AntiAffinityGroupMemberListPathParams; - query: Api.AntiAffinityGroupMemberListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/anti-affinity-groups/:antiAffinityGroup/members/instance/:instance` */ - antiAffinityGroupMemberInstanceView: (params: { - path: Api.AntiAffinityGroupMemberInstanceViewPathParams; - query: Api.AntiAffinityGroupMemberInstanceViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/anti-affinity-groups/:antiAffinityGroup/members/instance/:instance` */ - antiAffinityGroupMemberInstanceAdd: (params: { - path: Api.AntiAffinityGroupMemberInstanceAddPathParams; - query: Api.AntiAffinityGroupMemberInstanceAddQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/anti-affinity-groups/:antiAffinityGroup/members/instance/:instance` */ - antiAffinityGroupMemberInstanceDelete: (params: { - path: Api.AntiAffinityGroupMemberInstanceDeletePathParams; - query: Api.AntiAffinityGroupMemberInstanceDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/auth-settings` */ - authSettingsView: (params: { - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/auth-settings` */ - authSettingsUpdate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/certificates` */ - certificateList: (params: { - query: Api.CertificateListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/certificates` */ - certificateCreate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/certificates/:certificate` */ - certificateView: (params: { - path: Api.CertificateViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/certificates/:certificate` */ - certificateDelete: (params: { - path: Api.CertificateDeletePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/disks` */ - diskList: (params: { - query: Api.DiskListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/disks` */ - diskCreate: (params: { - query: Api.DiskCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/disks/:disk` */ - diskView: (params: { - path: Api.DiskViewPathParams; - query: Api.DiskViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/disks/:disk` */ - diskDelete: (params: { - path: Api.DiskDeletePathParams; - query: Api.DiskDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /v1/disks/:disk/bulk-write` */ - diskBulkWriteImport: (params: { - path: Api.DiskBulkWriteImportPathParams; - query: Api.DiskBulkWriteImportQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /v1/disks/:disk/bulk-write-start` */ - diskBulkWriteImportStart: (params: { - path: Api.DiskBulkWriteImportStartPathParams; - query: Api.DiskBulkWriteImportStartQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /v1/disks/:disk/bulk-write-stop` */ - diskBulkWriteImportStop: (params: { - path: Api.DiskBulkWriteImportStopPathParams; - query: Api.DiskBulkWriteImportStopQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /v1/disks/:disk/finalize` */ - diskFinalizeImport: (params: { - path: Api.DiskFinalizeImportPathParams; - query: Api.DiskFinalizeImportQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/floating-ips` */ - floatingIpList: (params: { - query: Api.FloatingIpListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/floating-ips` */ - floatingIpCreate: (params: { - query: Api.FloatingIpCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/floating-ips/:floatingIp` */ - floatingIpView: (params: { - path: Api.FloatingIpViewPathParams; - query: Api.FloatingIpViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/floating-ips/:floatingIp` */ - floatingIpUpdate: (params: { - path: Api.FloatingIpUpdatePathParams; - query: Api.FloatingIpUpdateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/floating-ips/:floatingIp` */ - floatingIpDelete: (params: { - path: Api.FloatingIpDeletePathParams; - query: Api.FloatingIpDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /v1/floating-ips/:floatingIp/attach` */ - floatingIpAttach: (params: { - path: Api.FloatingIpAttachPathParams; - query: Api.FloatingIpAttachQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/floating-ips/:floatingIp/detach` */ - floatingIpDetach: (params: { - path: Api.FloatingIpDetachPathParams; - query: Api.FloatingIpDetachQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/groups` */ - groupList: (params: { - query: Api.GroupListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/groups/:groupId` */ - groupView: (params: { - path: Api.GroupViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/images` */ - imageList: (params: { - query: Api.ImageListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/images` */ - imageCreate: (params: { - query: Api.ImageCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/images/:image` */ - imageView: (params: { - path: Api.ImageViewPathParams; - query: Api.ImageViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/images/:image` */ - imageDelete: (params: { - path: Api.ImageDeletePathParams; - query: Api.ImageDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /v1/images/:image/demote` */ - imageDemote: (params: { - path: Api.ImageDemotePathParams; - query: Api.ImageDemoteQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/images/:image/promote` */ - imagePromote: (params: { - path: Api.ImagePromotePathParams; - query: Api.ImagePromoteQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/instances` */ - instanceList: (params: { - query: Api.InstanceListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/instances` */ - instanceCreate: (params: { - query: Api.InstanceCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/instances/:instance` */ - instanceView: (params: { - path: Api.InstanceViewPathParams; - query: Api.InstanceViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/instances/:instance` */ - instanceUpdate: (params: { - path: Api.InstanceUpdatePathParams; - query: Api.InstanceUpdateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/instances/:instance` */ - instanceDelete: (params: { - path: Api.InstanceDeletePathParams; - query: Api.InstanceDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/instances/:instance/affinity-groups` */ - instanceAffinityGroupList: (params: { - path: Api.InstanceAffinityGroupListPathParams; - query: Api.InstanceAffinityGroupListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/instances/:instance/anti-affinity-groups` */ - instanceAntiAffinityGroupList: (params: { - path: Api.InstanceAntiAffinityGroupListPathParams; - query: Api.InstanceAntiAffinityGroupListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/instances/:instance/disks` */ - instanceDiskList: (params: { - path: Api.InstanceDiskListPathParams; - query: Api.InstanceDiskListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/instances/:instance/disks/attach` */ - instanceDiskAttach: (params: { - path: Api.InstanceDiskAttachPathParams; - query: Api.InstanceDiskAttachQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/instances/:instance/disks/detach` */ - instanceDiskDetach: (params: { - path: Api.InstanceDiskDetachPathParams; - query: Api.InstanceDiskDetachQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/instances/:instance/external-ips` */ - instanceExternalIpList: (params: { - path: Api.InstanceExternalIpListPathParams; - query: Api.InstanceExternalIpListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/instances/:instance/external-ips/ephemeral` */ - instanceEphemeralIpAttach: (params: { - path: Api.InstanceEphemeralIpAttachPathParams; - query: Api.InstanceEphemeralIpAttachQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/instances/:instance/external-ips/ephemeral` */ - instanceEphemeralIpDetach: (params: { - path: Api.InstanceEphemeralIpDetachPathParams; - query: Api.InstanceEphemeralIpDetachQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /v1/instances/:instance/reboot` */ - instanceReboot: (params: { - path: Api.InstanceRebootPathParams; - query: Api.InstanceRebootQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/instances/:instance/serial-console` */ - instanceSerialConsole: (params: { - path: Api.InstanceSerialConsolePathParams; - query: Api.InstanceSerialConsoleQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/instances/:instance/serial-console/stream` */ - instanceSerialConsoleStream: (params: { - path: Api.InstanceSerialConsoleStreamPathParams; - query: Api.InstanceSerialConsoleStreamQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/instances/:instance/ssh-public-keys` */ - instanceSshPublicKeyList: (params: { - path: Api.InstanceSshPublicKeyListPathParams; - query: Api.InstanceSshPublicKeyListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/instances/:instance/start` */ - instanceStart: (params: { - path: Api.InstanceStartPathParams; - query: Api.InstanceStartQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/instances/:instance/stop` */ - instanceStop: (params: { - path: Api.InstanceStopPathParams; - query: Api.InstanceStopQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/internet-gateway-ip-addresses` */ - internetGatewayIpAddressList: (params: { - query: Api.InternetGatewayIpAddressListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/internet-gateway-ip-addresses` */ - internetGatewayIpAddressCreate: (params: { - query: Api.InternetGatewayIpAddressCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/internet-gateway-ip-addresses/:address` */ - internetGatewayIpAddressDelete: (params: { - path: Api.InternetGatewayIpAddressDeletePathParams; - query: Api.InternetGatewayIpAddressDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/internet-gateway-ip-pools` */ - internetGatewayIpPoolList: (params: { - query: Api.InternetGatewayIpPoolListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/internet-gateway-ip-pools` */ - internetGatewayIpPoolCreate: (params: { - query: Api.InternetGatewayIpPoolCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/internet-gateway-ip-pools/:pool` */ - internetGatewayIpPoolDelete: (params: { - path: Api.InternetGatewayIpPoolDeletePathParams; - query: Api.InternetGatewayIpPoolDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/internet-gateways` */ - internetGatewayList: (params: { - query: Api.InternetGatewayListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/internet-gateways` */ - internetGatewayCreate: (params: { - query: Api.InternetGatewayCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/internet-gateways/:gateway` */ - internetGatewayView: (params: { - path: Api.InternetGatewayViewPathParams; - query: Api.InternetGatewayViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/internet-gateways/:gateway` */ - internetGatewayDelete: (params: { - path: Api.InternetGatewayDeletePathParams; - query: Api.InternetGatewayDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/ip-pools` */ - projectIpPoolList: (params: { - query: Api.ProjectIpPoolListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/ip-pools/:pool` */ - projectIpPoolView: (params: { - path: Api.ProjectIpPoolViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/login/:siloName/local` */ - loginLocal: (params: { - path: Api.LoginLocalPathParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /v1/logout` */ - logout: (params: { - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/me` */ - currentUserView: (params: { - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/me/access-tokens` */ - currentUserAccessTokenList: (params: { - query: Api.CurrentUserAccessTokenListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/me/access-tokens/:tokenId` */ - currentUserAccessTokenDelete: (params: { - path: Api.CurrentUserAccessTokenDeletePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/me/groups` */ - currentUserGroups: (params: { - query: Api.CurrentUserGroupsQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/me/ssh-keys` */ - currentUserSshKeyList: (params: { - query: Api.CurrentUserSshKeyListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/me/ssh-keys` */ - currentUserSshKeyCreate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/me/ssh-keys/:sshKey` */ - currentUserSshKeyView: (params: { - path: Api.CurrentUserSshKeyViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/me/ssh-keys/:sshKey` */ - currentUserSshKeyDelete: (params: { - path: Api.CurrentUserSshKeyDeletePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/metrics/:metricName` */ - siloMetric: (params: { - path: Api.SiloMetricPathParams; - query: Api.SiloMetricQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/network-interfaces` */ - instanceNetworkInterfaceList: (params: { - query: Api.InstanceNetworkInterfaceListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/network-interfaces` */ - instanceNetworkInterfaceCreate: (params: { - query: Api.InstanceNetworkInterfaceCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/network-interfaces/:interface` */ - instanceNetworkInterfaceView: (params: { - path: Api.InstanceNetworkInterfaceViewPathParams; - query: Api.InstanceNetworkInterfaceViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/network-interfaces/:interface` */ - instanceNetworkInterfaceUpdate: (params: { - path: Api.InstanceNetworkInterfaceUpdatePathParams; - query: Api.InstanceNetworkInterfaceUpdateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/network-interfaces/:interface` */ - instanceNetworkInterfaceDelete: (params: { - path: Api.InstanceNetworkInterfaceDeletePathParams; - query: Api.InstanceNetworkInterfaceDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/ping` */ - ping: (params: { - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/policy` */ - policyView: (params: { - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/policy` */ - policyUpdate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/projects` */ - projectList: (params: { - query: Api.ProjectListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/projects` */ - projectCreate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/projects/:project` */ - projectView: (params: { - path: Api.ProjectViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/projects/:project` */ - projectUpdate: (params: { - path: Api.ProjectUpdatePathParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/projects/:project` */ - projectDelete: (params: { - path: Api.ProjectDeletePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/projects/:project/policy` */ - projectPolicyView: (params: { - path: Api.ProjectPolicyViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/projects/:project/policy` */ - projectPolicyUpdate: (params: { - path: Api.ProjectPolicyUpdatePathParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/snapshots` */ - snapshotList: (params: { - query: Api.SnapshotListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/snapshots` */ - snapshotCreate: (params: { - query: Api.SnapshotCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/snapshots/:snapshot` */ - snapshotView: (params: { - path: Api.SnapshotViewPathParams; - query: Api.SnapshotViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/snapshots/:snapshot` */ - snapshotDelete: (params: { - path: Api.SnapshotDeletePathParams; - query: Api.SnapshotDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/audit-log` */ - auditLogList: (params: { - query: Api.AuditLogListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/hardware/disks` */ - physicalDiskList: (params: { - query: Api.PhysicalDiskListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/hardware/disks/:diskId` */ - physicalDiskView: (params: { - path: Api.PhysicalDiskViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/hardware/rack-switch-port/:rackId/:switchLocation/:port/lldp/neighbors` */ - networkingSwitchPortLldpNeighbors: (params: { - path: Api.NetworkingSwitchPortLldpNeighborsPathParams; - query: Api.NetworkingSwitchPortLldpNeighborsQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/hardware/racks` */ - rackList: (params: { - query: Api.RackListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/hardware/racks/:rackId` */ - rackView: (params: { - path: Api.RackViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/hardware/sleds` */ - sledList: (params: { - query: Api.SledListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/hardware/sleds` */ - sledAdd: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/hardware/sleds/:sledId` */ - sledView: (params: { - path: Api.SledViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/hardware/sleds/:sledId/disks` */ - sledPhysicalDiskList: (params: { - path: Api.SledPhysicalDiskListPathParams; - query: Api.SledPhysicalDiskListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/hardware/sleds/:sledId/instances` */ - sledInstanceList: (params: { - path: Api.SledInstanceListPathParams; - query: Api.SledInstanceListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/system/hardware/sleds/:sledId/provision-policy` */ - sledSetProvisionPolicy: (params: { - path: Api.SledSetProvisionPolicyPathParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/hardware/sleds-uninitialized` */ - sledListUninitialized: (params: { - query: Api.SledListUninitializedQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/hardware/switch-port` */ - networkingSwitchPortList: (params: { - query: Api.NetworkingSwitchPortListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/hardware/switch-port/:port/lldp/config` */ - networkingSwitchPortLldpConfigView: (params: { - path: Api.NetworkingSwitchPortLldpConfigViewPathParams; - query: Api.NetworkingSwitchPortLldpConfigViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/hardware/switch-port/:port/lldp/config` */ - networkingSwitchPortLldpConfigUpdate: (params: { - path: Api.NetworkingSwitchPortLldpConfigUpdatePathParams; - query: Api.NetworkingSwitchPortLldpConfigUpdateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /v1/system/hardware/switch-port/:port/settings` */ - networkingSwitchPortApplySettings: (params: { - path: Api.NetworkingSwitchPortApplySettingsPathParams; - query: Api.NetworkingSwitchPortApplySettingsQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable; - /** `DELETE /v1/system/hardware/switch-port/:port/settings` */ - networkingSwitchPortClearSettings: (params: { - path: Api.NetworkingSwitchPortClearSettingsPathParams; - query: Api.NetworkingSwitchPortClearSettingsQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/hardware/switch-port/:port/status` */ - networkingSwitchPortStatus: (params: { - path: Api.NetworkingSwitchPortStatusPathParams; - query: Api.NetworkingSwitchPortStatusQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/hardware/switches` */ - switchList: (params: { - query: Api.SwitchListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/hardware/switches/:switchId` */ - switchView: (params: { - path: Api.SwitchViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/identity-providers` */ - siloIdentityProviderList: (params: { - query: Api.SiloIdentityProviderListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/identity-providers/local/users` */ - localIdpUserCreate: (params: { - query: Api.LocalIdpUserCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/system/identity-providers/local/users/:userId` */ - localIdpUserDelete: (params: { - path: Api.LocalIdpUserDeletePathParams; - query: Api.LocalIdpUserDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /v1/system/identity-providers/local/users/:userId/set-password` */ - localIdpUserSetPassword: (params: { - path: Api.LocalIdpUserSetPasswordPathParams; - query: Api.LocalIdpUserSetPasswordQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /v1/system/identity-providers/saml` */ - samlIdentityProviderCreate: (params: { - query: Api.SamlIdentityProviderCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/identity-providers/saml/:provider` */ - samlIdentityProviderView: (params: { - path: Api.SamlIdentityProviderViewPathParams; - query: Api.SamlIdentityProviderViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/ip-pools` */ - ipPoolList: (params: { - query: Api.IpPoolListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/ip-pools` */ - ipPoolCreate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/ip-pools/:pool` */ - ipPoolView: (params: { - path: Api.IpPoolViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/system/ip-pools/:pool` */ - ipPoolUpdate: (params: { - path: Api.IpPoolUpdatePathParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/system/ip-pools/:pool` */ - ipPoolDelete: (params: { - path: Api.IpPoolDeletePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/ip-pools/:pool/ranges` */ - ipPoolRangeList: (params: { - path: Api.IpPoolRangeListPathParams; - query: Api.IpPoolRangeListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/ip-pools/:pool/ranges/add` */ - ipPoolRangeAdd: (params: { - path: Api.IpPoolRangeAddPathParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/ip-pools/:pool/ranges/remove` */ - ipPoolRangeRemove: (params: { - path: Api.IpPoolRangeRemovePathParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/ip-pools/:pool/silos` */ - ipPoolSiloList: (params: { - path: Api.IpPoolSiloListPathParams; - query: Api.IpPoolSiloListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/ip-pools/:pool/silos` */ - ipPoolSiloLink: (params: { - path: Api.IpPoolSiloLinkPathParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/system/ip-pools/:pool/silos/:silo` */ - ipPoolSiloUpdate: (params: { - path: Api.IpPoolSiloUpdatePathParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/system/ip-pools/:pool/silos/:silo` */ - ipPoolSiloUnlink: (params: { - path: Api.IpPoolSiloUnlinkPathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/ip-pools/:pool/utilization` */ - ipPoolUtilizationView: (params: { - path: Api.IpPoolUtilizationViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/ip-pools-service` */ - ipPoolServiceView: (params: { - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/ip-pools-service/ranges` */ - ipPoolServiceRangeList: (params: { - query: Api.IpPoolServiceRangeListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/ip-pools-service/ranges/add` */ - ipPoolServiceRangeAdd: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/ip-pools-service/ranges/remove` */ - ipPoolServiceRangeRemove: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/metrics/:metricName` */ - systemMetric: (params: { - path: Api.SystemMetricPathParams; - query: Api.SystemMetricQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/networking/address-lot` */ - networkingAddressLotList: (params: { - query: Api.NetworkingAddressLotListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/networking/address-lot` */ - networkingAddressLotCreate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/system/networking/address-lot/:addressLot` */ - networkingAddressLotDelete: (params: { - path: Api.NetworkingAddressLotDeletePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/networking/address-lot/:addressLot/blocks` */ - networkingAddressLotBlockList: (params: { - path: Api.NetworkingAddressLotBlockListPathParams; - query: Api.NetworkingAddressLotBlockListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/networking/allow-list` */ - networkingAllowListView: (params: { - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/system/networking/allow-list` */ - networkingAllowListUpdate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/networking/bfd-disable` */ - networkingBfdDisable: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /v1/system/networking/bfd-enable` */ - networkingBfdEnable: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/networking/bfd-status` */ - networkingBfdStatus: (params: { - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/networking/bgp` */ - networkingBgpConfigList: (params: { - query: Api.NetworkingBgpConfigListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/networking/bgp` */ - networkingBgpConfigCreate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/system/networking/bgp` */ - networkingBgpConfigDelete: (params: { - query: Api.NetworkingBgpConfigDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/networking/bgp-announce-set` */ - networkingBgpAnnounceSetList: (params: { - query: Api.NetworkingBgpAnnounceSetListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/system/networking/bgp-announce-set` */ - networkingBgpAnnounceSetUpdate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/system/networking/bgp-announce-set/:announceSet` */ - networkingBgpAnnounceSetDelete: (params: { - path: Api.NetworkingBgpAnnounceSetDeletePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/networking/bgp-announce-set/:announceSet/announcement` */ - networkingBgpAnnouncementList: (params: { - path: Api.NetworkingBgpAnnouncementListPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/networking/bgp-exported` */ - networkingBgpExported: (params: { - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/networking/bgp-message-history` */ - networkingBgpMessageHistory: (params: { - query: Api.NetworkingBgpMessageHistoryQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/networking/bgp-routes-ipv4` */ - networkingBgpImportedRoutesIpv4: (params: { - query: Api.NetworkingBgpImportedRoutesIpv4QueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/networking/bgp-status` */ - networkingBgpStatus: (params: { - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/networking/inbound-icmp` */ - networkingInboundIcmpView: (params: { - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/system/networking/inbound-icmp` */ - networkingInboundIcmpUpdate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/networking/loopback-address` */ - networkingLoopbackAddressList: (params: { - query: Api.NetworkingLoopbackAddressListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/networking/loopback-address` */ - networkingLoopbackAddressCreate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/system/networking/loopback-address/:rackId/:switchLocation/:address/:subnetMask` */ - networkingLoopbackAddressDelete: (params: { - path: Api.NetworkingLoopbackAddressDeletePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/networking/switch-port-settings` */ - networkingSwitchPortSettingsList: (params: { - query: Api.NetworkingSwitchPortSettingsListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/networking/switch-port-settings` */ - networkingSwitchPortSettingsCreate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/system/networking/switch-port-settings` */ - networkingSwitchPortSettingsDelete: (params: { - query: Api.NetworkingSwitchPortSettingsDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/networking/switch-port-settings/:port` */ - networkingSwitchPortSettingsView: (params: { - path: Api.NetworkingSwitchPortSettingsViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/policy` */ - systemPolicyView: (params: { - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/system/policy` */ - systemPolicyUpdate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/silo-quotas` */ - systemQuotasList: (params: { - query: Api.SystemQuotasListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/silos` */ - siloList: (params: { - query: Api.SiloListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/silos` */ - siloCreate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/silos/:silo` */ - siloView: (params: { - path: Api.SiloViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/system/silos/:silo` */ - siloDelete: (params: { - path: Api.SiloDeletePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/silos/:silo/ip-pools` */ - siloIpPoolList: (params: { - path: Api.SiloIpPoolListPathParams; - query: Api.SiloIpPoolListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/silos/:silo/policy` */ - siloPolicyView: (params: { - path: Api.SiloPolicyViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/system/silos/:silo/policy` */ - siloPolicyUpdate: (params: { - path: Api.SiloPolicyUpdatePathParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/silos/:silo/quotas` */ - siloQuotasView: (params: { - path: Api.SiloQuotasViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/system/silos/:silo/quotas` */ - siloQuotasUpdate: (params: { - path: Api.SiloQuotasUpdatePathParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/timeseries/query` */ - systemTimeseriesQuery: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/timeseries/schemas` */ - systemTimeseriesSchemaList: (params: { - query: Api.SystemTimeseriesSchemaListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/system/update/repository` */ - systemUpdatePutRepository: (params: { - query: Api.SystemUpdatePutRepositoryQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/update/repository/:systemVersion` */ - systemUpdateGetRepository: (params: { - path: Api.SystemUpdateGetRepositoryPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/update/target-release` */ - targetReleaseView: (params: { - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/system/update/target-release` */ - targetReleaseUpdate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/update/trust-roots` */ - systemUpdateTrustRootList: (params: { - query: Api.SystemUpdateTrustRootListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/system/update/trust-roots` */ - systemUpdateTrustRootCreate: (params: { - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/update/trust-roots/:trustRootId` */ - systemUpdateTrustRootView: (params: { - path: Api.SystemUpdateTrustRootViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/system/update/trust-roots/:trustRootId` */ - systemUpdateTrustRootDelete: (params: { - path: Api.SystemUpdateTrustRootDeletePathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/system/users` */ - siloUserList: (params: { - query: Api.SiloUserListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/users/:userId` */ - siloUserView: (params: { - path: Api.SiloUserViewPathParams; - query: Api.SiloUserViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/users-builtin` */ - userBuiltinList: (params: { - query: Api.UserBuiltinListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/users-builtin/:user` */ - userBuiltinView: (params: { - path: Api.UserBuiltinViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/utilization/silos` */ - siloUtilizationList: (params: { - query: Api.SiloUtilizationListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/system/utilization/silos/:silo` */ - siloUtilizationView: (params: { - path: Api.SiloUtilizationViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/timeseries/query` */ - timeseriesQuery: (params: { - query: Api.TimeseriesQueryQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/users` */ - userList: (params: { - query: Api.UserListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/users/:userId` */ - userView: (params: { - path: Api.UserViewPathParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/users/:userId/access-tokens` */ - userTokenList: (params: { - path: Api.UserTokenListPathParams; - query: Api.UserTokenListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/users/:userId/logout` */ - userLogout: (params: { - path: Api.UserLogoutPathParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/users/:userId/sessions` */ - userSessionList: (params: { - path: Api.UserSessionListPathParams; - query: Api.UserSessionListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/utilization` */ - utilizationView: (params: { - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/vpc-firewall-rules` */ - vpcFirewallRulesView: (params: { - query: Api.VpcFirewallRulesViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/vpc-firewall-rules` */ - vpcFirewallRulesUpdate: (params: { - query: Api.VpcFirewallRulesUpdateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/vpc-router-routes` */ - vpcRouterRouteList: (params: { - query: Api.VpcRouterRouteListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/vpc-router-routes` */ - vpcRouterRouteCreate: (params: { - query: Api.VpcRouterRouteCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/vpc-router-routes/:route` */ - vpcRouterRouteView: (params: { - path: Api.VpcRouterRouteViewPathParams; - query: Api.VpcRouterRouteViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/vpc-router-routes/:route` */ - vpcRouterRouteUpdate: (params: { - path: Api.VpcRouterRouteUpdatePathParams; - query: Api.VpcRouterRouteUpdateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/vpc-router-routes/:route` */ - vpcRouterRouteDelete: (params: { - path: Api.VpcRouterRouteDeletePathParams; - query: Api.VpcRouterRouteDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/vpc-routers` */ - vpcRouterList: (params: { - query: Api.VpcRouterListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/vpc-routers` */ - vpcRouterCreate: (params: { - query: Api.VpcRouterCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/vpc-routers/:router` */ - vpcRouterView: (params: { - path: Api.VpcRouterViewPathParams; - query: Api.VpcRouterViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/vpc-routers/:router` */ - vpcRouterUpdate: (params: { - path: Api.VpcRouterUpdatePathParams; - query: Api.VpcRouterUpdateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/vpc-routers/:router` */ - vpcRouterDelete: (params: { - path: Api.VpcRouterDeletePathParams; - query: Api.VpcRouterDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/vpc-subnets` */ - vpcSubnetList: (params: { - query: Api.VpcSubnetListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/vpc-subnets` */ - vpcSubnetCreate: (params: { - query: Api.VpcSubnetCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/vpc-subnets/:subnet` */ - vpcSubnetView: (params: { - path: Api.VpcSubnetViewPathParams; - query: Api.VpcSubnetViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/vpc-subnets/:subnet` */ - vpcSubnetUpdate: (params: { - path: Api.VpcSubnetUpdatePathParams; - query: Api.VpcSubnetUpdateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/vpc-subnets/:subnet` */ - vpcSubnetDelete: (params: { - path: Api.VpcSubnetDeletePathParams; - query: Api.VpcSubnetDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/vpc-subnets/:subnet/network-interfaces` */ - vpcSubnetListNetworkInterfaces: (params: { - path: Api.VpcSubnetListNetworkInterfacesPathParams; - query: Api.VpcSubnetListNetworkInterfacesQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/vpcs` */ - vpcList: (params: { - query: Api.VpcListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/vpcs` */ - vpcCreate: (params: { - query: Api.VpcCreateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `GET /v1/vpcs/:vpc` */ - vpcView: (params: { - path: Api.VpcViewPathParams; - query: Api.VpcViewQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/vpcs/:vpc` */ - vpcUpdate: (params: { - path: Api.VpcUpdatePathParams; - query: Api.VpcUpdateQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/vpcs/:vpc` */ - vpcDelete: (params: { - path: Api.VpcDeletePathParams; - query: Api.VpcDeleteQueryParams; - req: Request; - cookies: Record; - }) => Promisable; - /** `POST /v1/webhook-receivers` */ - webhookReceiverCreate: (params: { - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `PUT /v1/webhook-receivers/:receiver` */ - webhookReceiverUpdate: (params: { - path: Api.WebhookReceiverUpdatePathParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable; - /** `GET /v1/webhook-secrets` */ - webhookSecretsList: (params: { - query: Api.WebhookSecretsListQueryParams; - req: Request; - cookies: Record; - }) => Promisable>; - /** `POST /v1/webhook-secrets` */ - webhookSecretsAdd: (params: { - query: Api.WebhookSecretsAddQueryParams; - body: Json; - req: Request; - cookies: Record; - }) => Promisable>; - /** `DELETE /v1/webhook-secrets/:secretId` */ - webhookSecretsDelete: (params: { - path: Api.WebhookSecretsDeletePathParams; - req: Request; - cookies: Record; - }) => Promisable; -} - -function validateParams( - schema: S, - req: Request, - pathParams: PathParams, -) { - const rawParams = new URLSearchParams(new URL(req.url).search); - const params: [string, unknown][] = []; - - // Ensure numeric params like `limit` are parsed as numbers - for (const [name, value] of rawParams) { - params.push([name, isNaN(Number(value)) ? value : Number(value)]); - } - - const result = schema.safeParse({ - path: pathParams, - query: Object.fromEntries(params), - }); - - if (result.success) { - return { params: result.data }; - } - - // if any of the errors come from path params, just 404 — the resource cannot - // exist if there's no valid name - const status = result.error.issues.some((e) => e.path[0] === "path") - ? 404 - : 400; - const error_code = status === 404 ? "NotFound" : "InvalidRequest"; - const message = "Zod error for params: " + JSON.stringify(result.error); - return { paramsErr: json({ error_code, message }, { status }) }; -} - -const handler = - ( - handler: MSWHandlers[keyof MSWHandlers], - // eslint-disable-next-line @typescript-eslint/no-explicit-any - paramSchema: ZodType | null, - bodySchema: ZodType | null, - ) => - async ({ - request: req, - params: pathParams, - cookies, - }: { - request: Request; - params: PathParams; - cookies: Record; - }) => { - const { params, paramsErr } = paramSchema - ? validateParams(paramSchema, req, pathParams) - : { params: {}, paramsErr: undefined }; - if (paramsErr) return paramsErr; - - const { path, query } = params; - - let body = undefined; - if (bodySchema) { - const rawBody = await req.json(); - const result = bodySchema.transform(snakeify).safeParse(rawBody); - if (!result.success) { - const message = "Zod error for body: " + JSON.stringify(result.error); - return json({ error_code: "InvalidRequest", message }, { status: 400 }); - } - body = result.data; - } - - try { - // TypeScript can't narrow the handler down because there's not an explicit relationship between the schema - // being present and the shape of the handler API. The type of this function could be resolved such that the - // relevant schema is required if and only if the handler has a type that matches the inferred schema - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const result = await (handler as any).apply(null, [ - { path, query, body, req, cookies }, - ]); - if (typeof result === "number") { - return new HttpResponse(null, { status: result }); - } - if (result instanceof Response) { - return result; - } - return json(result); - } catch (thrown) { - if (typeof thrown === "number") { - return new HttpResponse(null, { status: thrown }); - } - if (typeof thrown === "string") { - return json({ message: thrown }, { status: 400 }); - } - if (thrown instanceof Response) { - return thrown; - } - - // if it's not one of those, then we don't know what to do with it - console.error("Unexpected mock error", thrown); - if (typeof thrown === "function") { - console.error( - "It looks like you've accidentally thrown an error constructor function from a mock handler without calling it!", - ); - } - // rethrow so everything breaks because this isn't supposed to happen - throw thrown; - } - }; - -export function makeHandlers(handlers: MSWHandlers): HttpHandler[] { - return [ - http.post( - "/device/auth", - handler(handlers["deviceAuthRequest"], null, null), - ), - http.post( - "/device/confirm", - handler(handlers["deviceAuthConfirm"], null, schema.DeviceAuthVerify), - ), - http.post( - "/device/token", - handler(handlers["deviceAccessToken"], null, null), - ), - http.get( - "/experimental/v1/probes", - handler(handlers["probeList"], schema.ProbeListParams, null), - ), - http.post( - "/experimental/v1/probes", - handler( - handlers["probeCreate"], - schema.ProbeCreateParams, - schema.ProbeCreate, - ), - ), - http.get( - "/experimental/v1/probes/:probe", - handler(handlers["probeView"], schema.ProbeViewParams, null), - ), - http.delete( - "/experimental/v1/probes/:probe", - handler(handlers["probeDelete"], schema.ProbeDeleteParams, null), - ), - http.get( - "/experimental/v1/system/support-bundles", - handler( - handlers["supportBundleList"], - schema.SupportBundleListParams, - null, - ), - ), - http.post( - "/experimental/v1/system/support-bundles", - handler( - handlers["supportBundleCreate"], - null, - schema.SupportBundleCreate, - ), - ), - http.get( - "/experimental/v1/system/support-bundles/:bundleId", - handler( - handlers["supportBundleView"], - schema.SupportBundleViewParams, - null, - ), - ), - http.put( - "/experimental/v1/system/support-bundles/:bundleId", - handler( - handlers["supportBundleUpdate"], - schema.SupportBundleUpdateParams, - schema.SupportBundleUpdate, - ), - ), - http.delete( - "/experimental/v1/system/support-bundles/:bundleId", - handler( - handlers["supportBundleDelete"], - schema.SupportBundleDeleteParams, - null, - ), - ), - http.get( - "/experimental/v1/system/support-bundles/:bundleId/download", - handler( - handlers["supportBundleDownload"], - schema.SupportBundleDownloadParams, - null, - ), - ), - http.head( - "/experimental/v1/system/support-bundles/:bundleId/download", - handler( - handlers["supportBundleHead"], - schema.SupportBundleHeadParams, - null, - ), - ), - http.get( - "/experimental/v1/system/support-bundles/:bundleId/download/:file", - handler( - handlers["supportBundleDownloadFile"], - schema.SupportBundleDownloadFileParams, - null, - ), - ), - http.head( - "/experimental/v1/system/support-bundles/:bundleId/download/:file", - handler( - handlers["supportBundleHeadFile"], - schema.SupportBundleHeadFileParams, - null, - ), - ), - http.get( - "/experimental/v1/system/support-bundles/:bundleId/index", - handler( - handlers["supportBundleIndex"], - schema.SupportBundleIndexParams, - null, - ), - ), - http.post( - "/login/:siloName/saml/:providerName", - handler(handlers["loginSaml"], schema.LoginSamlParams, null), - ), - http.get( - "/v1/affinity-groups", - handler( - handlers["affinityGroupList"], - schema.AffinityGroupListParams, - null, - ), - ), - http.post( - "/v1/affinity-groups", - handler( - handlers["affinityGroupCreate"], - schema.AffinityGroupCreateParams, - schema.AffinityGroupCreate, - ), - ), - http.get( - "/v1/affinity-groups/:affinityGroup", - handler( - handlers["affinityGroupView"], - schema.AffinityGroupViewParams, - null, - ), - ), - http.put( - "/v1/affinity-groups/:affinityGroup", - handler( - handlers["affinityGroupUpdate"], - schema.AffinityGroupUpdateParams, - schema.AffinityGroupUpdate, - ), - ), - http.delete( - "/v1/affinity-groups/:affinityGroup", - handler( - handlers["affinityGroupDelete"], - schema.AffinityGroupDeleteParams, - null, - ), - ), - http.get( - "/v1/affinity-groups/:affinityGroup/members", - handler( - handlers["affinityGroupMemberList"], - schema.AffinityGroupMemberListParams, - null, - ), - ), - http.get( - "/v1/affinity-groups/:affinityGroup/members/instance/:instance", - handler( - handlers["affinityGroupMemberInstanceView"], - schema.AffinityGroupMemberInstanceViewParams, - null, - ), - ), - http.post( - "/v1/affinity-groups/:affinityGroup/members/instance/:instance", - handler( - handlers["affinityGroupMemberInstanceAdd"], - schema.AffinityGroupMemberInstanceAddParams, - null, - ), - ), - http.delete( - "/v1/affinity-groups/:affinityGroup/members/instance/:instance", - handler( - handlers["affinityGroupMemberInstanceDelete"], - schema.AffinityGroupMemberInstanceDeleteParams, - null, - ), - ), - http.get( - "/v1/alert-classes", - handler(handlers["alertClassList"], schema.AlertClassListParams, null), - ), - http.get( - "/v1/alert-receivers", - handler( - handlers["alertReceiverList"], - schema.AlertReceiverListParams, - null, - ), - ), - http.get( - "/v1/alert-receivers/:receiver", - handler( - handlers["alertReceiverView"], - schema.AlertReceiverViewParams, - null, - ), - ), - http.delete( - "/v1/alert-receivers/:receiver", - handler( - handlers["alertReceiverDelete"], - schema.AlertReceiverDeleteParams, - null, - ), - ), - http.get( - "/v1/alert-receivers/:receiver/deliveries", - handler( - handlers["alertDeliveryList"], - schema.AlertDeliveryListParams, - null, - ), - ), - http.post( - "/v1/alert-receivers/:receiver/probe", - handler( - handlers["alertReceiverProbe"], - schema.AlertReceiverProbeParams, - null, - ), - ), - http.post( - "/v1/alert-receivers/:receiver/subscriptions", - handler( - handlers["alertReceiverSubscriptionAdd"], - schema.AlertReceiverSubscriptionAddParams, - schema.AlertSubscriptionCreate, - ), - ), - http.delete( - "/v1/alert-receivers/:receiver/subscriptions/:subscription", - handler( - handlers["alertReceiverSubscriptionRemove"], - schema.AlertReceiverSubscriptionRemoveParams, - null, - ), - ), - http.post( - "/v1/alerts/:alertId/resend", - handler( - handlers["alertDeliveryResend"], - schema.AlertDeliveryResendParams, - null, - ), - ), - http.get( - "/v1/anti-affinity-groups", - handler( - handlers["antiAffinityGroupList"], - schema.AntiAffinityGroupListParams, - null, - ), - ), - http.post( - "/v1/anti-affinity-groups", - handler( - handlers["antiAffinityGroupCreate"], - schema.AntiAffinityGroupCreateParams, - schema.AntiAffinityGroupCreate, - ), - ), - http.get( - "/v1/anti-affinity-groups/:antiAffinityGroup", - handler( - handlers["antiAffinityGroupView"], - schema.AntiAffinityGroupViewParams, - null, - ), - ), - http.put( - "/v1/anti-affinity-groups/:antiAffinityGroup", - handler( - handlers["antiAffinityGroupUpdate"], - schema.AntiAffinityGroupUpdateParams, - schema.AntiAffinityGroupUpdate, - ), - ), - http.delete( - "/v1/anti-affinity-groups/:antiAffinityGroup", - handler( - handlers["antiAffinityGroupDelete"], - schema.AntiAffinityGroupDeleteParams, - null, - ), - ), - http.get( - "/v1/anti-affinity-groups/:antiAffinityGroup/members", - handler( - handlers["antiAffinityGroupMemberList"], - schema.AntiAffinityGroupMemberListParams, - null, - ), - ), - http.get( - "/v1/anti-affinity-groups/:antiAffinityGroup/members/instance/:instance", - handler( - handlers["antiAffinityGroupMemberInstanceView"], - schema.AntiAffinityGroupMemberInstanceViewParams, - null, - ), - ), - http.post( - "/v1/anti-affinity-groups/:antiAffinityGroup/members/instance/:instance", - handler( - handlers["antiAffinityGroupMemberInstanceAdd"], - schema.AntiAffinityGroupMemberInstanceAddParams, - null, - ), - ), - http.delete( - "/v1/anti-affinity-groups/:antiAffinityGroup/members/instance/:instance", - handler( - handlers["antiAffinityGroupMemberInstanceDelete"], - schema.AntiAffinityGroupMemberInstanceDeleteParams, - null, - ), - ), - http.get( - "/v1/auth-settings", - handler(handlers["authSettingsView"], null, null), - ), - http.put( - "/v1/auth-settings", - handler( - handlers["authSettingsUpdate"], - null, - schema.SiloAuthSettingsUpdate, - ), - ), - http.get( - "/v1/certificates", - handler(handlers["certificateList"], schema.CertificateListParams, null), - ), - http.post( - "/v1/certificates", - handler(handlers["certificateCreate"], null, schema.CertificateCreate), - ), - http.get( - "/v1/certificates/:certificate", - handler(handlers["certificateView"], schema.CertificateViewParams, null), - ), - http.delete( - "/v1/certificates/:certificate", - handler( - handlers["certificateDelete"], - schema.CertificateDeleteParams, - null, - ), - ), - http.get( - "/v1/disks", - handler(handlers["diskList"], schema.DiskListParams, null), - ), - http.post( - "/v1/disks", - handler( - handlers["diskCreate"], - schema.DiskCreateParams, - schema.DiskCreate, - ), - ), - http.get( - "/v1/disks/:disk", - handler(handlers["diskView"], schema.DiskViewParams, null), - ), - http.delete( - "/v1/disks/:disk", - handler(handlers["diskDelete"], schema.DiskDeleteParams, null), - ), - http.post( - "/v1/disks/:disk/bulk-write", - handler( - handlers["diskBulkWriteImport"], - schema.DiskBulkWriteImportParams, - schema.ImportBlocksBulkWrite, - ), - ), - http.post( - "/v1/disks/:disk/bulk-write-start", - handler( - handlers["diskBulkWriteImportStart"], - schema.DiskBulkWriteImportStartParams, - null, - ), - ), - http.post( - "/v1/disks/:disk/bulk-write-stop", - handler( - handlers["diskBulkWriteImportStop"], - schema.DiskBulkWriteImportStopParams, - null, - ), - ), - http.post( - "/v1/disks/:disk/finalize", - handler( - handlers["diskFinalizeImport"], - schema.DiskFinalizeImportParams, - schema.FinalizeDisk, - ), - ), - http.get( - "/v1/floating-ips", - handler(handlers["floatingIpList"], schema.FloatingIpListParams, null), - ), - http.post( - "/v1/floating-ips", - handler( - handlers["floatingIpCreate"], - schema.FloatingIpCreateParams, - schema.FloatingIpCreate, - ), - ), - http.get( - "/v1/floating-ips/:floatingIp", - handler(handlers["floatingIpView"], schema.FloatingIpViewParams, null), - ), - http.put( - "/v1/floating-ips/:floatingIp", - handler( - handlers["floatingIpUpdate"], - schema.FloatingIpUpdateParams, - schema.FloatingIpUpdate, - ), - ), - http.delete( - "/v1/floating-ips/:floatingIp", - handler( - handlers["floatingIpDelete"], - schema.FloatingIpDeleteParams, - null, - ), - ), - http.post( - "/v1/floating-ips/:floatingIp/attach", - handler( - handlers["floatingIpAttach"], - schema.FloatingIpAttachParams, - schema.FloatingIpAttach, - ), - ), - http.post( - "/v1/floating-ips/:floatingIp/detach", - handler( - handlers["floatingIpDetach"], - schema.FloatingIpDetachParams, - null, - ), - ), - http.get( - "/v1/groups", - handler(handlers["groupList"], schema.GroupListParams, null), - ), - http.get( - "/v1/groups/:groupId", - handler(handlers["groupView"], schema.GroupViewParams, null), - ), - http.get( - "/v1/images", - handler(handlers["imageList"], schema.ImageListParams, null), - ), - http.post( - "/v1/images", - handler( - handlers["imageCreate"], - schema.ImageCreateParams, - schema.ImageCreate, - ), - ), - http.get( - "/v1/images/:image", - handler(handlers["imageView"], schema.ImageViewParams, null), - ), - http.delete( - "/v1/images/:image", - handler(handlers["imageDelete"], schema.ImageDeleteParams, null), - ), - http.post( - "/v1/images/:image/demote", - handler(handlers["imageDemote"], schema.ImageDemoteParams, null), - ), - http.post( - "/v1/images/:image/promote", - handler(handlers["imagePromote"], schema.ImagePromoteParams, null), - ), - http.get( - "/v1/instances", - handler(handlers["instanceList"], schema.InstanceListParams, null), - ), - http.post( - "/v1/instances", - handler( - handlers["instanceCreate"], - schema.InstanceCreateParams, - schema.InstanceCreate, - ), - ), - http.get( - "/v1/instances/:instance", - handler(handlers["instanceView"], schema.InstanceViewParams, null), - ), - http.put( - "/v1/instances/:instance", - handler( - handlers["instanceUpdate"], - schema.InstanceUpdateParams, - schema.InstanceUpdate, - ), - ), - http.delete( - "/v1/instances/:instance", - handler(handlers["instanceDelete"], schema.InstanceDeleteParams, null), - ), - http.get( - "/v1/instances/:instance/affinity-groups", - handler( - handlers["instanceAffinityGroupList"], - schema.InstanceAffinityGroupListParams, - null, - ), - ), - http.get( - "/v1/instances/:instance/anti-affinity-groups", - handler( - handlers["instanceAntiAffinityGroupList"], - schema.InstanceAntiAffinityGroupListParams, - null, - ), - ), - http.get( - "/v1/instances/:instance/disks", - handler( - handlers["instanceDiskList"], - schema.InstanceDiskListParams, - null, - ), - ), - http.post( - "/v1/instances/:instance/disks/attach", - handler( - handlers["instanceDiskAttach"], - schema.InstanceDiskAttachParams, - schema.DiskPath, - ), - ), - http.post( - "/v1/instances/:instance/disks/detach", - handler( - handlers["instanceDiskDetach"], - schema.InstanceDiskDetachParams, - schema.DiskPath, - ), - ), - http.get( - "/v1/instances/:instance/external-ips", - handler( - handlers["instanceExternalIpList"], - schema.InstanceExternalIpListParams, - null, - ), - ), - http.post( - "/v1/instances/:instance/external-ips/ephemeral", - handler( - handlers["instanceEphemeralIpAttach"], - schema.InstanceEphemeralIpAttachParams, - schema.EphemeralIpCreate, - ), - ), - http.delete( - "/v1/instances/:instance/external-ips/ephemeral", - handler( - handlers["instanceEphemeralIpDetach"], - schema.InstanceEphemeralIpDetachParams, - null, - ), - ), - http.post( - "/v1/instances/:instance/reboot", - handler(handlers["instanceReboot"], schema.InstanceRebootParams, null), - ), - http.get( - "/v1/instances/:instance/serial-console", - handler( - handlers["instanceSerialConsole"], - schema.InstanceSerialConsoleParams, - null, - ), - ), - http.get( - "/v1/instances/:instance/serial-console/stream", - handler( - handlers["instanceSerialConsoleStream"], - schema.InstanceSerialConsoleStreamParams, - null, - ), - ), - http.get( - "/v1/instances/:instance/ssh-public-keys", - handler( - handlers["instanceSshPublicKeyList"], - schema.InstanceSshPublicKeyListParams, - null, - ), - ), - http.post( - "/v1/instances/:instance/start", - handler(handlers["instanceStart"], schema.InstanceStartParams, null), - ), - http.post( - "/v1/instances/:instance/stop", - handler(handlers["instanceStop"], schema.InstanceStopParams, null), - ), - http.get( - "/v1/internet-gateway-ip-addresses", - handler( - handlers["internetGatewayIpAddressList"], - schema.InternetGatewayIpAddressListParams, - null, - ), - ), - http.post( - "/v1/internet-gateway-ip-addresses", - handler( - handlers["internetGatewayIpAddressCreate"], - schema.InternetGatewayIpAddressCreateParams, - schema.InternetGatewayIpAddressCreate, - ), - ), - http.delete( - "/v1/internet-gateway-ip-addresses/:address", - handler( - handlers["internetGatewayIpAddressDelete"], - schema.InternetGatewayIpAddressDeleteParams, - null, - ), - ), - http.get( - "/v1/internet-gateway-ip-pools", - handler( - handlers["internetGatewayIpPoolList"], - schema.InternetGatewayIpPoolListParams, - null, - ), - ), - http.post( - "/v1/internet-gateway-ip-pools", - handler( - handlers["internetGatewayIpPoolCreate"], - schema.InternetGatewayIpPoolCreateParams, - schema.InternetGatewayIpPoolCreate, - ), - ), - http.delete( - "/v1/internet-gateway-ip-pools/:pool", - handler( - handlers["internetGatewayIpPoolDelete"], - schema.InternetGatewayIpPoolDeleteParams, - null, - ), - ), - http.get( - "/v1/internet-gateways", - handler( - handlers["internetGatewayList"], - schema.InternetGatewayListParams, - null, - ), - ), - http.post( - "/v1/internet-gateways", - handler( - handlers["internetGatewayCreate"], - schema.InternetGatewayCreateParams, - schema.InternetGatewayCreate, - ), - ), - http.get( - "/v1/internet-gateways/:gateway", - handler( - handlers["internetGatewayView"], - schema.InternetGatewayViewParams, - null, - ), - ), - http.delete( - "/v1/internet-gateways/:gateway", - handler( - handlers["internetGatewayDelete"], - schema.InternetGatewayDeleteParams, - null, - ), - ), - http.get( - "/v1/ip-pools", - handler( - handlers["projectIpPoolList"], - schema.ProjectIpPoolListParams, - null, - ), - ), - http.get( - "/v1/ip-pools/:pool", - handler( - handlers["projectIpPoolView"], - schema.ProjectIpPoolViewParams, - null, - ), - ), - http.post( - "/v1/login/:siloName/local", - handler( - handlers["loginLocal"], - schema.LoginLocalParams, - schema.UsernamePasswordCredentials, - ), - ), - http.post("/v1/logout", handler(handlers["logout"], null, null)), - http.get("/v1/me", handler(handlers["currentUserView"], null, null)), - http.get( - "/v1/me/access-tokens", - handler( - handlers["currentUserAccessTokenList"], - schema.CurrentUserAccessTokenListParams, - null, - ), - ), - http.delete( - "/v1/me/access-tokens/:tokenId", - handler( - handlers["currentUserAccessTokenDelete"], - schema.CurrentUserAccessTokenDeleteParams, - null, - ), - ), - http.get( - "/v1/me/groups", - handler( - handlers["currentUserGroups"], - schema.CurrentUserGroupsParams, - null, - ), - ), - http.get( - "/v1/me/ssh-keys", - handler( - handlers["currentUserSshKeyList"], - schema.CurrentUserSshKeyListParams, - null, - ), - ), - http.post( - "/v1/me/ssh-keys", - handler(handlers["currentUserSshKeyCreate"], null, schema.SshKeyCreate), - ), - http.get( - "/v1/me/ssh-keys/:sshKey", - handler( - handlers["currentUserSshKeyView"], - schema.CurrentUserSshKeyViewParams, - null, - ), - ), - http.delete( - "/v1/me/ssh-keys/:sshKey", - handler( - handlers["currentUserSshKeyDelete"], - schema.CurrentUserSshKeyDeleteParams, - null, - ), - ), - http.get( - "/v1/metrics/:metricName", - handler(handlers["siloMetric"], schema.SiloMetricParams, null), - ), - http.get( - "/v1/network-interfaces", - handler( - handlers["instanceNetworkInterfaceList"], - schema.InstanceNetworkInterfaceListParams, - null, - ), - ), - http.post( - "/v1/network-interfaces", - handler( - handlers["instanceNetworkInterfaceCreate"], - schema.InstanceNetworkInterfaceCreateParams, - schema.InstanceNetworkInterfaceCreate, - ), - ), - http.get( - "/v1/network-interfaces/:interface", - handler( - handlers["instanceNetworkInterfaceView"], - schema.InstanceNetworkInterfaceViewParams, - null, - ), - ), - http.put( - "/v1/network-interfaces/:interface", - handler( - handlers["instanceNetworkInterfaceUpdate"], - schema.InstanceNetworkInterfaceUpdateParams, - schema.InstanceNetworkInterfaceUpdate, - ), - ), - http.delete( - "/v1/network-interfaces/:interface", - handler( - handlers["instanceNetworkInterfaceDelete"], - schema.InstanceNetworkInterfaceDeleteParams, - null, - ), - ), - http.get("/v1/ping", handler(handlers["ping"], null, null)), - http.get("/v1/policy", handler(handlers["policyView"], null, null)), - http.put( - "/v1/policy", - handler(handlers["policyUpdate"], null, schema.SiloRolePolicy), - ), - http.get( - "/v1/projects", - handler(handlers["projectList"], schema.ProjectListParams, null), - ), - http.post( - "/v1/projects", - handler(handlers["projectCreate"], null, schema.ProjectCreate), - ), - http.get( - "/v1/projects/:project", - handler(handlers["projectView"], schema.ProjectViewParams, null), - ), - http.put( - "/v1/projects/:project", - handler( - handlers["projectUpdate"], - schema.ProjectUpdateParams, - schema.ProjectUpdate, - ), - ), - http.delete( - "/v1/projects/:project", - handler(handlers["projectDelete"], schema.ProjectDeleteParams, null), - ), - http.get( - "/v1/projects/:project/policy", - handler( - handlers["projectPolicyView"], - schema.ProjectPolicyViewParams, - null, - ), - ), - http.put( - "/v1/projects/:project/policy", - handler( - handlers["projectPolicyUpdate"], - schema.ProjectPolicyUpdateParams, - schema.ProjectRolePolicy, - ), - ), - http.get( - "/v1/snapshots", - handler(handlers["snapshotList"], schema.SnapshotListParams, null), - ), - http.post( - "/v1/snapshots", - handler( - handlers["snapshotCreate"], - schema.SnapshotCreateParams, - schema.SnapshotCreate, - ), - ), - http.get( - "/v1/snapshots/:snapshot", - handler(handlers["snapshotView"], schema.SnapshotViewParams, null), - ), - http.delete( - "/v1/snapshots/:snapshot", - handler(handlers["snapshotDelete"], schema.SnapshotDeleteParams, null), - ), - http.get( - "/v1/system/audit-log", - handler(handlers["auditLogList"], schema.AuditLogListParams, null), - ), - http.get( - "/v1/system/hardware/disks", - handler( - handlers["physicalDiskList"], - schema.PhysicalDiskListParams, - null, - ), - ), - http.get( - "/v1/system/hardware/disks/:diskId", - handler( - handlers["physicalDiskView"], - schema.PhysicalDiskViewParams, - null, - ), - ), - http.get( - "/v1/system/hardware/rack-switch-port/:rackId/:switchLocation/:port/lldp/neighbors", - handler( - handlers["networkingSwitchPortLldpNeighbors"], - schema.NetworkingSwitchPortLldpNeighborsParams, - null, - ), - ), - http.get( - "/v1/system/hardware/racks", - handler(handlers["rackList"], schema.RackListParams, null), - ), - http.get( - "/v1/system/hardware/racks/:rackId", - handler(handlers["rackView"], schema.RackViewParams, null), - ), - http.get( - "/v1/system/hardware/sleds", - handler(handlers["sledList"], schema.SledListParams, null), - ), - http.post( - "/v1/system/hardware/sleds", - handler(handlers["sledAdd"], null, schema.UninitializedSledId), - ), - http.get( - "/v1/system/hardware/sleds/:sledId", - handler(handlers["sledView"], schema.SledViewParams, null), - ), - http.get( - "/v1/system/hardware/sleds/:sledId/disks", - handler( - handlers["sledPhysicalDiskList"], - schema.SledPhysicalDiskListParams, - null, - ), - ), - http.get( - "/v1/system/hardware/sleds/:sledId/instances", - handler( - handlers["sledInstanceList"], - schema.SledInstanceListParams, - null, - ), - ), - http.put( - "/v1/system/hardware/sleds/:sledId/provision-policy", - handler( - handlers["sledSetProvisionPolicy"], - schema.SledSetProvisionPolicyParams, - schema.SledProvisionPolicyParams, - ), - ), - http.get( - "/v1/system/hardware/sleds-uninitialized", - handler( - handlers["sledListUninitialized"], - schema.SledListUninitializedParams, - null, - ), - ), - http.get( - "/v1/system/hardware/switch-port", - handler( - handlers["networkingSwitchPortList"], - schema.NetworkingSwitchPortListParams, - null, - ), - ), - http.get( - "/v1/system/hardware/switch-port/:port/lldp/config", - handler( - handlers["networkingSwitchPortLldpConfigView"], - schema.NetworkingSwitchPortLldpConfigViewParams, - null, - ), - ), - http.post( - "/v1/system/hardware/switch-port/:port/lldp/config", - handler( - handlers["networkingSwitchPortLldpConfigUpdate"], - schema.NetworkingSwitchPortLldpConfigUpdateParams, - schema.LldpLinkConfig, - ), - ), - http.post( - "/v1/system/hardware/switch-port/:port/settings", - handler( - handlers["networkingSwitchPortApplySettings"], - schema.NetworkingSwitchPortApplySettingsParams, - schema.SwitchPortApplySettings, - ), - ), - http.delete( - "/v1/system/hardware/switch-port/:port/settings", - handler( - handlers["networkingSwitchPortClearSettings"], - schema.NetworkingSwitchPortClearSettingsParams, - null, - ), - ), - http.get( - "/v1/system/hardware/switch-port/:port/status", - handler( - handlers["networkingSwitchPortStatus"], - schema.NetworkingSwitchPortStatusParams, - null, - ), - ), - http.get( - "/v1/system/hardware/switches", - handler(handlers["switchList"], schema.SwitchListParams, null), - ), - http.get( - "/v1/system/hardware/switches/:switchId", - handler(handlers["switchView"], schema.SwitchViewParams, null), - ), - http.get( - "/v1/system/identity-providers", - handler( - handlers["siloIdentityProviderList"], - schema.SiloIdentityProviderListParams, - null, - ), - ), - http.post( - "/v1/system/identity-providers/local/users", - handler( - handlers["localIdpUserCreate"], - schema.LocalIdpUserCreateParams, - schema.UserCreate, - ), - ), - http.delete( - "/v1/system/identity-providers/local/users/:userId", - handler( - handlers["localIdpUserDelete"], - schema.LocalIdpUserDeleteParams, - null, - ), - ), - http.post( - "/v1/system/identity-providers/local/users/:userId/set-password", - handler( - handlers["localIdpUserSetPassword"], - schema.LocalIdpUserSetPasswordParams, - schema.UserPassword, - ), - ), - http.post( - "/v1/system/identity-providers/saml", - handler( - handlers["samlIdentityProviderCreate"], - schema.SamlIdentityProviderCreateParams, - schema.SamlIdentityProviderCreate, - ), - ), - http.get( - "/v1/system/identity-providers/saml/:provider", - handler( - handlers["samlIdentityProviderView"], - schema.SamlIdentityProviderViewParams, - null, - ), - ), - http.get( - "/v1/system/ip-pools", - handler(handlers["ipPoolList"], schema.IpPoolListParams, null), - ), - http.post( - "/v1/system/ip-pools", - handler(handlers["ipPoolCreate"], null, schema.IpPoolCreate), - ), - http.get( - "/v1/system/ip-pools/:pool", - handler(handlers["ipPoolView"], schema.IpPoolViewParams, null), - ), - http.put( - "/v1/system/ip-pools/:pool", - handler( - handlers["ipPoolUpdate"], - schema.IpPoolUpdateParams, - schema.IpPoolUpdate, - ), - ), - http.delete( - "/v1/system/ip-pools/:pool", - handler(handlers["ipPoolDelete"], schema.IpPoolDeleteParams, null), - ), - http.get( - "/v1/system/ip-pools/:pool/ranges", - handler(handlers["ipPoolRangeList"], schema.IpPoolRangeListParams, null), - ), - http.post( - "/v1/system/ip-pools/:pool/ranges/add", - handler( - handlers["ipPoolRangeAdd"], - schema.IpPoolRangeAddParams, - schema.IpRange, - ), - ), - http.post( - "/v1/system/ip-pools/:pool/ranges/remove", - handler( - handlers["ipPoolRangeRemove"], - schema.IpPoolRangeRemoveParams, - schema.IpRange, - ), - ), - http.get( - "/v1/system/ip-pools/:pool/silos", - handler(handlers["ipPoolSiloList"], schema.IpPoolSiloListParams, null), - ), - http.post( - "/v1/system/ip-pools/:pool/silos", - handler( - handlers["ipPoolSiloLink"], - schema.IpPoolSiloLinkParams, - schema.IpPoolLinkSilo, - ), - ), - http.put( - "/v1/system/ip-pools/:pool/silos/:silo", - handler( - handlers["ipPoolSiloUpdate"], - schema.IpPoolSiloUpdateParams, - schema.IpPoolSiloUpdate, - ), - ), - http.delete( - "/v1/system/ip-pools/:pool/silos/:silo", - handler( - handlers["ipPoolSiloUnlink"], - schema.IpPoolSiloUnlinkParams, - null, - ), - ), - http.get( - "/v1/system/ip-pools/:pool/utilization", - handler( - handlers["ipPoolUtilizationView"], - schema.IpPoolUtilizationViewParams, - null, - ), - ), - http.get( - "/v1/system/ip-pools-service", - handler(handlers["ipPoolServiceView"], null, null), - ), - http.get( - "/v1/system/ip-pools-service/ranges", - handler( - handlers["ipPoolServiceRangeList"], - schema.IpPoolServiceRangeListParams, - null, - ), - ), - http.post( - "/v1/system/ip-pools-service/ranges/add", - handler(handlers["ipPoolServiceRangeAdd"], null, schema.IpRange), - ), - http.post( - "/v1/system/ip-pools-service/ranges/remove", - handler(handlers["ipPoolServiceRangeRemove"], null, schema.IpRange), - ), - http.get( - "/v1/system/metrics/:metricName", - handler(handlers["systemMetric"], schema.SystemMetricParams, null), - ), - http.get( - "/v1/system/networking/address-lot", - handler( - handlers["networkingAddressLotList"], - schema.NetworkingAddressLotListParams, - null, - ), - ), - http.post( - "/v1/system/networking/address-lot", - handler( - handlers["networkingAddressLotCreate"], - null, - schema.AddressLotCreate, - ), - ), - http.delete( - "/v1/system/networking/address-lot/:addressLot", - handler( - handlers["networkingAddressLotDelete"], - schema.NetworkingAddressLotDeleteParams, - null, - ), - ), - http.get( - "/v1/system/networking/address-lot/:addressLot/blocks", - handler( - handlers["networkingAddressLotBlockList"], - schema.NetworkingAddressLotBlockListParams, - null, - ), - ), - http.get( - "/v1/system/networking/allow-list", - handler(handlers["networkingAllowListView"], null, null), - ), - http.put( - "/v1/system/networking/allow-list", - handler( - handlers["networkingAllowListUpdate"], - null, - schema.AllowListUpdate, - ), - ), - http.post( - "/v1/system/networking/bfd-disable", - handler(handlers["networkingBfdDisable"], null, schema.BfdSessionDisable), - ), - http.post( - "/v1/system/networking/bfd-enable", - handler(handlers["networkingBfdEnable"], null, schema.BfdSessionEnable), - ), - http.get( - "/v1/system/networking/bfd-status", - handler(handlers["networkingBfdStatus"], null, null), - ), - http.get( - "/v1/system/networking/bgp", - handler( - handlers["networkingBgpConfigList"], - schema.NetworkingBgpConfigListParams, - null, - ), - ), - http.post( - "/v1/system/networking/bgp", - handler( - handlers["networkingBgpConfigCreate"], - null, - schema.BgpConfigCreate, - ), - ), - http.delete( - "/v1/system/networking/bgp", - handler( - handlers["networkingBgpConfigDelete"], - schema.NetworkingBgpConfigDeleteParams, - null, - ), - ), - http.get( - "/v1/system/networking/bgp-announce-set", - handler( - handlers["networkingBgpAnnounceSetList"], - schema.NetworkingBgpAnnounceSetListParams, - null, - ), - ), - http.put( - "/v1/system/networking/bgp-announce-set", - handler( - handlers["networkingBgpAnnounceSetUpdate"], - null, - schema.BgpAnnounceSetCreate, - ), - ), - http.delete( - "/v1/system/networking/bgp-announce-set/:announceSet", - handler( - handlers["networkingBgpAnnounceSetDelete"], - schema.NetworkingBgpAnnounceSetDeleteParams, - null, - ), - ), - http.get( - "/v1/system/networking/bgp-announce-set/:announceSet/announcement", - handler( - handlers["networkingBgpAnnouncementList"], - schema.NetworkingBgpAnnouncementListParams, - null, - ), - ), - http.get( - "/v1/system/networking/bgp-exported", - handler(handlers["networkingBgpExported"], null, null), - ), - http.get( - "/v1/system/networking/bgp-message-history", - handler( - handlers["networkingBgpMessageHistory"], - schema.NetworkingBgpMessageHistoryParams, - null, - ), - ), - http.get( - "/v1/system/networking/bgp-routes-ipv4", - handler( - handlers["networkingBgpImportedRoutesIpv4"], - schema.NetworkingBgpImportedRoutesIpv4Params, - null, - ), - ), - http.get( - "/v1/system/networking/bgp-status", - handler(handlers["networkingBgpStatus"], null, null), - ), - http.get( - "/v1/system/networking/inbound-icmp", - handler(handlers["networkingInboundIcmpView"], null, null), - ), - http.put( - "/v1/system/networking/inbound-icmp", - handler( - handlers["networkingInboundIcmpUpdate"], - null, - schema.ServiceIcmpConfig, - ), - ), - http.get( - "/v1/system/networking/loopback-address", - handler( - handlers["networkingLoopbackAddressList"], - schema.NetworkingLoopbackAddressListParams, - null, - ), - ), - http.post( - "/v1/system/networking/loopback-address", - handler( - handlers["networkingLoopbackAddressCreate"], - null, - schema.LoopbackAddressCreate, - ), - ), - http.delete( - "/v1/system/networking/loopback-address/:rackId/:switchLocation/:address/:subnetMask", - handler( - handlers["networkingLoopbackAddressDelete"], - schema.NetworkingLoopbackAddressDeleteParams, - null, - ), - ), - http.get( - "/v1/system/networking/switch-port-settings", - handler( - handlers["networkingSwitchPortSettingsList"], - schema.NetworkingSwitchPortSettingsListParams, - null, - ), - ), - http.post( - "/v1/system/networking/switch-port-settings", - handler( - handlers["networkingSwitchPortSettingsCreate"], - null, - schema.SwitchPortSettingsCreate, - ), - ), - http.delete( - "/v1/system/networking/switch-port-settings", - handler( - handlers["networkingSwitchPortSettingsDelete"], - schema.NetworkingSwitchPortSettingsDeleteParams, - null, - ), - ), - http.get( - "/v1/system/networking/switch-port-settings/:port", - handler( - handlers["networkingSwitchPortSettingsView"], - schema.NetworkingSwitchPortSettingsViewParams, - null, - ), - ), - http.get( - "/v1/system/policy", - handler(handlers["systemPolicyView"], null, null), - ), - http.put( - "/v1/system/policy", - handler(handlers["systemPolicyUpdate"], null, schema.FleetRolePolicy), - ), - http.get( - "/v1/system/silo-quotas", - handler( - handlers["systemQuotasList"], - schema.SystemQuotasListParams, - null, - ), - ), - http.get( - "/v1/system/silos", - handler(handlers["siloList"], schema.SiloListParams, null), - ), - http.post( - "/v1/system/silos", - handler(handlers["siloCreate"], null, schema.SiloCreate), - ), - http.get( - "/v1/system/silos/:silo", - handler(handlers["siloView"], schema.SiloViewParams, null), - ), - http.delete( - "/v1/system/silos/:silo", - handler(handlers["siloDelete"], schema.SiloDeleteParams, null), - ), - http.get( - "/v1/system/silos/:silo/ip-pools", - handler(handlers["siloIpPoolList"], schema.SiloIpPoolListParams, null), - ), - http.get( - "/v1/system/silos/:silo/policy", - handler(handlers["siloPolicyView"], schema.SiloPolicyViewParams, null), - ), - http.put( - "/v1/system/silos/:silo/policy", - handler( - handlers["siloPolicyUpdate"], - schema.SiloPolicyUpdateParams, - schema.SiloRolePolicy, - ), - ), - http.get( - "/v1/system/silos/:silo/quotas", - handler(handlers["siloQuotasView"], schema.SiloQuotasViewParams, null), - ), - http.put( - "/v1/system/silos/:silo/quotas", - handler( - handlers["siloQuotasUpdate"], - schema.SiloQuotasUpdateParams, - schema.SiloQuotasUpdate, - ), - ), - http.post( - "/v1/system/timeseries/query", - handler(handlers["systemTimeseriesQuery"], null, schema.TimeseriesQuery), - ), - http.get( - "/v1/system/timeseries/schemas", - handler( - handlers["systemTimeseriesSchemaList"], - schema.SystemTimeseriesSchemaListParams, - null, - ), - ), - http.put( - "/v1/system/update/repository", - handler( - handlers["systemUpdatePutRepository"], - schema.SystemUpdatePutRepositoryParams, - null, - ), - ), - http.get( - "/v1/system/update/repository/:systemVersion", - handler( - handlers["systemUpdateGetRepository"], - schema.SystemUpdateGetRepositoryParams, - null, - ), - ), - http.get( - "/v1/system/update/target-release", - handler(handlers["targetReleaseView"], null, null), - ), - http.put( - "/v1/system/update/target-release", - handler( - handlers["targetReleaseUpdate"], - null, - schema.SetTargetReleaseParams, - ), - ), - http.get( - "/v1/system/update/trust-roots", - handler( - handlers["systemUpdateTrustRootList"], - schema.SystemUpdateTrustRootListParams, - null, - ), - ), - http.post( - "/v1/system/update/trust-roots", - handler(handlers["systemUpdateTrustRootCreate"], null, null), - ), - http.get( - "/v1/system/update/trust-roots/:trustRootId", - handler( - handlers["systemUpdateTrustRootView"], - schema.SystemUpdateTrustRootViewParams, - null, - ), - ), - http.delete( - "/v1/system/update/trust-roots/:trustRootId", - handler( - handlers["systemUpdateTrustRootDelete"], - schema.SystemUpdateTrustRootDeleteParams, - null, - ), - ), - http.get( - "/v1/system/users", - handler(handlers["siloUserList"], schema.SiloUserListParams, null), - ), - http.get( - "/v1/system/users/:userId", - handler(handlers["siloUserView"], schema.SiloUserViewParams, null), - ), - http.get( - "/v1/system/users-builtin", - handler(handlers["userBuiltinList"], schema.UserBuiltinListParams, null), - ), - http.get( - "/v1/system/users-builtin/:user", - handler(handlers["userBuiltinView"], schema.UserBuiltinViewParams, null), - ), - http.get( - "/v1/system/utilization/silos", - handler( - handlers["siloUtilizationList"], - schema.SiloUtilizationListParams, - null, - ), - ), - http.get( - "/v1/system/utilization/silos/:silo", - handler( - handlers["siloUtilizationView"], - schema.SiloUtilizationViewParams, - null, - ), - ), - http.post( - "/v1/timeseries/query", - handler( - handlers["timeseriesQuery"], - schema.TimeseriesQueryParams, - schema.TimeseriesQuery, - ), - ), - http.get( - "/v1/users", - handler(handlers["userList"], schema.UserListParams, null), - ), - http.get( - "/v1/users/:userId", - handler(handlers["userView"], schema.UserViewParams, null), - ), - http.get( - "/v1/users/:userId/access-tokens", - handler(handlers["userTokenList"], schema.UserTokenListParams, null), - ), - http.post( - "/v1/users/:userId/logout", - handler(handlers["userLogout"], schema.UserLogoutParams, null), - ), - http.get( - "/v1/users/:userId/sessions", - handler(handlers["userSessionList"], schema.UserSessionListParams, null), - ), - http.get( - "/v1/utilization", - handler(handlers["utilizationView"], null, null), - ), - http.get( - "/v1/vpc-firewall-rules", - handler( - handlers["vpcFirewallRulesView"], - schema.VpcFirewallRulesViewParams, - null, - ), - ), - http.put( - "/v1/vpc-firewall-rules", - handler( - handlers["vpcFirewallRulesUpdate"], - schema.VpcFirewallRulesUpdateParams, - schema.VpcFirewallRuleUpdateParams, - ), - ), - http.get( - "/v1/vpc-router-routes", - handler( - handlers["vpcRouterRouteList"], - schema.VpcRouterRouteListParams, - null, - ), - ), - http.post( - "/v1/vpc-router-routes", - handler( - handlers["vpcRouterRouteCreate"], - schema.VpcRouterRouteCreateParams, - schema.RouterRouteCreate, - ), - ), - http.get( - "/v1/vpc-router-routes/:route", - handler( - handlers["vpcRouterRouteView"], - schema.VpcRouterRouteViewParams, - null, - ), - ), - http.put( - "/v1/vpc-router-routes/:route", - handler( - handlers["vpcRouterRouteUpdate"], - schema.VpcRouterRouteUpdateParams, - schema.RouterRouteUpdate, - ), - ), - http.delete( - "/v1/vpc-router-routes/:route", - handler( - handlers["vpcRouterRouteDelete"], - schema.VpcRouterRouteDeleteParams, - null, - ), - ), - http.get( - "/v1/vpc-routers", - handler(handlers["vpcRouterList"], schema.VpcRouterListParams, null), - ), - http.post( - "/v1/vpc-routers", - handler( - handlers["vpcRouterCreate"], - schema.VpcRouterCreateParams, - schema.VpcRouterCreate, - ), - ), - http.get( - "/v1/vpc-routers/:router", - handler(handlers["vpcRouterView"], schema.VpcRouterViewParams, null), - ), - http.put( - "/v1/vpc-routers/:router", - handler( - handlers["vpcRouterUpdate"], - schema.VpcRouterUpdateParams, - schema.VpcRouterUpdate, - ), - ), - http.delete( - "/v1/vpc-routers/:router", - handler(handlers["vpcRouterDelete"], schema.VpcRouterDeleteParams, null), - ), - http.get( - "/v1/vpc-subnets", - handler(handlers["vpcSubnetList"], schema.VpcSubnetListParams, null), - ), - http.post( - "/v1/vpc-subnets", - handler( - handlers["vpcSubnetCreate"], - schema.VpcSubnetCreateParams, - schema.VpcSubnetCreate, - ), - ), - http.get( - "/v1/vpc-subnets/:subnet", - handler(handlers["vpcSubnetView"], schema.VpcSubnetViewParams, null), - ), - http.put( - "/v1/vpc-subnets/:subnet", - handler( - handlers["vpcSubnetUpdate"], - schema.VpcSubnetUpdateParams, - schema.VpcSubnetUpdate, - ), - ), - http.delete( - "/v1/vpc-subnets/:subnet", - handler(handlers["vpcSubnetDelete"], schema.VpcSubnetDeleteParams, null), - ), - http.get( - "/v1/vpc-subnets/:subnet/network-interfaces", - handler( - handlers["vpcSubnetListNetworkInterfaces"], - schema.VpcSubnetListNetworkInterfacesParams, - null, - ), - ), - http.get( - "/v1/vpcs", - handler(handlers["vpcList"], schema.VpcListParams, null), - ), - http.post( - "/v1/vpcs", - handler(handlers["vpcCreate"], schema.VpcCreateParams, schema.VpcCreate), - ), - http.get( - "/v1/vpcs/:vpc", - handler(handlers["vpcView"], schema.VpcViewParams, null), - ), - http.put( - "/v1/vpcs/:vpc", - handler(handlers["vpcUpdate"], schema.VpcUpdateParams, schema.VpcUpdate), - ), - http.delete( - "/v1/vpcs/:vpc", - handler(handlers["vpcDelete"], schema.VpcDeleteParams, null), - ), - http.post( - "/v1/webhook-receivers", - handler(handlers["webhookReceiverCreate"], null, schema.WebhookCreate), - ), - http.put( - "/v1/webhook-receivers/:receiver", - handler( - handlers["webhookReceiverUpdate"], - schema.WebhookReceiverUpdateParams, - schema.WebhookReceiverUpdate, - ), - ), - http.get( - "/v1/webhook-secrets", - handler( - handlers["webhookSecretsList"], - schema.WebhookSecretsListParams, - null, - ), - ), - http.post( - "/v1/webhook-secrets", - handler( - handlers["webhookSecretsAdd"], - schema.WebhookSecretsAddParams, - schema.WebhookSecretCreate, - ), - ), - http.delete( - "/v1/webhook-secrets/:secretId", - handler( - handlers["webhookSecretsDelete"], - schema.WebhookSecretsDeleteParams, - null, - ), - ), - ]; -} diff --git a/oxide-api/src/validate.ts b/oxide-api/src/validate.ts deleted file mode 100644 index 47bb7ac..0000000 --- a/oxide-api/src/validate.ts +++ /dev/null @@ -1,8053 +0,0 @@ -/* eslint-disable */ - -import { z, ZodType } from "zod/v4"; -import { processResponseBody, uniqueItems } from "./util"; - -/** - * Zod only supports string enums at the moment. A previous issue was opened - * and closed as stale but it provided a hint on how to implement it. - * - * @see https://github.com/colinhacks/zod/issues/1118 - * TODO: PR an update for zod to support other native enum types - */ -const IntEnum = (values: T) => - z.number().refine((v) => values.includes(v)) as ZodType; - -/** Helper to ensure booleans provided as strings end up with the correct value */ -const SafeBoolean = z.preprocess( - (v) => (v === "false" ? false : v), - z.coerce.boolean(), -); - -/** - * An IPv4 subnet - * - * An IPv4 subnet, including prefix and prefix length - */ -export const Ipv4Net = z.preprocess( - processResponseBody, - z - .string() - .regex( - /^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\/([0-9]|1[0-9]|2[0-9]|3[0-2])$/, - ), -); - -/** - * An IPv6 subnet - * - * An IPv6 subnet, including prefix and subnet mask - */ -export const Ipv6Net = z.preprocess( - processResponseBody, - z - .string() - .regex( - /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])$/, - ), -); - -export const IpNet = z.preprocess( - processResponseBody, - z.union([Ipv4Net, Ipv6Net]), -); - -/** - * A name unique within the parent collection - * - * Names must begin with a lower case ASCII letter, be composed exclusively of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end with a '-'. Names cannot be a UUID, but they may contain a UUID. They can be at most 63 characters long. - */ -export const Name = z.preprocess( - processResponseBody, - z - .string() - .min(1) - .max(63) - .regex( - /^(?![0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)^[a-z]([a-zA-Z0-9-]*[a-zA-Z0-9]+)?$/, - ), -); - -export const NameOrId = z.preprocess( - processResponseBody, - z.union([z.uuid(), Name]), -); - -/** - * An address tied to an address lot. - */ -export const Address = z.preprocess( - processResponseBody, - z.object({ - address: IpNet, - addressLot: NameOrId, - vlanId: z.number().min(0).max(65535).nullable().optional(), - }), -); - -/** - * A set of addresses associated with a port configuration. - */ -export const AddressConfig = z.preprocess( - processResponseBody, - z.object({ addresses: Address.array(), linkName: Name }), -); - -/** - * The kind associated with an address lot. - */ -export const AddressLotKind = z.preprocess( - processResponseBody, - z.enum(["infra", "pool"]), -); - -/** - * Represents an address lot object, containing the id of the lot that can be used in other API calls. - */ -export const AddressLot = z.preprocess( - processResponseBody, - z.object({ - description: z.string(), - id: z.uuid(), - kind: AddressLotKind, - name: Name, - timeCreated: z.coerce.date(), - timeModified: z.coerce.date(), - }), -); - -/** - * An address lot block is a part of an address lot and contains a range of addresses. The range is inclusive. - */ -export const AddressLotBlock = z.preprocess( - processResponseBody, - z.object({ firstAddress: z.ipv4(), id: z.uuid(), lastAddress: z.ipv4() }), -); - -/** - * Parameters for creating an address lot block. Fist and last addresses are inclusive. - */ -export const AddressLotBlockCreate = z.preprocess( - processResponseBody, - z.object({ firstAddress: z.ipv4(), lastAddress: z.ipv4() }), -); - -/** - * A single page of results - */ -export const AddressLotBlockResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: AddressLotBlock.array(), - nextPage: z.string().nullable().optional(), - }), -); - -/** - * Parameters for creating an address lot. - */ -export const AddressLotCreate = z.preprocess( - processResponseBody, - z.object({ - blocks: AddressLotBlockCreate.array(), - description: z.string(), - kind: AddressLotKind, - name: Name, - }), -); - -/** - * An address lot and associated blocks resulting from creating an address lot. - */ -export const AddressLotCreateResponse = z.preprocess( - processResponseBody, - z.object({ blocks: AddressLotBlock.array(), lot: AddressLot }), -); - -/** - * A single page of results - */ -export const AddressLotResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: AddressLot.array(), - nextPage: z.string().nullable().optional(), - }), -); - -/** - * Describes the scope of affinity for the purposes of co-location. - */ -export const FailureDomain = z.preprocess( - processResponseBody, - z.enum(["sled"]), -); - -/** - * Affinity policy used to describe "what to do when a request cannot be satisfied" - * - * Used for both Affinity and Anti-Affinity Groups - */ -export const AffinityPolicy = z.preprocess( - processResponseBody, - z.enum(["allow", "fail"]), -); - -/** - * View of an Affinity Group - */ -export const AffinityGroup = z.preprocess( - processResponseBody, - z.object({ - description: z.string(), - failureDomain: FailureDomain, - id: z.uuid(), - name: Name, - policy: AffinityPolicy, - projectId: z.uuid(), - timeCreated: z.coerce.date(), - timeModified: z.coerce.date(), - }), -); - -/** - * Create-time parameters for an `AffinityGroup` - */ -export const AffinityGroupCreate = z.preprocess( - processResponseBody, - z.object({ - description: z.string(), - failureDomain: FailureDomain, - name: Name, - policy: AffinityPolicy, - }), -); - -export const TypedUuidForInstanceKind = z.preprocess( - processResponseBody, - z.uuid(), -); - -/** - * Running state of an Instance (primarily: booted or stopped) - * - * This typically reflects whether it's starting, running, stopping, or stopped, but also includes states related to the Instance's lifecycle - */ -export const InstanceState = z.preprocess( - processResponseBody, - z.enum([ - "creating", - "starting", - "running", - "stopping", - "stopped", - "rebooting", - "migrating", - "repairing", - "failed", - "destroyed", - ]), -); - -/** - * A member of an Affinity Group - * - * Membership in a group is not exclusive - members may belong to multiple affinity / anti-affinity groups. - * - * Affinity Groups can contain up to 32 members. - */ -export const AffinityGroupMember = z.preprocess( - processResponseBody, - z.object({ - type: z.enum(["instance"]), - value: z.object({ - id: TypedUuidForInstanceKind, - name: Name, - runState: InstanceState, - }), - }), -); - -/** - * A single page of results - */ -export const AffinityGroupMemberResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: AffinityGroupMember.array(), - nextPage: z.string().nullable().optional(), - }), -); - -/** - * A single page of results - */ -export const AffinityGroupResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: AffinityGroup.array(), - nextPage: z.string().nullable().optional(), - }), -); - -/** - * Updateable properties of an `AffinityGroup` - */ -export const AffinityGroupUpdate = z.preprocess( - processResponseBody, - z.object({ - description: z.string().nullable().optional(), - name: Name.nullable().optional(), - }), -); - -export const BgpMessageHistory = z.preprocess( - processResponseBody, - z.record(z.string(), z.unknown()), -); - -/** - * Identifies switch physical location - */ -export const SwitchLocation = z.preprocess( - processResponseBody, - z.enum(["switch0", "switch1"]), -); - -/** - * BGP message history for a particular switch. - */ -export const SwitchBgpHistory = z.preprocess( - processResponseBody, - z.object({ - history: z.record(z.string(), BgpMessageHistory), - switch: SwitchLocation, - }), -); - -/** - * BGP message history for rack switches. - */ -export const AggregateBgpMessageHistory = z.preprocess( - processResponseBody, - z.object({ switchHistories: SwitchBgpHistory.array() }), -); - -/** - * An alert class. - */ -export const AlertClass = z.preprocess( - processResponseBody, - z.object({ description: z.string(), name: z.string() }), -); - -/** - * A single page of results - */ -export const AlertClassResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: AlertClass.array(), - nextPage: z.string().nullable().optional(), - }), -); - -export const TypedUuidForAlertKind = z.preprocess( - processResponseBody, - z.uuid(), -); - -/** - * The response received from a webhook receiver endpoint. - */ -export const WebhookDeliveryResponse = z.preprocess( - processResponseBody, - z.object({ - durationMs: z.number().min(0), - status: z.number().min(0).max(65535), - }), -); - -export const WebhookDeliveryAttemptResult = z.preprocess( - processResponseBody, - z.enum([ - "succeeded", - "failed_http_error", - "failed_unreachable", - "failed_timeout", - ]), -); - -/** - * An individual delivery attempt for a webhook event. - * - * This represents a single HTTP request that was sent to the receiver, and its outcome. - */ -export const WebhookDeliveryAttempt = z.preprocess( - processResponseBody, - z.object({ - attempt: z.number().min(0), - response: WebhookDeliveryResponse.nullable().optional(), - result: WebhookDeliveryAttemptResult, - timeSent: z.coerce.date(), - }), -); - -/** - * A list of attempts to deliver an alert to a receiver. - * - * The type of the delivery attempt model depends on the receiver type, as it may contain information specific to that delivery mechanism. For example, webhook delivery attempts contain the HTTP status code of the webhook request. - */ -export const AlertDeliveryAttempts = z.preprocess( - processResponseBody, - z.object({ webhook: WebhookDeliveryAttempt.array() }), -); - -export const TypedUuidForAlertReceiverKind = z.preprocess( - processResponseBody, - z.uuid(), -); - -/** - * The state of a webhook delivery attempt. - */ -export const AlertDeliveryState = z.preprocess( - processResponseBody, - z.enum(["pending", "delivered", "failed"]), -); - -/** - * The reason an alert was delivered - */ -export const AlertDeliveryTrigger = z.preprocess( - processResponseBody, - z.enum(["alert", "resend", "probe"]), -); - -/** - * A delivery of a webhook event. - */ -export const AlertDelivery = z.preprocess( - processResponseBody, - z.object({ - alertClass: z.string(), - alertId: TypedUuidForAlertKind, - attempts: AlertDeliveryAttempts, - id: z.uuid(), - receiverId: TypedUuidForAlertReceiverKind, - state: AlertDeliveryState, - timeStarted: z.coerce.date(), - trigger: AlertDeliveryTrigger, - }), -); - -export const AlertDeliveryId = z.preprocess( - processResponseBody, - z.object({ deliveryId: z.uuid() }), -); - -/** - * A single page of results - */ -export const AlertDeliveryResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: AlertDelivery.array(), - nextPage: z.string().nullable().optional(), - }), -); - -/** - * Data describing the result of an alert receiver liveness probe attempt. - */ -export const AlertProbeResult = z.preprocess( - processResponseBody, - z.object({ - probe: AlertDelivery, - resendsStarted: z.number().min(0).nullable().optional(), - }), -); - -/** - * A view of a shared secret key assigned to a webhook receiver. - * - * Once a secret is created, the value of the secret is not available in the API, as it must remain secret. Instead, secrets are referenced by their unique IDs assigned when they are created. - */ -export const WebhookSecret = z.preprocess( - processResponseBody, - z.object({ id: z.uuid(), timeCreated: z.coerce.date() }), -); - -/** - * The possible alert delivery mechanisms for an alert receiver. - */ -export const AlertReceiverKind = z.preprocess( - processResponseBody, - z.object({ - endpoint: z.string(), - kind: z.enum(["webhook"]), - secrets: WebhookSecret.array(), - }), -); - -/** - * A webhook event class subscription - * - * A webhook event class subscription matches either a single event class exactly, or a glob pattern including wildcards that may match multiple event classes - */ -export const AlertSubscription = z.preprocess( - processResponseBody, - z.string().regex(/^([a-zA-Z0-9_]+|\*|\*\*)(\.([a-zA-Z0-9_]+|\*|\*\*))*$/), -); - -/** - * The configuration for an alert receiver. - */ -export const AlertReceiver = z.preprocess( - processResponseBody, - z.object({ - description: z.string(), - id: z.uuid(), - kind: AlertReceiverKind, - name: Name, - subscriptions: AlertSubscription.array(), - timeCreated: z.coerce.date(), - timeModified: z.coerce.date(), - }), -); - -/** - * A single page of results - */ -export const AlertReceiverResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: AlertReceiver.array(), - nextPage: z.string().nullable().optional(), - }), -); - -export const AlertSubscriptionCreate = z.preprocess( - processResponseBody, - z.object({ subscription: AlertSubscription }), -); - -export const AlertSubscriptionCreated = z.preprocess( - processResponseBody, - z.object({ subscription: AlertSubscription }), -); - -/** - * Description of source IPs allowed to reach rack services. - */ -export const AllowedSourceIps = z.preprocess( - processResponseBody, - z.union([ - z.object({ allow: z.enum(["any"]) }), - z.object({ allow: z.enum(["list"]), ips: IpNet.array() }), - ]), -); - -/** - * Allowlist of IPs or subnets that can make requests to user-facing services. - */ -export const AllowList = z.preprocess( - processResponseBody, - z.object({ - allowedIps: AllowedSourceIps, - timeCreated: z.coerce.date(), - timeModified: z.coerce.date(), - }), -); - -/** - * Parameters for updating allowed source IPs - */ -export const AllowListUpdate = z.preprocess( - processResponseBody, - z.object({ allowedIps: AllowedSourceIps }), -); - -/** - * View of an Anti-Affinity Group - */ -export const AntiAffinityGroup = z.preprocess( - processResponseBody, - z.object({ - description: z.string(), - failureDomain: FailureDomain, - id: z.uuid(), - name: Name, - policy: AffinityPolicy, - projectId: z.uuid(), - timeCreated: z.coerce.date(), - timeModified: z.coerce.date(), - }), -); - -/** - * Create-time parameters for an `AntiAffinityGroup` - */ -export const AntiAffinityGroupCreate = z.preprocess( - processResponseBody, - z.object({ - description: z.string(), - failureDomain: FailureDomain, - name: Name, - policy: AffinityPolicy, - }), -); - -/** - * A member of an Anti-Affinity Group - * - * Membership in a group is not exclusive - members may belong to multiple affinity / anti-affinity groups. - * - * Anti-Affinity Groups can contain up to 32 members. - */ -export const AntiAffinityGroupMember = z.preprocess( - processResponseBody, - z.object({ - type: z.enum(["instance"]), - value: z.object({ - id: TypedUuidForInstanceKind, - name: Name, - runState: InstanceState, - }), - }), -); - -/** - * A single page of results - */ -export const AntiAffinityGroupMemberResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: AntiAffinityGroupMember.array(), - nextPage: z.string().nullable().optional(), - }), -); - -/** - * A single page of results - */ -export const AntiAffinityGroupResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: AntiAffinityGroup.array(), - nextPage: z.string().nullable().optional(), - }), -); - -/** - * Updateable properties of an `AntiAffinityGroup` - */ -export const AntiAffinityGroupUpdate = z.preprocess( - processResponseBody, - z.object({ - description: z.string().nullable().optional(), - name: Name.nullable().optional(), - }), -); - -/** - * An identifier for an artifact. - */ -export const ArtifactId = z.preprocess( - processResponseBody, - z.object({ kind: z.string(), name: z.string(), version: z.string() }), -); - -export const AuditLogEntryActor = z.preprocess( - processResponseBody, - z.union([ - z.object({ kind: z.enum(["user_builtin"]), userBuiltinId: z.uuid() }), - z.object({ - kind: z.enum(["silo_user"]), - siloId: z.uuid(), - siloUserId: z.uuid(), - }), - z.object({ kind: z.enum(["unauthenticated"]) }), - ]), -); - -/** - * Result of an audit log entry - */ -export const AuditLogEntryResult = z.preprocess( - processResponseBody, - z.union([ - z.object({ - httpStatusCode: z.number().min(0).max(65535), - kind: z.enum(["success"]), - }), - z.object({ - errorCode: z.string().nullable().optional(), - errorMessage: z.string(), - httpStatusCode: z.number().min(0).max(65535), - kind: z.enum(["error"]), - }), - z.object({ kind: z.enum(["unknown"]) }), - ]), -); - -/** - * Audit log entry - */ -export const AuditLogEntry = z.preprocess( - processResponseBody, - z.object({ - actor: AuditLogEntryActor, - authMethod: z.string().nullable().optional(), - id: z.uuid(), - operationId: z.string(), - requestId: z.string(), - requestUri: z.string(), - result: AuditLogEntryResult, - sourceIp: z.ipv4(), - timeCompleted: z.coerce.date(), - timeStarted: z.coerce.date(), - userAgent: z.string().nullable().optional(), - }), -); - -/** - * A single page of results - */ -export const AuditLogEntryResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: AuditLogEntry.array(), - nextPage: z.string().nullable().optional(), - }), -); - -/** - * Authorization scope for a timeseries. - * - * This describes the level at which a user must be authorized to read data from a timeseries. For example, fleet-scoping means the data is only visible to an operator or fleet reader. Project-scoped, on the other hand, indicates that a user will see data limited to the projects on which they have read permissions. - */ -export const AuthzScope = z.preprocess( - processResponseBody, - z.enum(["fleet", "silo", "project", "viewable_to_all"]), -); - -/** - * Properties that uniquely identify an Oxide hardware component - */ -export const Baseboard = z.preprocess( - processResponseBody, - z.object({ - part: z.string(), - revision: z.number().min(0).max(4294967295), - serial: z.string(), - }), -); - -/** - * BFD connection mode. - */ -export const BfdMode = z.preprocess( - processResponseBody, - z.enum(["single_hop", "multi_hop"]), -); - -/** - * Information needed to disable a BFD session - */ -export const BfdSessionDisable = z.preprocess( - processResponseBody, - z.object({ remote: z.ipv4(), switch: Name }), -); - -/** - * Information about a bidirectional forwarding detection (BFD) session. - */ -export const BfdSessionEnable = z.preprocess( - processResponseBody, - z.object({ - detectionThreshold: z.number().min(0).max(255), - local: z.ipv4().nullable().optional(), - mode: BfdMode, - remote: z.ipv4(), - requiredRx: z.number().min(0), - switch: Name, - }), -); - -export const BfdState = z.preprocess( - processResponseBody, - z.enum(["admin_down", "down", "init", "up"]), -); - -export const BfdStatus = z.preprocess( - processResponseBody, - z.object({ - detectionThreshold: z.number().min(0).max(255), - local: z.ipv4().nullable().optional(), - mode: BfdMode, - peer: z.ipv4(), - requiredRx: z.number().min(0), - state: BfdState, - switch: Name, - }), -); - -/** - * Represents a BGP announce set by id. The id can be used with other API calls to view and manage the announce set. - */ -export const BgpAnnounceSet = z.preprocess( - processResponseBody, - z.object({ - description: z.string(), - id: z.uuid(), - name: Name, - timeCreated: z.coerce.date(), - timeModified: z.coerce.date(), - }), -); - -/** - * A BGP announcement tied to a particular address lot block. - */ -export const BgpAnnouncementCreate = z.preprocess( - processResponseBody, - z.object({ addressLotBlock: NameOrId, network: IpNet }), -); - -/** - * Parameters for creating a named set of BGP announcements. - */ -export const BgpAnnounceSetCreate = z.preprocess( - processResponseBody, - z.object({ - announcement: BgpAnnouncementCreate.array(), - description: z.string(), - name: Name, - }), -); - -/** - * A BGP announcement tied to an address lot block. - */ -export const BgpAnnouncement = z.preprocess( - processResponseBody, - z.object({ - addressLotBlockId: z.uuid(), - announceSetId: z.uuid(), - network: IpNet, - }), -); - -/** - * A base BGP configuration. - */ -export const BgpConfig = z.preprocess( - processResponseBody, - z.object({ - asn: z.number().min(0).max(4294967295), - description: z.string(), - id: z.uuid(), - name: Name, - timeCreated: z.coerce.date(), - timeModified: z.coerce.date(), - vrf: z.string().nullable().optional(), - }), -); - -/** - * Parameters for creating a BGP configuration. This includes and autonomous system number (ASN) and a virtual routing and forwarding (VRF) identifier. - */ -export const BgpConfigCreate = z.preprocess( - processResponseBody, - z.object({ - asn: z.number().min(0).max(4294967295), - bgpAnnounceSetId: NameOrId, - description: z.string(), - name: Name, - vrf: Name.nullable().optional(), - }), -); - -/** - * A single page of results - */ -export const BgpConfigResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: BgpConfig.array(), - nextPage: z.string().nullable().optional(), - }), -); - -/** - * The current status of a BGP peer. - */ -export const BgpExported = z.preprocess( - processResponseBody, - z.object({ exports: z.record(z.string(), Ipv4Net.array()) }), -); - -/** - * A route imported from a BGP peer. - */ -export const BgpImportedRouteIpv4 = z.preprocess( - processResponseBody, - z.object({ - id: z.number().min(0).max(4294967295), - nexthop: z.ipv4(), - prefix: Ipv4Net, - switch: SwitchLocation, - }), -); - -/** - * Define policy relating to the import and export of prefixes from a BGP peer. - */ -export const ImportExportPolicy = z.preprocess( - processResponseBody, - z.union([ - z.object({ type: z.enum(["no_filtering"]) }), - z.object({ type: z.enum(["allow"]), value: IpNet.array() }), - ]), -); - -/** - * A BGP peer configuration for an interface. Includes the set of announcements that will be advertised to the peer identified by `addr`. The `bgp_config` parameter is a reference to global BGP parameters. The `interface_name` indicates what interface the peer should be contacted on. - */ -export const BgpPeer = z.preprocess( - processResponseBody, - z.object({ - addr: z.ipv4(), - allowedExport: ImportExportPolicy, - allowedImport: ImportExportPolicy, - bgpConfig: NameOrId, - communities: z.number().min(0).max(4294967295).array(), - connectRetry: z.number().min(0).max(4294967295), - delayOpen: z.number().min(0).max(4294967295), - enforceFirstAs: SafeBoolean, - holdTime: z.number().min(0).max(4294967295), - idleHoldTime: z.number().min(0).max(4294967295), - interfaceName: Name, - keepalive: z.number().min(0).max(4294967295), - localPref: z.number().min(0).max(4294967295).nullable().optional(), - md5AuthKey: z.string().nullable().optional(), - minTtl: z.number().min(0).max(255).nullable().optional(), - multiExitDiscriminator: z - .number() - .min(0) - .max(4294967295) - .nullable() - .optional(), - remoteAsn: z.number().min(0).max(4294967295).nullable().optional(), - vlanId: z.number().min(0).max(65535).nullable().optional(), - }), -); - -export const BgpPeerConfig = z.preprocess( - processResponseBody, - z.object({ linkName: Name, peers: BgpPeer.array() }), -); - -/** - * The current state of a BGP peer. - */ -export const BgpPeerState = z.preprocess( - processResponseBody, - z.enum([ - "idle", - "connect", - "active", - "open_sent", - "open_confirm", - "session_setup", - "established", - ]), -); - -/** - * The current status of a BGP peer. - */ -export const BgpPeerStatus = z.preprocess( - processResponseBody, - z.object({ - addr: z.ipv4(), - localAsn: z.number().min(0).max(4294967295), - remoteAsn: z.number().min(0).max(4294967295), - state: BgpPeerState, - stateDurationMillis: z.number().min(0), - switch: SwitchLocation, - }), -); - -/** - * A type storing a range over `T`. - * - * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. - */ -export const BinRangedouble = z.preprocess( - processResponseBody, - z.union([ - z.object({ end: z.number(), type: z.enum(["range_to"]) }), - z.object({ end: z.number(), start: z.number(), type: z.enum(["range"]) }), - z.object({ start: z.number(), type: z.enum(["range_from"]) }), - ]), -); - -/** - * A type storing a range over `T`. - * - * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. - */ -export const BinRangefloat = z.preprocess( - processResponseBody, - z.union([ - z.object({ end: z.number(), type: z.enum(["range_to"]) }), - z.object({ end: z.number(), start: z.number(), type: z.enum(["range"]) }), - z.object({ start: z.number(), type: z.enum(["range_from"]) }), - ]), -); - -/** - * A type storing a range over `T`. - * - * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. - */ -export const BinRangeint16 = z.preprocess( - processResponseBody, - z.union([ - z.object({ - end: z.number().min(-32767).max(32767), - type: z.enum(["range_to"]), - }), - z.object({ - end: z.number().min(-32767).max(32767), - start: z.number().min(-32767).max(32767), - type: z.enum(["range"]), - }), - z.object({ - start: z.number().min(-32767).max(32767), - type: z.enum(["range_from"]), - }), - ]), -); - -/** - * A type storing a range over `T`. - * - * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. - */ -export const BinRangeint32 = z.preprocess( - processResponseBody, - z.union([ - z.object({ - end: z.number().min(-2147483647).max(2147483647), - type: z.enum(["range_to"]), - }), - z.object({ - end: z.number().min(-2147483647).max(2147483647), - start: z.number().min(-2147483647).max(2147483647), - type: z.enum(["range"]), - }), - z.object({ - start: z.number().min(-2147483647).max(2147483647), - type: z.enum(["range_from"]), - }), - ]), -); - -/** - * A type storing a range over `T`. - * - * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. - */ -export const BinRangeint64 = z.preprocess( - processResponseBody, - z.union([ - z.object({ end: z.number(), type: z.enum(["range_to"]) }), - z.object({ end: z.number(), start: z.number(), type: z.enum(["range"]) }), - z.object({ start: z.number(), type: z.enum(["range_from"]) }), - ]), -); - -/** - * A type storing a range over `T`. - * - * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. - */ -export const BinRangeint8 = z.preprocess( - processResponseBody, - z.union([ - z.object({ - end: z.number().min(-127).max(127), - type: z.enum(["range_to"]), - }), - z.object({ - end: z.number().min(-127).max(127), - start: z.number().min(-127).max(127), - type: z.enum(["range"]), - }), - z.object({ - start: z.number().min(-127).max(127), - type: z.enum(["range_from"]), - }), - ]), -); - -/** - * A type storing a range over `T`. - * - * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. - */ -export const BinRangeuint16 = z.preprocess( - processResponseBody, - z.union([ - z.object({ end: z.number().min(0).max(65535), type: z.enum(["range_to"]) }), - z.object({ - end: z.number().min(0).max(65535), - start: z.number().min(0).max(65535), - type: z.enum(["range"]), - }), - z.object({ - start: z.number().min(0).max(65535), - type: z.enum(["range_from"]), - }), - ]), -); - -/** - * A type storing a range over `T`. - * - * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. - */ -export const BinRangeuint32 = z.preprocess( - processResponseBody, - z.union([ - z.object({ - end: z.number().min(0).max(4294967295), - type: z.enum(["range_to"]), - }), - z.object({ - end: z.number().min(0).max(4294967295), - start: z.number().min(0).max(4294967295), - type: z.enum(["range"]), - }), - z.object({ - start: z.number().min(0).max(4294967295), - type: z.enum(["range_from"]), - }), - ]), -); - -/** - * A type storing a range over `T`. - * - * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. - */ -export const BinRangeuint64 = z.preprocess( - processResponseBody, - z.union([ - z.object({ end: z.number().min(0), type: z.enum(["range_to"]) }), - z.object({ - end: z.number().min(0), - start: z.number().min(0), - type: z.enum(["range"]), - }), - z.object({ start: z.number().min(0), type: z.enum(["range_from"]) }), - ]), -); - -/** - * A type storing a range over `T`. - * - * This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively. - */ -export const BinRangeuint8 = z.preprocess( - processResponseBody, - z.union([ - z.object({ end: z.number().min(0).max(255), type: z.enum(["range_to"]) }), - z.object({ - end: z.number().min(0).max(255), - start: z.number().min(0).max(255), - type: z.enum(["range"]), - }), - z.object({ - start: z.number().min(0).max(255), - type: z.enum(["range_from"]), - }), - ]), -); - -/** - * Type storing bin edges and a count of samples within it. - */ -export const Bindouble = z.preprocess( - processResponseBody, - z.object({ count: z.number().min(0), range: BinRangedouble }), -); - -/** - * Type storing bin edges and a count of samples within it. - */ -export const Binfloat = z.preprocess( - processResponseBody, - z.object({ count: z.number().min(0), range: BinRangefloat }), -); - -/** - * Type storing bin edges and a count of samples within it. - */ -export const Binint16 = z.preprocess( - processResponseBody, - z.object({ count: z.number().min(0), range: BinRangeint16 }), -); - -/** - * Type storing bin edges and a count of samples within it. - */ -export const Binint32 = z.preprocess( - processResponseBody, - z.object({ count: z.number().min(0), range: BinRangeint32 }), -); - -/** - * Type storing bin edges and a count of samples within it. - */ -export const Binint64 = z.preprocess( - processResponseBody, - z.object({ count: z.number().min(0), range: BinRangeint64 }), -); - -/** - * Type storing bin edges and a count of samples within it. - */ -export const Binint8 = z.preprocess( - processResponseBody, - z.object({ count: z.number().min(0), range: BinRangeint8 }), -); - -/** - * Type storing bin edges and a count of samples within it. - */ -export const Binuint16 = z.preprocess( - processResponseBody, - z.object({ count: z.number().min(0), range: BinRangeuint16 }), -); - -/** - * Type storing bin edges and a count of samples within it. - */ -export const Binuint32 = z.preprocess( - processResponseBody, - z.object({ count: z.number().min(0), range: BinRangeuint32 }), -); - -/** - * Type storing bin edges and a count of samples within it. - */ -export const Binuint64 = z.preprocess( - processResponseBody, - z.object({ count: z.number().min(0), range: BinRangeuint64 }), -); - -/** - * Type storing bin edges and a count of samples within it. - */ -export const Binuint8 = z.preprocess( - processResponseBody, - z.object({ count: z.number().min(0), range: BinRangeuint8 }), -); - -/** - * disk block size in bytes - */ -export const BlockSize = z.preprocess( - processResponseBody, - IntEnum([512, 2048, 4096] as const), -); - -/** - * Byte count to express memory or storage capacity. - */ -export const ByteCount = z.preprocess(processResponseBody, z.number().min(0)); - -/** - * The service intended to use this certificate. - */ -export const ServiceUsingCertificate = z.preprocess( - processResponseBody, - z.enum(["external_api"]), -); - -/** - * View of a Certificate - */ -export const Certificate = z.preprocess( - processResponseBody, - z.object({ - cert: z.string(), - description: z.string(), - id: z.uuid(), - name: Name, - service: ServiceUsingCertificate, - timeCreated: z.coerce.date(), - timeModified: z.coerce.date(), - }), -); - -/** - * Create-time parameters for a `Certificate` - */ -export const CertificateCreate = z.preprocess( - processResponseBody, - z.object({ - cert: z.string(), - description: z.string(), - key: z.string(), - name: Name, - service: ServiceUsingCertificate, - }), -); - -/** - * A single page of results - */ -export const CertificateResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: Certificate.array(), - nextPage: z.string().nullable().optional(), - }), -); - -/** - * View of a console session - */ -export const ConsoleSession = z.preprocess( - processResponseBody, - z.object({ - id: z.uuid(), - timeCreated: z.coerce.date(), - timeLastUsed: z.coerce.date(), - }), -); - -/** - * A single page of results - */ -export const ConsoleSessionResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: ConsoleSession.array(), - nextPage: z.string().nullable().optional(), - }), -); - -/** - * A cumulative or counter data type. - */ -export const Cumulativedouble = z.preprocess( - processResponseBody, - z.object({ startTime: z.coerce.date(), value: z.number() }), -); - -/** - * A cumulative or counter data type. - */ -export const Cumulativefloat = z.preprocess( - processResponseBody, - z.object({ startTime: z.coerce.date(), value: z.number() }), -); - -/** - * A cumulative or counter data type. - */ -export const Cumulativeint64 = z.preprocess( - processResponseBody, - z.object({ startTime: z.coerce.date(), value: z.number() }), -); - -/** - * A cumulative or counter data type. - */ -export const Cumulativeuint64 = z.preprocess( - processResponseBody, - z.object({ startTime: z.coerce.date(), value: z.number().min(0) }), -); - -/** - * Info about the current user - */ -export const CurrentUser = z.preprocess( - processResponseBody, - z.object({ - displayName: z.string(), - id: z.uuid(), - siloId: z.uuid(), - siloName: Name, - }), -); - -/** - * Structure for estimating the p-quantile of a population. - * - * This is based on the P² algorithm for estimating quantiles using constant space. - * - * The algorithm consists of maintaining five markers: the minimum, the p/2-, p-, and (1 + p)/2 quantiles, and the maximum. - */ -export const Quantile = z.preprocess( - processResponseBody, - z.object({ - desiredMarkerPositions: z.number().array(), - markerHeights: z.number().array(), - markerPositions: z.number().min(0).array(), - p: z.number(), - }), -); - -/** - * Histogram metric - * - * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. - * - * Note that any gaps, unsorted bins, or non-finite values will result in an error. - */ -export const Histogramint8 = z.preprocess( - processResponseBody, - z.object({ - bins: Binint8.array(), - max: z.number().min(-127).max(127), - min: z.number().min(-127).max(127), - nSamples: z.number().min(0), - p50: Quantile, - p90: Quantile, - p99: Quantile, - squaredMean: z.number(), - startTime: z.coerce.date(), - sumOfSamples: z.number(), - }), -); - -/** - * Histogram metric - * - * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. - * - * Note that any gaps, unsorted bins, or non-finite values will result in an error. - */ -export const Histogramuint8 = z.preprocess( - processResponseBody, - z.object({ - bins: Binuint8.array(), - max: z.number().min(0).max(255), - min: z.number().min(0).max(255), - nSamples: z.number().min(0), - p50: Quantile, - p90: Quantile, - p99: Quantile, - squaredMean: z.number(), - startTime: z.coerce.date(), - sumOfSamples: z.number(), - }), -); - -/** - * Histogram metric - * - * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. - * - * Note that any gaps, unsorted bins, or non-finite values will result in an error. - */ -export const Histogramint16 = z.preprocess( - processResponseBody, - z.object({ - bins: Binint16.array(), - max: z.number().min(-32767).max(32767), - min: z.number().min(-32767).max(32767), - nSamples: z.number().min(0), - p50: Quantile, - p90: Quantile, - p99: Quantile, - squaredMean: z.number(), - startTime: z.coerce.date(), - sumOfSamples: z.number(), - }), -); - -/** - * Histogram metric - * - * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. - * - * Note that any gaps, unsorted bins, or non-finite values will result in an error. - */ -export const Histogramuint16 = z.preprocess( - processResponseBody, - z.object({ - bins: Binuint16.array(), - max: z.number().min(0).max(65535), - min: z.number().min(0).max(65535), - nSamples: z.number().min(0), - p50: Quantile, - p90: Quantile, - p99: Quantile, - squaredMean: z.number(), - startTime: z.coerce.date(), - sumOfSamples: z.number(), - }), -); - -/** - * Histogram metric - * - * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. - * - * Note that any gaps, unsorted bins, or non-finite values will result in an error. - */ -export const Histogramint32 = z.preprocess( - processResponseBody, - z.object({ - bins: Binint32.array(), - max: z.number().min(-2147483647).max(2147483647), - min: z.number().min(-2147483647).max(2147483647), - nSamples: z.number().min(0), - p50: Quantile, - p90: Quantile, - p99: Quantile, - squaredMean: z.number(), - startTime: z.coerce.date(), - sumOfSamples: z.number(), - }), -); - -/** - * Histogram metric - * - * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. - * - * Note that any gaps, unsorted bins, or non-finite values will result in an error. - */ -export const Histogramuint32 = z.preprocess( - processResponseBody, - z.object({ - bins: Binuint32.array(), - max: z.number().min(0).max(4294967295), - min: z.number().min(0).max(4294967295), - nSamples: z.number().min(0), - p50: Quantile, - p90: Quantile, - p99: Quantile, - squaredMean: z.number(), - startTime: z.coerce.date(), - sumOfSamples: z.number(), - }), -); - -/** - * Histogram metric - * - * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. - * - * Note that any gaps, unsorted bins, or non-finite values will result in an error. - */ -export const Histogramint64 = z.preprocess( - processResponseBody, - z.object({ - bins: Binint64.array(), - max: z.number(), - min: z.number(), - nSamples: z.number().min(0), - p50: Quantile, - p90: Quantile, - p99: Quantile, - squaredMean: z.number(), - startTime: z.coerce.date(), - sumOfSamples: z.number(), - }), -); - -/** - * Histogram metric - * - * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. - * - * Note that any gaps, unsorted bins, or non-finite values will result in an error. - */ -export const Histogramuint64 = z.preprocess( - processResponseBody, - z.object({ - bins: Binuint64.array(), - max: z.number().min(0), - min: z.number().min(0), - nSamples: z.number().min(0), - p50: Quantile, - p90: Quantile, - p99: Quantile, - squaredMean: z.number(), - startTime: z.coerce.date(), - sumOfSamples: z.number(), - }), -); - -/** - * Histogram metric - * - * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. - * - * Note that any gaps, unsorted bins, or non-finite values will result in an error. - */ -export const Histogramfloat = z.preprocess( - processResponseBody, - z.object({ - bins: Binfloat.array(), - max: z.number(), - min: z.number(), - nSamples: z.number().min(0), - p50: Quantile, - p90: Quantile, - p99: Quantile, - squaredMean: z.number(), - startTime: z.coerce.date(), - sumOfSamples: z.number(), - }), -); - -/** - * Histogram metric - * - * A histogram maintains the count of any number of samples, over a set of bins. Bins are specified on construction via their _left_ edges, inclusive. There can't be any "gaps" in the bins, and an additional bin may be added to the left, right, or both so that the bins extend to the entire range of the support. - * - * Note that any gaps, unsorted bins, or non-finite values will result in an error. - */ -export const Histogramdouble = z.preprocess( - processResponseBody, - z.object({ - bins: Bindouble.array(), - max: z.number(), - min: z.number(), - nSamples: z.number().min(0), - p50: Quantile, - p90: Quantile, - p99: Quantile, - squaredMean: z.number(), - startTime: z.coerce.date(), - sumOfSamples: z.number(), - }), -); - -/** - * The type of an individual datum of a metric. - */ -export const DatumType = z.preprocess( - processResponseBody, - z.enum([ - "bool", - "i8", - "u8", - "i16", - "u16", - "i32", - "u32", - "i64", - "u64", - "f32", - "f64", - "string", - "bytes", - "cumulative_i64", - "cumulative_u64", - "cumulative_f32", - "cumulative_f64", - "histogram_i8", - "histogram_u8", - "histogram_i16", - "histogram_u16", - "histogram_i32", - "histogram_u32", - "histogram_i64", - "histogram_u64", - "histogram_f32", - "histogram_f64", - ]), -); - -export const MissingDatum = z.preprocess( - processResponseBody, - z.object({ - datumType: DatumType, - startTime: z.coerce.date().nullable().optional(), - }), -); - -/** - * A `Datum` is a single sampled data point from a metric. - */ -export const Datum = z.preprocess( - processResponseBody, - z.union([ - z.object({ datum: SafeBoolean, type: z.enum(["bool"]) }), - z.object({ datum: z.number().min(-127).max(127), type: z.enum(["i8"]) }), - z.object({ datum: z.number().min(0).max(255), type: z.enum(["u8"]) }), - z.object({ - datum: z.number().min(-32767).max(32767), - type: z.enum(["i16"]), - }), - z.object({ datum: z.number().min(0).max(65535), type: z.enum(["u16"]) }), - z.object({ - datum: z.number().min(-2147483647).max(2147483647), - type: z.enum(["i32"]), - }), - z.object({ - datum: z.number().min(0).max(4294967295), - type: z.enum(["u32"]), - }), - z.object({ datum: z.number(), type: z.enum(["i64"]) }), - z.object({ datum: z.number().min(0), type: z.enum(["u64"]) }), - z.object({ datum: z.number(), type: z.enum(["f32"]) }), - z.object({ datum: z.number(), type: z.enum(["f64"]) }), - z.object({ datum: z.string(), type: z.enum(["string"]) }), - z.object({ - datum: z.number().min(0).max(255).array(), - type: z.enum(["bytes"]), - }), - z.object({ datum: Cumulativeint64, type: z.enum(["cumulative_i64"]) }), - z.object({ datum: Cumulativeuint64, type: z.enum(["cumulative_u64"]) }), - z.object({ datum: Cumulativefloat, type: z.enum(["cumulative_f32"]) }), - z.object({ datum: Cumulativedouble, type: z.enum(["cumulative_f64"]) }), - z.object({ datum: Histogramint8, type: z.enum(["histogram_i8"]) }), - z.object({ datum: Histogramuint8, type: z.enum(["histogram_u8"]) }), - z.object({ datum: Histogramint16, type: z.enum(["histogram_i16"]) }), - z.object({ datum: Histogramuint16, type: z.enum(["histogram_u16"]) }), - z.object({ datum: Histogramint32, type: z.enum(["histogram_i32"]) }), - z.object({ datum: Histogramuint32, type: z.enum(["histogram_u32"]) }), - z.object({ datum: Histogramint64, type: z.enum(["histogram_i64"]) }), - z.object({ datum: Histogramuint64, type: z.enum(["histogram_u64"]) }), - z.object({ datum: Histogramfloat, type: z.enum(["histogram_f32"]) }), - z.object({ datum: Histogramdouble, type: z.enum(["histogram_f64"]) }), - z.object({ datum: MissingDatum, type: z.enum(["missing"]) }), - ]), -); - -export const DerEncodedKeyPair = z.preprocess( - processResponseBody, - z.object({ privateKey: z.string(), publicCert: z.string() }), -); - -/** - * View of a device access token - */ -export const DeviceAccessToken = z.preprocess( - processResponseBody, - z.object({ - id: z.uuid(), - timeCreated: z.coerce.date(), - timeExpires: z.coerce.date().nullable().optional(), - }), -); - -export const DeviceAccessTokenRequest = z.preprocess( - processResponseBody, - z.object({ - clientId: z.uuid(), - deviceCode: z.string(), - grantType: z.string(), - }), -); - -/** - * A single page of results - */ -export const DeviceAccessTokenResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: DeviceAccessToken.array(), - nextPage: z.string().nullable().optional(), - }), -); - -export const DeviceAuthRequest = z.preprocess( - processResponseBody, - z.object({ - clientId: z.uuid(), - ttlSeconds: z.number().min(1).max(4294967295).nullable().optional(), - }), -); - -export const DeviceAuthVerify = z.preprocess( - processResponseBody, - z.object({ userCode: z.string() }), -); - -export const Digest = z.preprocess( - processResponseBody, - z.object({ type: z.enum(["sha256"]), value: z.string() }), -); - -/** - * State of a Disk - */ -export const DiskState = z.preprocess( - processResponseBody, - z.union([ - z.object({ state: z.enum(["creating"]) }), - z.object({ state: z.enum(["detached"]) }), - z.object({ state: z.enum(["import_ready"]) }), - z.object({ state: z.enum(["importing_from_url"]) }), - z.object({ state: z.enum(["importing_from_bulk_writes"]) }), - z.object({ state: z.enum(["finalizing"]) }), - z.object({ state: z.enum(["maintenance"]) }), - z.object({ instance: z.uuid(), state: z.enum(["attaching"]) }), - z.object({ instance: z.uuid(), state: z.enum(["attached"]) }), - z.object({ instance: z.uuid(), state: z.enum(["detaching"]) }), - z.object({ state: z.enum(["destroyed"]) }), - z.object({ state: z.enum(["faulted"]) }), - ]), -); - -/** - * View of a Disk - */ -export const Disk = z.preprocess( - processResponseBody, - z.object({ - blockSize: ByteCount, - description: z.string(), - devicePath: z.string(), - id: z.uuid(), - imageId: z.uuid().nullable().optional(), - name: Name, - projectId: z.uuid(), - size: ByteCount, - snapshotId: z.uuid().nullable().optional(), - state: DiskState, - timeCreated: z.coerce.date(), - timeModified: z.coerce.date(), - }), -); - -/** - * Different sources for a disk - */ -export const DiskSource = z.preprocess( - processResponseBody, - z.union([ - z.object({ blockSize: BlockSize, type: z.enum(["blank"]) }), - z.object({ snapshotId: z.uuid(), type: z.enum(["snapshot"]) }), - z.object({ imageId: z.uuid(), type: z.enum(["image"]) }), - z.object({ blockSize: BlockSize, type: z.enum(["importing_blocks"]) }), - ]), -); - -/** - * Create-time parameters for a `Disk` - */ -export const DiskCreate = z.preprocess( - processResponseBody, - z.object({ - description: z.string(), - diskSource: DiskSource, - name: Name, - size: ByteCount, - }), -); - -export const DiskPath = z.preprocess( - processResponseBody, - z.object({ disk: NameOrId }), -); - -/** - * A single page of results - */ -export const DiskResultsPage = z.preprocess( - processResponseBody, - z.object({ items: Disk.array(), nextPage: z.string().nullable().optional() }), -); - -/** - * A distribution is a sequence of bins and counts in those bins, and some statistical information tracked to compute the mean, standard deviation, and quantile estimates. - * - * Min, max, and the p-* quantiles are treated as optional due to the possibility of distribution operations, like subtraction. - */ -export const Distributiondouble = z.preprocess( - processResponseBody, - z.object({ - bins: z.number().array(), - counts: z.number().min(0).array(), - max: z.number().nullable().optional(), - min: z.number().nullable().optional(), - p50: Quantile.nullable().optional(), - p90: Quantile.nullable().optional(), - p99: Quantile.nullable().optional(), - squaredMean: z.number(), - sumOfSamples: z.number(), - }), -); - -/** - * A distribution is a sequence of bins and counts in those bins, and some statistical information tracked to compute the mean, standard deviation, and quantile estimates. - * - * Min, max, and the p-* quantiles are treated as optional due to the possibility of distribution operations, like subtraction. - */ -export const Distributionint64 = z.preprocess( - processResponseBody, - z.object({ - bins: z.number().array(), - counts: z.number().min(0).array(), - max: z.number().nullable().optional(), - min: z.number().nullable().optional(), - p50: Quantile.nullable().optional(), - p90: Quantile.nullable().optional(), - p99: Quantile.nullable().optional(), - squaredMean: z.number(), - sumOfSamples: z.number(), - }), -); - -/** - * Parameters for creating an ephemeral IP address for an instance. - */ -export const EphemeralIpCreate = z.preprocess( - processResponseBody, - z.object({ pool: NameOrId.nullable().optional() }), -); - -/** - * Error information from a response. - */ -export const Error = z.preprocess( - processResponseBody, - z.object({ - errorCode: z.string().optional(), - message: z.string(), - requestId: z.string(), - }), -); - -export const ExternalIp = z.preprocess( - processResponseBody, - z.union([ - z.object({ - firstPort: z.number().min(0).max(65535), - ip: z.ipv4(), - ipPoolId: z.uuid(), - kind: z.enum(["snat"]), - lastPort: z.number().min(0).max(65535), - }), - z.object({ ip: z.ipv4(), ipPoolId: z.uuid(), kind: z.enum(["ephemeral"]) }), - z.object({ - description: z.string(), - id: z.uuid(), - instanceId: z.uuid().nullable().optional(), - ip: z.ipv4(), - ipPoolId: z.uuid(), - kind: z.enum(["floating"]), - name: Name, - projectId: z.uuid(), - timeCreated: z.coerce.date(), - timeModified: z.coerce.date(), - }), - ]), -); - -/** - * Parameters for creating an external IP address for instances. - */ -export const ExternalIpCreate = z.preprocess( - processResponseBody, - z.union([ - z.object({ - pool: NameOrId.nullable().optional(), - type: z.enum(["ephemeral"]), - }), - z.object({ floatingIp: NameOrId, type: z.enum(["floating"]) }), - ]), -); - -/** - * A single page of results - */ -export const ExternalIpResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: ExternalIp.array(), - nextPage: z.string().nullable().optional(), - }), -); - -/** - * The `FieldType` identifies the data type of a target or metric field. - */ -export const FieldType = z.preprocess( - processResponseBody, - z.enum([ - "string", - "i8", - "u8", - "i16", - "u16", - "i32", - "u32", - "i64", - "u64", - "ip_addr", - "uuid", - "bool", - ]), -); - -/** - * The source from which a field is derived, the target or metric. - */ -export const FieldSource = z.preprocess( - processResponseBody, - z.enum(["target", "metric"]), -); - -/** - * The name and type information for a field of a timeseries schema. - */ -export const FieldSchema = z.preprocess( - processResponseBody, - z.object({ - description: z.string(), - fieldType: FieldType, - name: z.string(), - source: FieldSource, - }), -); - -/** - * The `FieldValue` contains the value of a target or metric field. - */ -export const FieldValue = z.preprocess( - processResponseBody, - z.union([ - z.object({ type: z.enum(["string"]), value: z.string() }), - z.object({ type: z.enum(["i8"]), value: z.number().min(-127).max(127) }), - z.object({ type: z.enum(["u8"]), value: z.number().min(0).max(255) }), - z.object({ - type: z.enum(["i16"]), - value: z.number().min(-32767).max(32767), - }), - z.object({ type: z.enum(["u16"]), value: z.number().min(0).max(65535) }), - z.object({ - type: z.enum(["i32"]), - value: z.number().min(-2147483647).max(2147483647), - }), - z.object({ - type: z.enum(["u32"]), - value: z.number().min(0).max(4294967295), - }), - z.object({ type: z.enum(["i64"]), value: z.number() }), - z.object({ type: z.enum(["u64"]), value: z.number().min(0) }), - z.object({ type: z.enum(["ip_addr"]), value: z.ipv4() }), - z.object({ type: z.enum(["uuid"]), value: z.uuid() }), - z.object({ type: z.enum(["bool"]), value: SafeBoolean }), - ]), -); - -/** - * Parameters for finalizing a disk - */ -export const FinalizeDisk = z.preprocess( - processResponseBody, - z.object({ snapshotName: Name.nullable().optional() }), -); - -export const FleetRole = z.preprocess( - processResponseBody, - z.enum(["admin", "collaborator", "viewer"]), -); - -/** - * Describes what kind of identity is described by an id - */ -export const IdentityType = z.preprocess( - processResponseBody, - z.enum(["silo_user", "silo_group"]), -); - -/** - * Describes the assignment of a particular role on a particular resource to a particular identity (user, group, etc.) - * - * The resource is not part of this structure. Rather, `RoleAssignment`s are put into a `Policy` and that Policy is applied to a particular resource. - */ -export const FleetRoleRoleAssignment = z.preprocess( - processResponseBody, - z.object({ - identityId: z.uuid(), - identityType: IdentityType, - roleName: FleetRole, - }), -); - -/** - * Policy for a particular resource - * - * Note that the Policy only describes access granted explicitly for this resource. The policies of parent resources can also cause a user to have access to this resource. - */ -export const FleetRolePolicy = z.preprocess( - processResponseBody, - z.object({ roleAssignments: FleetRoleRoleAssignment.array() }), -); - -/** - * A Floating IP is a well-known IP address which can be attached and detached from instances. - */ -export const FloatingIp = z.preprocess( - processResponseBody, - z.object({ - description: z.string(), - id: z.uuid(), - instanceId: z.uuid().nullable().optional(), - ip: z.ipv4(), - ipPoolId: z.uuid(), - name: Name, - projectId: z.uuid(), - timeCreated: z.coerce.date(), - timeModified: z.coerce.date(), - }), -); - -/** - * The type of resource that a floating IP is attached to - */ -export const FloatingIpParentKind = z.preprocess( - processResponseBody, - z.enum(["instance"]), -); - -/** - * Parameters for attaching a floating IP address to another resource - */ -export const FloatingIpAttach = z.preprocess( - processResponseBody, - z.object({ kind: FloatingIpParentKind, parent: NameOrId }), -); - -/** - * Parameters for creating a new floating IP address for instances. - */ -export const FloatingIpCreate = z.preprocess( - processResponseBody, - z.object({ - description: z.string(), - ip: z.ipv4().nullable().optional(), - name: Name, - pool: NameOrId.nullable().optional(), - }), -); - -/** - * A single page of results - */ -export const FloatingIpResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: FloatingIp.array(), - nextPage: z.string().nullable().optional(), - }), -); - -/** - * Updateable identity-related parameters - */ -export const FloatingIpUpdate = z.preprocess( - processResponseBody, - z.object({ - description: z.string().nullable().optional(), - name: Name.nullable().optional(), - }), -); - -/** - * View of a Group - */ -export const Group = z.preprocess( - processResponseBody, - z.object({ displayName: z.string(), id: z.uuid(), siloId: z.uuid() }), -); - -/** - * A single page of results - */ -export const GroupResultsPage = z.preprocess( - processResponseBody, - z.object({ - items: Group.array(), - nextPage: z.string().nullable().optional(), - }), -); - -/** - * An RFC-1035-compliant hostname - * - * A hostname identifies a host on a network, and is usually a dot-delimited sequence of labels, where each label contains only letters, digits, or the hyphen. See RFCs 1035 and 952 for more details. - */ -export const Hostname = z.preprocess( - processResponseBody, - z - .string() - .min(1) - .max(253) - .regex( - /^([a-zA-Z0-9]+[a-zA-Z0-9\-]*(? Date: Fri, 15 Aug 2025 18:11:45 -0500 Subject: [PATCH 4/4] npm version minor --- oxide-openapi-gen-ts/package-lock.json | 4 ++-- oxide-openapi-gen-ts/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/oxide-openapi-gen-ts/package-lock.json b/oxide-openapi-gen-ts/package-lock.json index d429131..35de523 100644 --- a/oxide-openapi-gen-ts/package-lock.json +++ b/oxide-openapi-gen-ts/package-lock.json @@ -1,12 +1,12 @@ { "name": "@oxide/openapi-gen-ts", - "version": "0.8.1", + "version": "0.9.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@oxide/openapi-gen-ts", - "version": "0.8.1", + "version": "0.9.0", "license": "MPL-2.0", "dependencies": { "minimist": "^1.2.8", diff --git a/oxide-openapi-gen-ts/package.json b/oxide-openapi-gen-ts/package.json index 1bbde6f..15455a4 100644 --- a/oxide-openapi-gen-ts/package.json +++ b/oxide-openapi-gen-ts/package.json @@ -1,6 +1,6 @@ { "name": "@oxide/openapi-gen-ts", - "version": "0.8.1", + "version": "0.9.0", "description": "OpenAPI client generator used to generate Oxide TypeScript SDK", "keywords": [ "oxide",