From 9406dfbff43bd19d79a8353f196a38196c77800e Mon Sep 17 00:00:00 2001 From: Charlie Park Date: Mon, 4 Dec 2023 16:06:38 -0800 Subject: [PATCH] Update generated files to match latest omicron version (#226) * Updated OMICRON_VERSION to reflect most recent sha * Autogenerate config update --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- OMICRON_VERSION | 2 +- client/Api.ts | 1296 ++++++++++++++++++++++++++-------------- client/msw-handlers.ts | 289 ++++----- client/type-test.ts | 79 ++- client/validate.ts | 1071 ++++++++++++++++++++++++--------- 5 files changed, 1851 insertions(+), 886 deletions(-) diff --git a/OMICRON_VERSION b/OMICRON_VERSION index 297bb1d..d738876 100644 --- a/OMICRON_VERSION +++ b/OMICRON_VERSION @@ -1 +1 @@ -8f8c7002cf0296ddc73432522b6aa19f38ab8fd5 +9b666e73dec06f2a645a714cdfbb21d63a2f3504 diff --git a/client/Api.ts b/client/Api.ts index 9ff827d..bbb1d6f 100644 --- a/client/Api.ts +++ b/client/Api.ts @@ -156,18 +156,181 @@ export type AddressLotResultsPage = { */ export type Baseboard = { part: string; revision: number; serial: string }; +/** + * Represents a BGP announce set by id. The id can be used with other API calls to view and manage the announce set. + */ +export type BgpAnnounceSet = { + /** human-readable free-form text about a resource */ + description: string; + /** unique, immutable, system-controlled identifier for each resource */ + id: string; + /** unique, mutable, user-controlled identifier for each resource */ + name: Name; + /** timestamp when this resource was created */ + timeCreated: Date; + /** timestamp when this resource was last modified */ + timeModified: Date; +}; + +/** + * A BGP announcement tied to a particular address lot block. + */ +export type BgpAnnouncementCreate = { + /** Address lot this announcement is drawn from. */ + addressLotBlock: NameOrId; + /** The network being announced. */ + network: IpNet; +}; + +/** + * Parameters for creating a named set of BGP announcements. + */ +export type BgpAnnounceSetCreate = { + /** The announcements in this set. */ + announcement: BgpAnnouncementCreate[]; + description: string; + name: Name; +}; + +/** + * A BGP announcement tied to an address lot block. + */ +export type BgpAnnouncement = { + /** The address block the IP network being announced is drawn from. */ + addressLotBlockId: string; + /** The id of the set this announcement is a part of. */ + announceSetId: string; + /** The IP network being announced. */ + network: IpNet; +}; + +/** + * A base BGP configuration. + */ +export type BgpConfig = { + /** The autonomous system number of this BGP configuration. */ + asn: number; + /** human-readable free-form text about a resource */ + description: string; + /** unique, immutable, system-controlled identifier for each resource */ + id: string; + /** unique, mutable, user-controlled identifier for each resource */ + name: Name; + /** timestamp when this resource was created */ + timeCreated: Date; + /** timestamp when this resource was last modified */ + timeModified: Date; + /** Optional virtual routing and forwarding identifier for this BGP configuration. */ + vrf?: string; +}; + +/** + * Parameters for creating a BGP configuration. This includes and autonomous system number (ASN) and a virtual routing and forwarding (VRF) identifier. + */ +export type BgpConfigCreate = { + /** The autonomous system number of this BGP configuration. */ + asn: number; + bgpAnnounceSetId: NameOrId; + description: string; + name: Name; + /** Optional virtual routing and forwarding identifier for this BGP configuration. */ + vrf?: Name; +}; + +/** + * A single page of results + */ +export type BgpConfigResultsPage = { + /** list of items on this page of results */ + items: BgpConfig[]; + /** token used to fetch the next page of results (if any) */ + nextPage?: string; +}; + +/** + * Identifies switch physical location + */ +export type SwitchLocation = + /** Switch in upper slot */ + | "switch0" + /** Switch in lower slot */ + | "switch1"; + +/** + * A route imported from a BGP peer. + */ +export type BgpImportedRouteIpv4 = { + /** BGP identifier of the originating router. */ + id: number; + /** The nexthop the prefix is reachable through. */ + nexthop: string; + /** The destination network prefix. */ + prefix: Ipv4Net; + /** Switch the route is imported into. */ + switch: SwitchLocation; +}; + /** * 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 type BgpPeerConfig = { +export type BgpPeer = { /** The address of the host to peer with. */ addr: string; /** The set of announcements advertised by the peer. */ bgpAnnounceSet: NameOrId; /** The global BGP configuration used for establishing a session with this peer. */ bgpConfig: NameOrId; + /** How long to to wait between TCP connection retries (seconds). */ + connectRetry: number; + /** How long to delay sending an open request after establishing a TCP session (seconds). */ + delayOpen: number; + /** How long to hold peer connections between keppalives (seconds). */ + holdTime: number; + /** How long to hold a peer in idle before attempting a new session (seconds). */ + idleHoldTime: number; /** The name of interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface. */ interfaceName: string; + /** How often to send keepalive requests (seconds). */ + keepalive: number; +}; + +export type BgpPeerConfig = { peers: BgpPeer[] }; + +/** + * The current state of a BGP peer. + */ +export type BgpPeerState = + /** Initial state. Refuse all incomming BGP connections. No resources allocated to peer. */ + | "idle" + /** Waiting for the TCP connection to be completed. */ + | "connect" + /** Trying to acquire peer by listening for and accepting a TCP connection. */ + | "active" + /** Waiting for open message from peer. */ + | "open_sent" + /** Waiting for keepaliave or notification from peer. */ + | "open_confirm" + /** Synchronizing with peer. */ + | "session_setup" + /** Session established. Able to exchange update, notification and keepliave messages with peers. */ + | "established"; + +/** + * The current status of a BGP peer. + */ +export type BgpPeerStatus = { + /** IP address of the peer. */ + addr: string; + /** Local autonomous system number. */ + localAsn: number; + /** Remote autonomous system number. */ + remoteAsn: number; + /** State of the peer. */ + state: BgpPeerState; + /** Time of last state change. */ + stateDurationMillis: number; + /** Switch with the peer session. */ + switch: SwitchLocation; }; /** @@ -183,6 +346,45 @@ export type BinRangedouble = /** A range bounded inclusively below and unbounded above, `start..`. */ | { start: number; type: "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 type BinRangefloat = + /** A range unbounded below and exclusively above, `..end`. */ + | { end: number; type: "range_to" } + /** A range bounded inclusively below and exclusively above, `start..end`. */ + | { end: number; start: number; type: "range" } + /** A range bounded inclusively below and unbounded above, `start..`. */ + | { start: number; type: "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 type BinRangeint16 = + /** A range unbounded below and exclusively above, `..end`. */ + | { end: number; type: "range_to" } + /** A range bounded inclusively below and exclusively above, `start..end`. */ + | { end: number; start: number; type: "range" } + /** A range bounded inclusively below and unbounded above, `start..`. */ + | { start: number; type: "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 type BinRangeint32 = + /** A range unbounded below and exclusively above, `..end`. */ + | { end: number; type: "range_to" } + /** A range bounded inclusively below and exclusively above, `start..end`. */ + | { end: number; start: number; type: "range" } + /** A range bounded inclusively below and unbounded above, `start..`. */ + | { start: number; type: "range_from" }; + /** * A type storing a range over `T`. * @@ -196,6 +398,71 @@ export type BinRangeint64 = /** A range bounded inclusively below and unbounded above, `start..`. */ | { start: number; type: "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 type BinRangeint8 = + /** A range unbounded below and exclusively above, `..end`. */ + | { end: number; type: "range_to" } + /** A range bounded inclusively below and exclusively above, `start..end`. */ + | { end: number; start: number; type: "range" } + /** A range bounded inclusively below and unbounded above, `start..`. */ + | { start: number; type: "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 type BinRangeuint16 = + /** A range unbounded below and exclusively above, `..end`. */ + | { end: number; type: "range_to" } + /** A range bounded inclusively below and exclusively above, `start..end`. */ + | { end: number; start: number; type: "range" } + /** A range bounded inclusively below and unbounded above, `start..`. */ + | { start: number; type: "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 type BinRangeuint32 = + /** A range unbounded below and exclusively above, `..end`. */ + | { end: number; type: "range_to" } + /** A range bounded inclusively below and exclusively above, `start..end`. */ + | { end: number; start: number; type: "range" } + /** A range bounded inclusively below and unbounded above, `start..`. */ + | { start: number; type: "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 type BinRangeuint64 = + /** A range unbounded below and exclusively above, `..end`. */ + | { end: number; type: "range_to" } + /** A range bounded inclusively below and exclusively above, `start..end`. */ + | { end: number; start: number; type: "range" } + /** A range bounded inclusively below and unbounded above, `start..`. */ + | { start: number; type: "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 type BinRangeuint8 = + /** A range unbounded below and exclusively above, `..end`. */ + | { end: number; type: "range_to" } + /** A range bounded inclusively below and exclusively above, `start..end`. */ + | { end: number; start: number; type: "range" } + /** A range bounded inclusively below and unbounded above, `start..`. */ + | { start: number; type: "range_from" }; + /** * Type storing bin edges and a count of samples within it. */ @@ -206,6 +473,36 @@ export type Bindouble = { range: BinRangedouble; }; +/** + * Type storing bin edges and a count of samples within it. + */ +export type Binfloat = { + /** The total count of samples in this bin. */ + count: number; + /** The range of the support covered by this bin. */ + range: BinRangefloat; +}; + +/** + * Type storing bin edges and a count of samples within it. + */ +export type Binint16 = { + /** The total count of samples in this bin. */ + count: number; + /** The range of the support covered by this bin. */ + range: BinRangeint16; +}; + +/** + * Type storing bin edges and a count of samples within it. + */ +export type Binint32 = { + /** The total count of samples in this bin. */ + count: number; + /** The range of the support covered by this bin. */ + range: BinRangeint32; +}; + /** * Type storing bin edges and a count of samples within it. */ @@ -216,6 +513,56 @@ export type Binint64 = { range: BinRangeint64; }; +/** + * Type storing bin edges and a count of samples within it. + */ +export type Binint8 = { + /** The total count of samples in this bin. */ + count: number; + /** The range of the support covered by this bin. */ + range: BinRangeint8; +}; + +/** + * Type storing bin edges and a count of samples within it. + */ +export type Binuint16 = { + /** The total count of samples in this bin. */ + count: number; + /** The range of the support covered by this bin. */ + range: BinRangeuint16; +}; + +/** + * Type storing bin edges and a count of samples within it. + */ +export type Binuint32 = { + /** The total count of samples in this bin. */ + count: number; + /** The range of the support covered by this bin. */ + range: BinRangeuint32; +}; + +/** + * Type storing bin edges and a count of samples within it. + */ +export type Binuint64 = { + /** The total count of samples in this bin. */ + count: number; + /** The range of the support covered by this bin. */ + range: BinRangeuint64; +}; + +/** + * Type storing bin edges and a count of samples within it. + */ +export type Binuint8 = { + /** The total count of samples in this bin. */ + count: number; + /** The range of the support covered by this bin. */ + range: BinRangeuint8; +}; + /** * disk block size in bytes */ @@ -263,36 +610,150 @@ export type CertificateCreate = { }; /** - * A single page of results + * A single page of results + */ +export type CertificateResultsPage = { + /** list of items on this page of results */ + items: Certificate[]; + /** token used to fetch the next page of results (if any) */ + nextPage?: string; +}; + +/** + * A cumulative or counter data type. + */ +export type Cumulativedouble = { startTime: Date; value: number }; + +/** + * A cumulative or counter data type. + */ +export type Cumulativefloat = { startTime: Date; value: number }; + +/** + * A cumulative or counter data type. + */ +export type Cumulativeint64 = { startTime: Date; value: number }; + +/** + * A cumulative or counter data type. + */ +export type Cumulativeuint64 = { startTime: Date; value: number }; + +/** + * Info about the current user + */ +export type CurrentUser = { + /** Human-readable name that can identify the user */ + displayName: string; + id: string; + /** Uuid of the silo to which this user belongs */ + siloId: string; + /** Name of the silo to which this user belongs. */ + siloName: Name; +}; + +/** + * 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 type Histogramint8 = { + bins: Binint8[]; + nSamples: number; + startTime: Date; +}; + +/** + * 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 type Histogramuint8 = { + bins: Binuint8[]; + nSamples: number; + startTime: Date; +}; + +/** + * 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 type Histogramint16 = { + bins: Binint16[]; + nSamples: number; + startTime: Date; +}; + +/** + * 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 type Histogramuint16 = { + bins: Binuint16[]; + nSamples: number; + startTime: Date; +}; + +/** + * 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 type CertificateResultsPage = { - /** list of items on this page of results */ - items: Certificate[]; - /** token used to fetch the next page of results (if any) */ - nextPage?: string; +export type Histogramint32 = { + bins: Binint32[]; + nSamples: number; + startTime: Date; }; /** - * A cumulative or counter data type. + * 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 type Cumulativedouble = { startTime: Date; value: number }; +export type Histogramuint32 = { + bins: Binuint32[]; + nSamples: number; + startTime: Date; +}; /** - * A cumulative or counter data type. + * 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 type Cumulativeint64 = { startTime: Date; value: number }; +export type Histogramint64 = { + bins: Binint64[]; + nSamples: number; + startTime: Date; +}; /** - * Info about the current user + * 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 type CurrentUser = { - /** Human-readable name that can identify the user */ - displayName: string; - id: string; - /** Uuid of the silo to which this user belongs */ - siloId: string; - /** Name of the silo to which this user belongs. */ - siloName: Name; +export type Histogramuint64 = { + bins: Binuint64[]; + nSamples: number; + startTime: Date; }; /** @@ -302,8 +763,8 @@ export type CurrentUser = { * * Note that any gaps, unsorted bins, or non-finite values will result in an error. */ -export type Histogramint64 = { - bins: Binint64[]; +export type Histogramfloat = { + bins: Binfloat[]; nSamples: number; startTime: Date; }; @@ -321,19 +782,72 @@ export type Histogramdouble = { startTime: Date; }; +/** + * The type of an individual datum of a metric. + */ +export type DatumType = + | "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 type MissingDatum = { datumType: DatumType; startTime?: Date }; + /** * A `Datum` is a single sampled data point from a metric. */ export type Datum = | { datum: boolean; type: "bool" } + | { datum: number; type: "i8" } + | { datum: number; type: "u8" } + | { datum: number; type: "i16" } + | { datum: number; type: "u16" } + | { datum: number; type: "i32" } + | { datum: number; type: "u32" } | { datum: number; type: "i64" } + | { datum: number; type: "u64" } + | { datum: number; type: "f32" } | { datum: number; type: "f64" } | { datum: string; type: "string" } | { datum: number[]; type: "bytes" } | { datum: Cumulativeint64; type: "cumulative_i64" } + | { datum: Cumulativeuint64; type: "cumulative_u64" } + | { datum: Cumulativefloat; type: "cumulative_f32" } | { datum: Cumulativedouble; type: "cumulative_f64" } + | { datum: Histogramint8; type: "histogram_i8" } + | { datum: Histogramuint8; type: "histogram_u8" } + | { datum: Histogramint16; type: "histogram_i16" } + | { datum: Histogramuint16; type: "histogram_u16" } + | { datum: Histogramint32; type: "histogram_i32" } + | { datum: Histogramuint32; type: "histogram_u32" } | { datum: Histogramint64; type: "histogram_i64" } - | { datum: Histogramdouble; type: "histogram_f64" }; + | { datum: Histogramuint64; type: "histogram_u64" } + | { datum: Histogramfloat; type: "histogram_f32" } + | { datum: Histogramdouble; type: "histogram_f64" } + | { datum: MissingDatum; type: "missing" }; export type DerEncodedKeyPair = { /** request signing private key (base64 encoded der file) */ @@ -393,11 +907,13 @@ export type Disk = { devicePath: string; /** unique, immutable, system-controlled identifier for each resource */ id: string; + /** ID of image from which disk was created, if any */ imageId?: string; /** unique, mutable, user-controlled identifier for each resource */ name: Name; projectId: string; size: ByteCount; + /** ID of snapshot from which disk was created, if any */ snapshotId?: string; state: DiskState; /** timestamp when this resource was created */ @@ -876,8 +1392,10 @@ export type IpPool = { description: string; /** unique, immutable, system-controlled identifier for each resource */ id: string; + isDefault: boolean; /** unique, mutable, user-controlled identifier for each resource */ name: Name; + siloId?: string; /** timestamp when this resource was created */ timeCreated: Date; /** timestamp when this resource was last modified */ @@ -887,7 +1405,14 @@ export type IpPool = { /** * Create-time parameters for an `IpPool` */ -export type IpPoolCreate = { description: string; name: Name }; +export type IpPoolCreate = { + description: string; + /** Whether the IP pool is considered a default pool for its scope (fleet or silo). If a pool is marked default and is associated with a silo, instances created in that silo will draw IPs from that pool unless another pool is specified at instance create time. */ + isDefault?: boolean; + name: Name; + /** If an IP pool is associated with a silo, instance IP allocations in that silo can draw from that pool. */ + silo?: NameOrId; +}; /** * A non-decreasing IPv4 address range, inclusive of both ends. @@ -944,6 +1469,17 @@ export type IpPoolUpdate = { description?: string; name?: Name }; */ export type L4PortRange = string; +/** + * The forward error correction mode of a link. + */ +export type LinkFec = + /** Firecode foward error correction. */ + | "firecode" + /** No forward error correction. */ + | "none" + /** Reed-Solomon forward error correction. */ + | "rs"; + /** * The LLDP configuration associated with a port. LLDP may be either enabled or disabled, if enabled, an LLDP configuration must be provided by name or id. */ @@ -954,14 +1490,43 @@ export type LldpServiceConfig = { lldpConfig?: NameOrId; }; +/** + * The speed of a link. + */ +export type LinkSpeed = + /** Zero gigabits per second. */ + | "speed0_g" + /** 1 gigabit per second. */ + | "speed1_g" + /** 10 gigabits per second. */ + | "speed10_g" + /** 25 gigabits per second. */ + | "speed25_g" + /** 40 gigabits per second. */ + | "speed40_g" + /** 50 gigabits per second. */ + | "speed50_g" + /** 100 gigabits per second. */ + | "speed100_g" + /** 200 gigabits per second. */ + | "speed200_g" + /** 400 gigabits per second. */ + | "speed400_g"; + /** * Switch link configuration. */ export type LinkConfig = { + /** Whether or not to set autonegotiation */ + autoneg: boolean; + /** The forward error correction mode of the link. */ + fec: LinkFec; /** The link-layer discovery protocol (LLDP) configuration for the link. */ lldp: LldpServiceConfig; /** Maximum transmission unit for the link. */ mtu: number; + /** The speed of the link. */ + speed: LinkSpeed; }; /** @@ -1065,6 +1630,13 @@ export type PhysicalDiskResultsPage = { nextPage?: string; }; +export type PingStatus = "ok"; + +export type Ping = { + /** Whether the external API is reachable. Will always be Ok if the endpoint returns anything at all. */ + status: PingStatus; +}; + /** * View of a Project */ @@ -1188,111 +1760,6 @@ export type RouteConfig = { routes: Route[]; }; -/** - * A `RouteDestination` is used to match traffic with a routing rule, on the destination of that traffic. - * - * When traffic is to be sent to a destination that is within a given `RouteDestination`, the corresponding `RouterRoute` applies, and traffic will be forward to the `RouteTarget` for that rule. - */ -export type RouteDestination = - /** Route applies to traffic destined for a specific IP address */ - | { type: "ip"; value: string } - /** Route applies to traffic destined for a specific IP subnet */ - | { type: "ip_net"; value: IpNet } - /** Route applies to traffic destined for the given VPC. */ - | { type: "vpc"; value: Name } - /** Route applies to traffic */ - | { type: "subnet"; value: Name }; - -/** - * A `RouteTarget` describes the possible locations that traffic matching a route destination can be sent. - */ -export type RouteTarget = - /** Forward traffic to a particular IP address. */ - | { type: "ip"; value: string } - /** Forward traffic to a VPC */ - | { type: "vpc"; value: Name } - /** Forward traffic to a VPC Subnet */ - | { type: "subnet"; value: Name } - /** Forward traffic to a specific instance */ - | { type: "instance"; value: Name } - /** Forward traffic to an internet gateway */ - | { type: "internet_gateway"; value: Name }; - -/** - * The kind of a `RouterRoute` - * - * The kind determines certain attributes such as if the route is modifiable and describes how or where the route was created. - */ -export type RouterRouteKind = - /** Determines the default destination of traffic, such as whether it goes to the internet or not. - -`Destination: An Internet Gateway` `Modifiable: true` */ - | "default" - /** Automatically added for each VPC Subnet in the VPC - -`Destination: A VPC Subnet` `Modifiable: false` */ - | "vpc_subnet" - /** Automatically added when VPC peering is established - -`Destination: A different VPC` `Modifiable: false` */ - | "vpc_peering" - /** Created by a user; see `RouteTarget` - -`Destination: User defined` `Modifiable: true` */ - | "custom"; - -/** - * A route defines a rule that governs where traffic should be sent based on its destination. - */ -export type RouterRoute = { - /** human-readable free-form text about a resource */ - description: string; - destination: RouteDestination; - /** unique, immutable, system-controlled identifier for each resource */ - id: string; - /** Describes the kind of router. Set at creation. `read-only` */ - kind: RouterRouteKind; - /** unique, mutable, user-controlled identifier for each resource */ - name: Name; - target: RouteTarget; - /** timestamp when this resource was created */ - timeCreated: Date; - /** timestamp when this resource was last modified */ - timeModified: Date; - /** The ID of the VPC Router to which the route belongs */ - vpcRouterId: string; -}; - -/** - * Create-time parameters for a `RouterRoute` - */ -export type RouterRouteCreate = { - description: string; - destination: RouteDestination; - name: Name; - target: RouteTarget; -}; - -/** - * A single page of results - */ -export type RouterRouteResultsPage = { - /** list of items on this page of results */ - items: RouterRoute[]; - /** token used to fetch the next page of results (if any) */ - nextPage?: string; -}; - -/** - * Updateable properties of a `RouterRoute` - */ -export type RouterRouteUpdate = { - description?: string; - destination: RouteDestination; - name?: Name; - target: RouteTarget; -}; - /** * Identity-related metadata that's included in nearly all public API objects */ @@ -1435,6 +1902,21 @@ export type SiloRolePolicy = { roleAssignments: SiloRoleRoleAssignment[]; }; +/** + * The provision state of a sled. + * + * This controls whether new resources are going to be provisioned on this sled. + */ +export type SledProvisionState = + /** New resources will be provisioned on this sled. */ + | "provisionable" + /** New resources will not be provisioned on this sled. However, existing resources will continue to be on this sled unless manually migrated off. */ + | "non_provisionable" + /** This is a state that isn't known yet. + +This is defined to avoid API breakage. */ + | "unknown"; + /** * An operator's view of a Sled. */ @@ -1442,6 +1924,8 @@ export type Sled = { baseboard: Baseboard; /** unique, immutable, system-controlled identifier for each resource */ id: string; + /** The provision state of the sled. */ + provisionState: SledProvisionState; /** The rack to which this Sled is currently attached */ rackId: string; /** timestamp when this resource was created */ @@ -1484,6 +1968,24 @@ export type SledInstanceResultsPage = { nextPage?: string; }; +/** + * Parameters for `sled_set_provision_state`. + */ +export type SledProvisionStateParams = { + /** The provision state. */ + state: SledProvisionState; +}; + +/** + * Response to `sled_set_provision_state`. + */ +export type SledProvisionStateResponse = { + /** The new provision state. */ + newState: SledProvisionState; + /** The old provision state. */ + oldState: SledProvisionState; +}; + /** * A single page of results */ @@ -1660,8 +2162,6 @@ export type SwitchPortApplySettings = { export type SwitchPortBgpPeerConfig = { /** The address of the peer. */ addr: string; - /** The id for the set of prefixes announced in this peer configuration. */ - bgpAnnounceSetId: string; /** The id of the global BGP configuration referenced by this peer configuration. */ bgpConfigId: string; /** The interface name used to establish a peer session. */ @@ -1831,6 +2331,15 @@ export type SwitchResultsPage = { nextPage?: string; }; +/** + * A sled that has not been added to an initialized rack yet + */ +export type UninitializedSled = { + baseboard: Baseboard; + cubby: number; + rackId: string; +}; + /** * View of a User */ @@ -2076,47 +2585,6 @@ export type VpcResultsPage = { nextPage?: string; }; -export type VpcRouterKind = "system" | "custom"; - -/** - * A VPC router defines a series of rules that indicate where traffic should be sent depending on its destination. - */ -export type VpcRouter = { - /** human-readable free-form text about a resource */ - description: string; - /** unique, immutable, system-controlled identifier for each resource */ - id: string; - kind: VpcRouterKind; - /** unique, mutable, user-controlled identifier for each resource */ - name: Name; - /** timestamp when this resource was created */ - timeCreated: Date; - /** timestamp when this resource was last modified */ - timeModified: Date; - /** The VPC to which the router belongs. */ - vpcId: string; -}; - -/** - * Create-time parameters for a `VpcRouter` - */ -export type VpcRouterCreate = { description: string; name: Name }; - -/** - * A single page of results - */ -export type VpcRouterResultsPage = { - /** list of items on this page of results */ - items: VpcRouter[]; - /** token used to fetch the next page of results (if any) */ - nextPage?: string; -}; - -/** - * Updateable properties of a `VpcRouter` - */ -export type VpcRouterUpdate = { description?: string; name?: Name }; - /** * A VPC subnet represents a logical grouping for instances that allows network traffic between them, within a IPv4 subnetwork or optionall an IPv6 subnetwork. */ @@ -2676,6 +3144,10 @@ export interface SledInstanceListQueryParams { sortBy?: IdSortMode; } +export interface SledSetProvisionStatePathParams { + sledId: string; +} + export interface NetworkingSwitchPortListQueryParams { limit?: number; pageToken?: string; @@ -2823,6 +3295,29 @@ export interface NetworkingAddressLotBlockListQueryParams { sortBy?: IdSortMode; } +export interface NetworkingBgpConfigListQueryParams { + limit?: number; + nameOrId?: NameOrId; + pageToken?: string; + sortBy?: NameOrIdSortMode; +} + +export interface NetworkingBgpConfigDeleteQueryParams { + nameOrId: NameOrId; +} + +export interface NetworkingBgpAnnounceSetListQueryParams { + nameOrId: NameOrId; +} + +export interface NetworkingBgpAnnounceSetDeleteQueryParams { + nameOrId: NameOrId; +} + +export interface NetworkingBgpImportedRoutesIpv4QueryParams { + asn: number; +} + export interface NetworkingLoopbackAddressListQueryParams { limit?: number; pageToken?: string; @@ -2908,105 +3403,20 @@ export interface UserBuiltinViewPathParams { } export interface UserListQueryParams { - group?: string; - limit?: number; - pageToken?: string; - sortBy?: IdSortMode; -} - -export interface VpcFirewallRulesViewQueryParams { - project?: NameOrId; - vpc: NameOrId; -} - -export interface VpcFirewallRulesUpdateQueryParams { - project?: NameOrId; - vpc: NameOrId; -} - -export interface VpcRouterRouteListQueryParams { - limit?: number; - pageToken?: string; - project?: NameOrId; - router?: NameOrId; - sortBy?: NameOrIdSortMode; - vpc?: NameOrId; -} - -export interface VpcRouterRouteCreateQueryParams { - project?: NameOrId; - router: NameOrId; - vpc?: NameOrId; -} - -export interface VpcRouterRouteViewPathParams { - route: NameOrId; -} - -export interface VpcRouterRouteViewQueryParams { - project?: NameOrId; - router: NameOrId; - vpc?: NameOrId; -} - -export interface VpcRouterRouteUpdatePathParams { - route: NameOrId; -} - -export interface VpcRouterRouteUpdateQueryParams { - project?: NameOrId; - router?: NameOrId; - vpc?: NameOrId; -} - -export interface VpcRouterRouteDeletePathParams { - route: NameOrId; -} - -export interface VpcRouterRouteDeleteQueryParams { - project?: NameOrId; - router?: NameOrId; - vpc?: NameOrId; -} - -export interface VpcRouterListQueryParams { - limit?: number; - pageToken?: string; - project?: NameOrId; - sortBy?: NameOrIdSortMode; - vpc?: NameOrId; -} - -export interface VpcRouterCreateQueryParams { - project?: NameOrId; - vpc: NameOrId; -} - -export interface VpcRouterViewPathParams { - router: NameOrId; -} - -export interface VpcRouterViewQueryParams { - project?: NameOrId; - vpc?: NameOrId; -} - -export interface VpcRouterUpdatePathParams { - router: NameOrId; + group?: string; + limit?: number; + pageToken?: string; + sortBy?: IdSortMode; } -export interface VpcRouterUpdateQueryParams { +export interface VpcFirewallRulesViewQueryParams { project?: NameOrId; - vpc?: NameOrId; -} - -export interface VpcRouterDeletePathParams { - router: NameOrId; + vpc: NameOrId; } -export interface VpcRouterDeleteQueryParams { +export interface VpcFirewallRulesUpdateQueryParams { project?: NameOrId; - vpc?: NameOrId; + vpc: NameOrId; } export interface VpcSubnetListQueryParams { @@ -3118,12 +3528,15 @@ export type ApiListMethods = Pick< | "sledInstanceList" | "networkingSwitchPortList" | "switchList" + | "uninitializedSledList" | "siloIdentityProviderList" | "ipPoolList" | "ipPoolRangeList" | "ipPoolServiceRangeList" | "networkingAddressLotList" | "networkingAddressLotBlockList" + | "networkingBgpConfigList" + | "networkingBgpAnnounceSetList" | "networkingLoopbackAddressList" | "networkingSwitchPortSettingsList" | "roleList" @@ -3131,8 +3544,6 @@ export type ApiListMethods = Pick< | "siloUserList" | "userBuiltinList" | "userList" - | "vpcRouterRouteList" - | "vpcRouterList" | "vpcSubnetList" | "vpcList" >; @@ -4060,6 +4471,16 @@ export class Api extends HttpClient { ...params, }); }, + /** + * Ping API + */ + ping: (_: EmptyObj, params: FetchParams = {}) => { + return this.request({ + path: `/v1/ping`, + method: "GET", + ...params, + }); + }, /** * Fetch the current silo's IAM policy */ @@ -4303,6 +4724,20 @@ export class Api extends HttpClient { ...params, }); }, + /** + * Add a sled to an initialized rack + */ + addSledToInitializedRack: ( + { body }: { body: UninitializedSled }, + params: FetchParams = {} + ) => { + return this.request({ + path: `/v1/system/hardware/sleds`, + method: "POST", + body, + ...params, + }); + }, /** * Fetch a sled */ @@ -4356,6 +4791,26 @@ export class Api extends HttpClient { ...params, }); }, + /** + * Set the sled's provision state. + */ + sledSetProvisionState: ( + { + path, + body, + }: { + path: SledSetProvisionStatePathParams; + body: SledProvisionStateParams; + }, + params: FetchParams = {} + ) => { + return this.request({ + path: `/v1/system/hardware/sleds/${path.sledId}/provision-state`, + method: "PUT", + body, + ...params, + }); + }, /** * List switch ports */ @@ -4440,6 +4895,16 @@ export class Api extends HttpClient { ...params, }); }, + /** + * List uninitialized sleds in a given rack + */ + uninitializedSledList: (_: EmptyObj, params: FetchParams = {}) => { + return this.request({ + path: `/v1/system/hardware/uninitialized-sleds`, + method: "GET", + ...params, + }); + }, /** * List a silo's IdP's name */ @@ -4803,7 +5268,115 @@ export class Api extends HttpClient { }); }, /** - * Get loopback addresses, optionally filtering by id + * List BGP configurations + */ + networkingBgpConfigList: ( + { query = {} }: { query?: NetworkingBgpConfigListQueryParams }, + params: FetchParams = {} + ) => { + return this.request({ + path: `/v1/system/networking/bgp`, + method: "GET", + query, + ...params, + }); + }, + /** + * Create a new BGP configuration + */ + networkingBgpConfigCreate: ( + { body }: { body: BgpConfigCreate }, + params: FetchParams = {} + ) => { + return this.request({ + path: `/v1/system/networking/bgp`, + method: "POST", + body, + ...params, + }); + }, + /** + * Delete a BGP configuration + */ + networkingBgpConfigDelete: ( + { query }: { query?: NetworkingBgpConfigDeleteQueryParams }, + params: FetchParams = {} + ) => { + return this.request({ + path: `/v1/system/networking/bgp`, + method: "DELETE", + query, + ...params, + }); + }, + /** + * Get originated routes for a BGP configuration + */ + networkingBgpAnnounceSetList: ( + { query }: { query?: NetworkingBgpAnnounceSetListQueryParams }, + params: FetchParams = {} + ) => { + return this.request({ + path: `/v1/system/networking/bgp-announce`, + method: "GET", + query, + ...params, + }); + }, + /** + * Create a new BGP announce set + */ + networkingBgpAnnounceSetCreate: ( + { body }: { body: BgpAnnounceSetCreate }, + params: FetchParams = {} + ) => { + return this.request({ + path: `/v1/system/networking/bgp-announce`, + method: "POST", + body, + ...params, + }); + }, + /** + * Delete a BGP announce set + */ + networkingBgpAnnounceSetDelete: ( + { query }: { query?: NetworkingBgpAnnounceSetDeleteQueryParams }, + params: FetchParams = {} + ) => { + return this.request({ + path: `/v1/system/networking/bgp-announce`, + method: "DELETE", + query, + ...params, + }); + }, + /** + * Get imported IPv4 BGP routes + */ + networkingBgpImportedRoutesIpv4: ( + { query }: { query?: NetworkingBgpImportedRoutesIpv4QueryParams }, + params: FetchParams = {} + ) => { + return this.request({ + path: `/v1/system/networking/bgp-routes-ipv4`, + method: "GET", + query, + ...params, + }); + }, + /** + * Get BGP peer status + */ + networkingBgpStatus: (_: EmptyObj, params: FetchParams = {}) => { + return this.request({ + path: `/v1/system/networking/bgp-status`, + method: "GET", + ...params, + }); + }, + /** + * List loopback addresses */ networkingLoopbackAddressList: ( { query = {} }: { query?: NetworkingLoopbackAddressListQueryParams }, @@ -5137,193 +5710,6 @@ export class Api extends HttpClient { ...params, }); }, - /** - * List routes - */ - vpcRouterRouteList: ( - { query = {} }: { query?: VpcRouterRouteListQueryParams }, - params: FetchParams = {} - ) => { - return this.request({ - path: `/v1/vpc-router-routes`, - method: "GET", - query, - ...params, - }); - }, - /** - * Create a router - */ - vpcRouterRouteCreate: ( - { - query, - body, - }: { query?: VpcRouterRouteCreateQueryParams; body: RouterRouteCreate }, - params: FetchParams = {} - ) => { - return this.request({ - path: `/v1/vpc-router-routes`, - method: "POST", - body, - query, - ...params, - }); - }, - /** - * Fetch a route - */ - vpcRouterRouteView: ( - { - path, - query, - }: { - path: VpcRouterRouteViewPathParams; - query?: VpcRouterRouteViewQueryParams; - }, - params: FetchParams = {} - ) => { - return this.request({ - path: `/v1/vpc-router-routes/${path.route}`, - method: "GET", - query, - ...params, - }); - }, - /** - * Update a route - */ - vpcRouterRouteUpdate: ( - { - path, - query = {}, - body, - }: { - path: VpcRouterRouteUpdatePathParams; - query?: VpcRouterRouteUpdateQueryParams; - body: RouterRouteUpdate; - }, - params: FetchParams = {} - ) => { - return this.request({ - path: `/v1/vpc-router-routes/${path.route}`, - method: "PUT", - body, - query, - ...params, - }); - }, - /** - * Delete a route - */ - vpcRouterRouteDelete: ( - { - path, - query = {}, - }: { - path: VpcRouterRouteDeletePathParams; - query?: VpcRouterRouteDeleteQueryParams; - }, - params: FetchParams = {} - ) => { - return this.request({ - path: `/v1/vpc-router-routes/${path.route}`, - method: "DELETE", - query, - ...params, - }); - }, - /** - * List routers - */ - vpcRouterList: ( - { query = {} }: { query?: VpcRouterListQueryParams }, - params: FetchParams = {} - ) => { - return this.request({ - path: `/v1/vpc-routers`, - method: "GET", - query, - ...params, - }); - }, - /** - * Create a VPC router - */ - vpcRouterCreate: ( - { - query, - body, - }: { query?: VpcRouterCreateQueryParams; body: VpcRouterCreate }, - params: FetchParams = {} - ) => { - return this.request({ - path: `/v1/vpc-routers`, - method: "POST", - body, - query, - ...params, - }); - }, - /** - * Fetch a router - */ - vpcRouterView: ( - { - path, - query = {}, - }: { path: VpcRouterViewPathParams; query?: VpcRouterViewQueryParams }, - params: FetchParams = {} - ) => { - return this.request({ - path: `/v1/vpc-routers/${path.router}`, - method: "GET", - query, - ...params, - }); - }, - /** - * Update a router - */ - vpcRouterUpdate: ( - { - path, - query = {}, - body, - }: { - path: VpcRouterUpdatePathParams; - query?: VpcRouterUpdateQueryParams; - body: VpcRouterUpdate; - }, - params: FetchParams = {} - ) => { - return this.request({ - path: `/v1/vpc-routers/${path.router}`, - method: "PUT", - body, - query, - ...params, - }); - }, - /** - * Delete a router - */ - vpcRouterDelete: ( - { - path, - query = {}, - }: { - path: VpcRouterDeletePathParams; - query?: VpcRouterDeleteQueryParams; - }, - params: FetchParams = {} - ) => { - return this.request({ - path: `/v1/vpc-routers/${path.router}`, - method: "DELETE", - query, - ...params, - }); - }, /** * List subnets */ diff --git a/client/msw-handlers.ts b/client/msw-handlers.ts index bdf26a0..ad8338f 100644 --- a/client/msw-handlers.ts +++ b/client/msw-handlers.ts @@ -420,6 +420,11 @@ export interface MSWHandlers { req: Request; cookies: Record; }) => Promisable; + /** `GET /v1/ping` */ + ping: (params: { + req: Request; + cookies: Record; + }) => Promisable>; /** `GET /v1/policy` */ policyView: (params: { req: Request; @@ -526,6 +531,12 @@ export interface MSWHandlers { req: Request; cookies: Record; }) => Promisable>; + /** `POST /v1/system/hardware/sleds` */ + addSledToInitializedRack: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable; /** `GET /v1/system/hardware/sleds/:sledId` */ sledView: (params: { path: Api.SledViewPathParams; @@ -546,6 +557,13 @@ export interface MSWHandlers { req: Request; cookies: Record; }) => Promisable>; + /** `PUT /v1/system/hardware/sleds/:sledId/provision-state` */ + sledSetProvisionState: (params: { + path: Api.SledSetProvisionStatePathParams; + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; /** `GET /v1/system/hardware/switch-port` */ networkingSwitchPortList: (params: { query: Api.NetworkingSwitchPortListQueryParams; @@ -579,6 +597,11 @@ export interface MSWHandlers { req: Request; cookies: Record; }) => Promisable>; + /** `GET /v1/system/hardware/uninitialized-sleds` */ + uninitializedSledList: (params: { + req: Request; + cookies: Record; + }) => Promisable; /** `GET /v1/system/identity-providers` */ siloIdentityProviderList: (params: { query: Api.SiloIdentityProviderListQueryParams; @@ -728,6 +751,53 @@ export interface MSWHandlers { 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` */ + networkingBgpAnnounceSetList: (params: { + query: Api.NetworkingBgpAnnounceSetListQueryParams; + req: Request; + cookies: Record; + }) => Promisable; + /** `POST /v1/system/networking/bgp-announce` */ + networkingBgpAnnounceSetCreate: (params: { + body: Json; + req: Request; + cookies: Record; + }) => Promisable>; + /** `DELETE /v1/system/networking/bgp-announce` */ + networkingBgpAnnounceSetDelete: (params: { + query: Api.NetworkingBgpAnnounceSetDeleteQueryParams; + 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/loopback-address` */ networkingLoopbackAddressList: (params: { query: Api.NetworkingLoopbackAddressListQueryParams; @@ -874,76 +944,6 @@ export interface MSWHandlers { 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; @@ -1446,6 +1446,7 @@ export function makeHandlers(handlers: MSWHandlers): HttpHandler[] { null ) ), + http.get("/v1/ping", handler(handlers["ping"], null, null)), http.get("/v1/policy", handler(handlers["policyView"], null, null)), http.put( "/v1/policy", @@ -1527,6 +1528,14 @@ export function makeHandlers(handlers: MSWHandlers): HttpHandler[] { "/v1/system/hardware/sleds", handler(handlers["sledList"], schema.SledListParams, null) ), + http.post( + "/v1/system/hardware/sleds", + handler( + handlers["addSledToInitializedRack"], + null, + schema.UninitializedSled + ) + ), http.get( "/v1/system/hardware/sleds/:sledId", handler(handlers["sledView"], schema.SledViewParams, null) @@ -1543,6 +1552,14 @@ export function makeHandlers(handlers: MSWHandlers): HttpHandler[] { "/v1/system/hardware/sleds/:sledId/instances", handler(handlers["sledInstanceList"], schema.SledInstanceListParams, null) ), + http.put( + "/v1/system/hardware/sleds/:sledId/provision-state", + handler( + handlers["sledSetProvisionState"], + schema.SledSetProvisionStateParams, + schema.SledProvisionStateParams + ) + ), http.get( "/v1/system/hardware/switch-port", handler( @@ -1575,6 +1592,10 @@ export function makeHandlers(handlers: MSWHandlers): HttpHandler[] { "/v1/system/hardware/switches/:switchId", handler(handlers["switchView"], schema.SwitchViewParams, null) ), + http.get( + "/v1/system/hardware/uninitialized-sleds", + handler(handlers["uninitializedSledList"], null, null) + ), http.get( "/v1/system/identity-providers", handler( @@ -1723,6 +1744,66 @@ export function makeHandlers(handlers: MSWHandlers): HttpHandler[] { 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", + handler( + handlers["networkingBgpAnnounceSetList"], + schema.NetworkingBgpAnnounceSetListParams, + null + ) + ), + http.post( + "/v1/system/networking/bgp-announce", + handler( + handlers["networkingBgpAnnounceSetCreate"], + null, + schema.BgpAnnounceSetCreate + ) + ), + http.delete( + "/v1/system/networking/bgp-announce", + handler( + handlers["networkingBgpAnnounceSetDelete"], + schema.NetworkingBgpAnnounceSetDeleteParams, + 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/loopback-address", handler( @@ -1859,74 +1940,6 @@ export function makeHandlers(handlers: MSWHandlers): HttpHandler[] { 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) diff --git a/client/type-test.ts b/client/type-test.ts index bca2a97..dd8f6e7 100644 --- a/client/type-test.ts +++ b/client/type-test.ts @@ -38,11 +38,47 @@ assert< Equals> >(); assert>>(); +assert>>(); +assert< + Equals> +>(); +assert< + Equals> +>(); +assert>>(); +assert>>(); +assert>>(); +assert< + Equals> +>(); +assert>>(); +assert< + Equals> +>(); +assert>>(); assert>>(); +assert>>(); +assert>>(); assert>>(); +assert>>(); +assert>>(); +assert>>(); assert>>(); +assert>>(); +assert>>(); +assert>>(); +assert>>(); +assert>>(); assert>>(); +assert>>(); +assert>>(); +assert>>(); assert>>(); +assert>>(); +assert>>(); +assert>>(); +assert>>(); +assert>>(); assert>>(); assert>>(); assert< @@ -54,10 +90,22 @@ assert< Equals> >(); assert>>(); +assert>>(); assert>>(); +assert>>(); assert>>(); +assert>>(); +assert>>(); +assert>>(); +assert>>(); +assert>>(); +assert>>(); assert>>(); +assert>>(); +assert>>(); assert>>(); +assert>>(); +assert>>(); assert>>(); assert>>(); assert< @@ -162,7 +210,9 @@ assert< assert>>(); assert>>(); assert>>(); +assert>>(); assert>>(); +assert>>(); assert>>(); assert>>(); assert< @@ -184,6 +234,8 @@ assert>>(); assert< Equals> >(); +assert>>(); +assert>>(); assert>>(); assert>>(); assert>>(); @@ -203,15 +255,6 @@ assert>>(); assert>>(); assert>>(); assert>>(); -assert>>(); -assert>>(); -assert>>(); -assert>>(); -assert>>(); -assert< - Equals> ->(); -assert>>(); assert< Equals> >(); @@ -230,11 +273,21 @@ assert< Equals> >(); assert>>(); +assert>>(); assert>>(); assert>>(); assert< Equals> >(); +assert< + Equals> +>(); +assert< + Equals< + A.SledProvisionStateResponse, + z.infer + > +>(); assert>>(); assert>>(); assert>>(); @@ -292,6 +345,7 @@ assert< Equals> >(); assert>>(); +assert>>(); assert>>(); assert>>(); assert< @@ -345,13 +399,6 @@ assert< >(); assert>>(); assert>>(); -assert>>(); -assert>>(); -assert>>(); -assert< - Equals> ->(); -assert>>(); assert>>(); assert>>(); assert< diff --git a/client/validate.ts b/client/validate.ts index 7573be6..c2c5434 100644 --- a/client/validate.ts +++ b/client/validate.ts @@ -185,16 +185,162 @@ export const Baseboard = z.preprocess( z.object({ part: z.string(), revision: z.number(), serial: z.string() }) ); +/** + * 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().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.optional(), + }) +); + +/** + * A single page of results + */ +export const BgpConfigResultsPage = z.preprocess( + processResponseBody, + z.object({ items: BgpConfig.array(), nextPage: z.string().optional() }) +); + +/** + * Identifies switch physical location + */ +export const SwitchLocation = z.preprocess( + processResponseBody, + z.enum(["switch0", "switch1"]) +); + +/** + * 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(), + prefix: Ipv4Net, + switch: SwitchLocation, + }) +); + /** * 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 BgpPeerConfig = z.preprocess( +export const BgpPeer = z.preprocess( processResponseBody, z.object({ addr: z.string().ip(), bgpAnnounceSet: NameOrId, bgpConfig: NameOrId, + connectRetry: z.number().min(0).max(4294967295), + delayOpen: z.number().min(0).max(4294967295), + holdTime: z.number().min(0).max(4294967295), + idleHoldTime: z.number().min(0).max(4294967295), interfaceName: z.string(), + keepalive: z.number().min(0).max(4294967295), + }) +); + +export const BgpPeerConfig = z.preprocess( + processResponseBody, + z.object({ 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, }) ); @@ -212,6 +358,68 @@ export const BinRangedouble = z.preprocess( ]) ); +/** + * 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`. * @@ -226,6 +434,114 @@ export const BinRangeint64 = z.preprocess( ]) ); +/** + * 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. */ @@ -234,6 +550,30 @@ export const Bindouble = z.preprocess( 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. */ @@ -242,6 +582,46 @@ export const Binint64 = z.preprocess( 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 */ @@ -308,6 +688,14 @@ export const Cumulativedouble = z.preprocess( 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. */ @@ -316,6 +704,14 @@ export const Cumulativeint64 = z.preprocess( 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 */ @@ -329,6 +725,102 @@ export const CurrentUser = z.preprocess( }) ); +/** + * 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(), + nSamples: z.number().min(0), + startTime: z.coerce.date(), + }) +); + +/** + * 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(), + nSamples: z.number().min(0), + startTime: z.coerce.date(), + }) +); + +/** + * 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(), + nSamples: z.number().min(0), + startTime: z.coerce.date(), + }) +); + +/** + * 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(), + nSamples: z.number().min(0), + startTime: z.coerce.date(), + }) +); + +/** + * 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(), + nSamples: z.number().min(0), + startTime: z.coerce.date(), + }) +); + +/** + * 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(), + nSamples: z.number().min(0), + startTime: z.coerce.date(), + }) +); + /** * Histogram metric * @@ -345,6 +837,38 @@ export const Histogramint64 = z.preprocess( }) ); +/** + * 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(), + nSamples: z.number().min(0), + startTime: z.coerce.date(), + }) +); + +/** + * 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(), + nSamples: z.number().min(0), + startTime: z.coerce.date(), + }) +); + /** * Histogram metric * @@ -361,6 +885,47 @@ export const Histogramdouble = z.preprocess( }) ); +/** + * 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().optional() }) +); + /** * A `Datum` is a single sampled data point from a metric. */ @@ -368,7 +933,24 @@ 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({ @@ -376,9 +958,20 @@ export const Datum = z.preprocess( 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"]) }), ]) ); @@ -922,7 +1515,9 @@ export const IpPool = z.preprocess( z.object({ description: z.string(), id: z.string().uuid(), + isDefault: SafeBoolean, name: Name, + siloId: z.string().uuid().optional(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }) @@ -933,7 +1528,12 @@ export const IpPool = z.preprocess( */ export const IpPoolCreate = z.preprocess( processResponseBody, - z.object({ description: z.string(), name: Name }) + z.object({ + description: z.string(), + isDefault: SafeBoolean.default(false).optional(), + name: Name, + silo: NameOrId.optional(), + }) ); /** @@ -1009,6 +1609,14 @@ export const L4PortRange = z.preprocess( .regex(/^[0-9]{1,5}(-[0-9]{1,5})?$/) ); +/** + * The forward error correction mode of a link. + */ +export const LinkFec = z.preprocess( + processResponseBody, + z.enum(["firecode", "none", "rs"]) +); + /** * The LLDP configuration associated with a port. LLDP may be either enabled or disabled, if enabled, an LLDP configuration must be provided by name or id. */ @@ -1017,12 +1625,36 @@ export const LldpServiceConfig = z.preprocess( z.object({ enabled: SafeBoolean, lldpConfig: NameOrId.optional() }) ); +/** + * The speed of a link. + */ +export const LinkSpeed = z.preprocess( + processResponseBody, + z.enum([ + "speed0_g", + "speed1_g", + "speed10_g", + "speed25_g", + "speed40_g", + "speed50_g", + "speed100_g", + "speed200_g", + "speed400_g", + ]) +); + /** * Switch link configuration. */ export const LinkConfig = z.preprocess( processResponseBody, - z.object({ lldp: LldpServiceConfig, mtu: z.number().min(0).max(65535) }) + z.object({ + autoneg: SafeBoolean, + fec: LinkFec, + lldp: LldpServiceConfig, + mtu: z.number().min(0).max(65535), + speed: LinkSpeed, + }) ); /** @@ -1120,6 +1752,13 @@ export const PhysicalDiskResultsPage = z.preprocess( z.object({ items: PhysicalDisk.array(), nextPage: z.string().optional() }) ); +export const PingStatus = z.preprocess(processResponseBody, z.enum(["ok"])); + +export const Ping = z.preprocess( + processResponseBody, + z.object({ status: PingStatus }) +); + /** * View of a Project */ @@ -1256,97 +1895,6 @@ export const RouteConfig = z.preprocess( z.object({ routes: Route.array() }) ); -/** - * A `RouteDestination` is used to match traffic with a routing rule, on the destination of that traffic. - * - * When traffic is to be sent to a destination that is within a given `RouteDestination`, the corresponding `RouterRoute` applies, and traffic will be forward to the `RouteTarget` for that rule. - */ -export const RouteDestination = z.preprocess( - processResponseBody, - z.union([ - z.object({ type: z.enum(["ip"]), value: z.string().ip() }), - 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 }), - ]) -); - -/** - * A `RouteTarget` describes the possible locations that traffic matching a route destination can be sent. - */ -export const RouteTarget = z.preprocess( - processResponseBody, - z.union([ - z.object({ type: z.enum(["ip"]), value: z.string().ip() }), - 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(["internet_gateway"]), value: Name }), - ]) -); - -/** - * The kind of a `RouterRoute` - * - * The kind determines certain attributes such as if the route is modifiable and describes how or where the route was created. - */ -export const RouterRouteKind = z.preprocess( - processResponseBody, - z.enum(["default", "vpc_subnet", "vpc_peering", "custom"]) -); - -/** - * A route defines a rule that governs where traffic should be sent based on its destination. - */ -export const RouterRoute = z.preprocess( - processResponseBody, - z.object({ - description: z.string(), - destination: RouteDestination, - id: z.string().uuid(), - kind: RouterRouteKind, - name: Name, - target: RouteTarget, - timeCreated: z.coerce.date(), - timeModified: z.coerce.date(), - vpcRouterId: z.string().uuid(), - }) -); - -/** - * Create-time parameters for a `RouterRoute` - */ -export const RouterRouteCreate = z.preprocess( - processResponseBody, - z.object({ - description: z.string(), - destination: RouteDestination, - name: Name, - target: RouteTarget, - }) -); - -/** - * A single page of results - */ -export const RouterRouteResultsPage = z.preprocess( - processResponseBody, - z.object({ items: RouterRoute.array(), nextPage: z.string().optional() }) -); - -/** - * Updateable properties of a `RouterRoute` - */ -export const RouterRouteUpdate = z.preprocess( - processResponseBody, - z.object({ - description: z.string().optional(), - destination: RouteDestination, - name: Name.optional(), - target: RouteTarget, - }) -); - /** * Identity-related metadata that's included in nearly all public API objects */ @@ -1472,6 +2020,16 @@ export const SiloRolePolicy = z.preprocess( z.object({ roleAssignments: SiloRoleRoleAssignment.array() }) ); +/** + * The provision state of a sled. + * + * This controls whether new resources are going to be provisioned on this sled. + */ +export const SledProvisionState = z.preprocess( + processResponseBody, + z.enum(["provisionable", "non_provisionable", "unknown"]) +); + /** * An operator's view of a Sled. */ @@ -1480,6 +2038,7 @@ export const Sled = z.preprocess( z.object({ baseboard: Baseboard, id: z.string().uuid(), + provisionState: SledProvisionState, rackId: z.string().uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -1509,11 +2068,27 @@ export const SledInstance = z.preprocess( ); /** - * A single page of results + * A single page of results + */ +export const SledInstanceResultsPage = z.preprocess( + processResponseBody, + z.object({ items: SledInstance.array(), nextPage: z.string().optional() }) +); + +/** + * Parameters for `sled_set_provision_state`. + */ +export const SledProvisionStateParams = z.preprocess( + processResponseBody, + z.object({ state: SledProvisionState }) +); + +/** + * Response to `sled_set_provision_state`. */ -export const SledInstanceResultsPage = z.preprocess( +export const SledProvisionStateResponse = z.preprocess( processResponseBody, - z.object({ items: SledInstance.array(), nextPage: z.string().optional() }) + z.object({ newState: SledProvisionState, oldState: SledProvisionState }) ); /** @@ -1671,7 +2246,6 @@ export const SwitchPortBgpPeerConfig = z.preprocess( processResponseBody, z.object({ addr: z.string().ip(), - bgpAnnounceSetId: z.string().uuid(), bgpConfigId: z.string().uuid(), interfaceName: z.string(), portSettingsId: z.string().uuid(), @@ -1821,6 +2395,18 @@ export const SwitchResultsPage = z.preprocess( z.object({ items: Switch.array(), nextPage: z.string().optional() }) ); +/** + * A sled that has not been added to an initialized rack yet + */ +export const UninitializedSled = z.preprocess( + processResponseBody, + z.object({ + baseboard: Baseboard, + cubby: z.number().min(0).max(65535), + rackId: z.string().uuid(), + }) +); + /** * View of a User */ @@ -2064,51 +2650,6 @@ export const VpcResultsPage = z.preprocess( z.object({ items: Vpc.array(), nextPage: z.string().optional() }) ); -export const VpcRouterKind = z.preprocess( - processResponseBody, - z.enum(["system", "custom"]) -); - -/** - * A VPC router defines a series of rules that indicate where traffic should be sent depending on its destination. - */ -export const VpcRouter = z.preprocess( - processResponseBody, - z.object({ - description: z.string(), - id: z.string().uuid(), - kind: VpcRouterKind, - name: Name, - timeCreated: z.coerce.date(), - timeModified: z.coerce.date(), - vpcId: z.string().uuid(), - }) -); - -/** - * Create-time parameters for a `VpcRouter` - */ -export const VpcRouterCreate = z.preprocess( - processResponseBody, - z.object({ description: z.string(), name: Name }) -); - -/** - * A single page of results - */ -export const VpcRouterResultsPage = z.preprocess( - processResponseBody, - z.object({ items: VpcRouter.array(), nextPage: z.string().optional() }) -); - -/** - * Updateable properties of a `VpcRouter` - */ -export const VpcRouterUpdate = z.preprocess( - processResponseBody, - z.object({ description: z.string().optional(), name: Name.optional() }) -); - /** * A VPC subnet represents a logical grouping for instances that allows network traffic between them, within a IPv4 subnetwork or optionall an IPv6 subnetwork. */ @@ -2868,6 +3409,14 @@ export const InstanceNetworkInterfaceDeleteParams = z.preprocess( }) ); +export const PingParams = z.preprocess( + processResponseBody, + z.object({ + path: z.object({}), + query: z.object({}), + }) +); + export const PolicyViewParams = z.preprocess( processResponseBody, z.object({ @@ -3047,6 +3596,14 @@ export const SledListParams = z.preprocess( }) ); +export const AddSledToInitializedRackParams = z.preprocess( + processResponseBody, + z.object({ + path: z.object({}), + query: z.object({}), + }) +); + export const SledViewParams = z.preprocess( processResponseBody, z.object({ @@ -3085,6 +3642,16 @@ export const SledInstanceListParams = z.preprocess( }) ); +export const SledSetProvisionStateParams = z.preprocess( + processResponseBody, + z.object({ + path: z.object({ + sledId: z.string().uuid(), + }), + query: z.object({}), + }) +); + export const NetworkingSwitchPortListParams = z.preprocess( processResponseBody, z.object({ @@ -3146,6 +3713,14 @@ export const SwitchViewParams = z.preprocess( }) ); +export const UninitializedSledListParams = z.preprocess( + processResponseBody, + z.object({ + path: z.object({}), + query: z.object({}), + }) +); + export const SiloIdentityProviderListParams = z.preprocess( processResponseBody, z.object({ @@ -3394,6 +3969,83 @@ export const NetworkingAddressLotBlockListParams = z.preprocess( }) ); +export const NetworkingBgpConfigListParams = z.preprocess( + processResponseBody, + z.object({ + path: z.object({}), + query: z.object({ + limit: z.number().min(1).max(4294967295).optional(), + nameOrId: NameOrId.optional(), + pageToken: z.string().optional(), + sortBy: NameOrIdSortMode.optional(), + }), + }) +); + +export const NetworkingBgpConfigCreateParams = z.preprocess( + processResponseBody, + z.object({ + path: z.object({}), + query: z.object({}), + }) +); + +export const NetworkingBgpConfigDeleteParams = z.preprocess( + processResponseBody, + z.object({ + path: z.object({}), + query: z.object({ + nameOrId: NameOrId, + }), + }) +); + +export const NetworkingBgpAnnounceSetListParams = z.preprocess( + processResponseBody, + z.object({ + path: z.object({}), + query: z.object({ + nameOrId: NameOrId, + }), + }) +); + +export const NetworkingBgpAnnounceSetCreateParams = z.preprocess( + processResponseBody, + z.object({ + path: z.object({}), + query: z.object({}), + }) +); + +export const NetworkingBgpAnnounceSetDeleteParams = z.preprocess( + processResponseBody, + z.object({ + path: z.object({}), + query: z.object({ + nameOrId: NameOrId, + }), + }) +); + +export const NetworkingBgpImportedRoutesIpv4Params = z.preprocess( + processResponseBody, + z.object({ + path: z.object({}), + query: z.object({ + asn: z.number().min(0).max(4294967295), + }), + }) +); + +export const NetworkingBgpStatusParams = z.preprocess( + processResponseBody, + z.object({ + path: z.object({}), + query: z.object({}), + }) +); + export const NetworkingLoopbackAddressListParams = z.preprocess( processResponseBody, z.object({ @@ -3647,139 +4299,6 @@ export const VpcFirewallRulesUpdateParams = z.preprocess( }) ); -export const VpcRouterRouteListParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({}), - query: z.object({ - limit: z.number().min(1).max(4294967295).optional(), - pageToken: z.string().optional(), - project: NameOrId.optional(), - router: NameOrId.optional(), - sortBy: NameOrIdSortMode.optional(), - vpc: NameOrId.optional(), - }), - }) -); - -export const VpcRouterRouteCreateParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({}), - query: z.object({ - project: NameOrId.optional(), - router: NameOrId, - vpc: NameOrId.optional(), - }), - }) -); - -export const VpcRouterRouteViewParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({ - route: NameOrId, - }), - query: z.object({ - project: NameOrId.optional(), - router: NameOrId, - vpc: NameOrId.optional(), - }), - }) -); - -export const VpcRouterRouteUpdateParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({ - route: NameOrId, - }), - query: z.object({ - project: NameOrId.optional(), - router: NameOrId.optional(), - vpc: NameOrId.optional(), - }), - }) -); - -export const VpcRouterRouteDeleteParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({ - route: NameOrId, - }), - query: z.object({ - project: NameOrId.optional(), - router: NameOrId.optional(), - vpc: NameOrId.optional(), - }), - }) -); - -export const VpcRouterListParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({}), - query: z.object({ - limit: z.number().min(1).max(4294967295).optional(), - pageToken: z.string().optional(), - project: NameOrId.optional(), - sortBy: NameOrIdSortMode.optional(), - vpc: NameOrId.optional(), - }), - }) -); - -export const VpcRouterCreateParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({}), - query: z.object({ - project: NameOrId.optional(), - vpc: NameOrId, - }), - }) -); - -export const VpcRouterViewParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({ - router: NameOrId, - }), - query: z.object({ - project: NameOrId.optional(), - vpc: NameOrId.optional(), - }), - }) -); - -export const VpcRouterUpdateParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({ - router: NameOrId, - }), - query: z.object({ - project: NameOrId.optional(), - vpc: NameOrId.optional(), - }), - }) -); - -export const VpcRouterDeleteParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({ - router: NameOrId, - }), - query: z.object({ - project: NameOrId.optional(), - vpc: NameOrId.optional(), - }), - }) -); - export const VpcSubnetListParams = z.preprocess( processResponseBody, z.object({