From 08e15a0d51b967bf4658849f4ae7317d459ab5ac Mon Sep 17 00:00:00 2001 From: David Crespo Date: Sat, 8 Aug 2026 15:30:04 -0400 Subject: [PATCH 1/4] bump api --- OMICRON_VERSION | 2 +- app/api/__generated__/API_VERSION | 2 +- app/api/__generated__/Api.ts | 102 +++++++++++--------------- app/api/__generated__/OMICRON_VERSION | 2 +- app/api/__generated__/msw-handlers.ts | 58 ++++----------- app/api/__generated__/validate.ts | 70 +++++++++--------- 6 files changed, 95 insertions(+), 141 deletions(-) diff --git a/OMICRON_VERSION b/OMICRON_VERSION index 7dd25595c..416087d37 100644 --- a/OMICRON_VERSION +++ b/OMICRON_VERSION @@ -1 +1 @@ -99249b41c3e8f2c5bf2606daa35c1f399aec6e56 +7a15082edfcd725891dada6e702948b3b0181e77 diff --git a/app/api/__generated__/API_VERSION b/app/api/__generated__/API_VERSION index d7919c438..78d3ac606 100644 --- a/app/api/__generated__/API_VERSION +++ b/app/api/__generated__/API_VERSION @@ -1 +1 @@ -2026061000.0.0 +2026073100.0.0 diff --git a/app/api/__generated__/Api.ts b/app/api/__generated__/Api.ts index 32a554820..06060796c 100644 --- a/app/api/__generated__/Api.ts +++ b/app/api/__generated__/Api.ts @@ -3014,6 +3014,15 @@ export type InternetGatewayResultsPage = { nextPage?: string | null } +/** + * Assignment of an IP pool to resources and services. + */ +export type IpPoolAssignment = /** Pool is available to be linked to customer silos. */ +| 'silos' + +/** Pool is reserved for Oxide-operated rack services (NTP, DNS, etc.). */ +| 'system_services' + /** * Type of IP pool. */ @@ -3026,9 +3035,11 @@ All ranges in a multicast pool must be either ASM or SSM (not mixed). */ | 'multicast' /** - * A collection of IP ranges. If a pool is linked to a silo, IP addresses from the pool can be allocated within that silo. + * A collection of IP ranges. */ export type IpPool = { + /** What this pool is currently assigned to. */ + assignment: IpPoolAssignment /** Human-readable free-form text about a resource */ description: string /** Unique, immutable, system-controlled identifier for each resource */ @@ -3045,6 +3056,11 @@ export type IpPool = { timeModified: Date } +/** + * Body parameters for reassigning an IP pool. + */ +export type IpPoolAssignParam = { assignment: IpPoolAssignment } + /** * Create-time parameters for an `IpPool`. * @@ -3053,6 +3069,8 @@ export type IpPool = { * ASM: IPv4 addresses outside 232.0.0.0/8, IPv6 addresses with flag field != 3 SSM: IPv4 addresses in 232.0.0.0/8, IPv6 addresses with flag field = 3 */ export type IpPoolCreate = { + /** What this pool is assigned to (defaults to Silos). */ + assignment?: IpPoolAssignment description: string /** The IP version of the pool. @@ -6536,8 +6554,10 @@ export interface InternetGatewayDeleteQueryParams { } export interface IpPoolListQueryParams { + ipVersion?: IpVersion limit?: number | null pageToken?: string | null + poolType?: IpPoolType sortBy?: NameOrIdSortMode } @@ -6927,8 +6947,11 @@ export interface SamlIdentityProviderViewQueryParams { } export interface SystemIpPoolListQueryParams { + assignment?: IpPoolAssignment + ipVersion?: IpVersion limit?: number | null pageToken?: string | null + poolType?: IpPoolType sortBy?: NameOrIdSortMode } @@ -6944,6 +6967,10 @@ export interface SystemIpPoolDeletePathParams { pool: NameOrId } +export interface SystemIpPoolAssignPathParams { + pool: NameOrId +} + export interface SystemIpPoolRangeListPathParams { pool: NameOrId } @@ -6989,11 +7016,6 @@ export interface SystemIpPoolUtilizationViewPathParams { pool: NameOrId } -export interface SystemIpPoolServiceRangeListQueryParams { - limit?: number | null - pageToken?: string | null -} - export interface SystemMetricPathParams { metricName: SystemMetricName } @@ -7562,7 +7584,7 @@ export class Api { * Pulled from info.version in the OpenAPI schema. Sent in the * `api-version` header on all requests. */ - apiVersion = '2026061000.0.0' + apiVersion = '2026073100.0.0' constructor({ host = '', baseParams = {}, token }: ApiConfig = {}) { this.host = host @@ -10608,6 +10630,20 @@ export class Api { ...params, }) }, + /** + * Assign IP pool + */ + systemIpPoolAssign: ( + { path, body }: { path: SystemIpPoolAssignPathParams; body: IpPoolAssignParam }, + params: FetchParams = {} + ) => { + return this.request({ + path: `/v1/system/ip-pools/${path.pool}/assignment`, + method: 'POST', + body, + ...params, + }) + }, /** * List ranges for IP pool */ @@ -10727,58 +10763,6 @@ export class Api { ...params, }) }, - /** - * Fetch Oxide service IP pool - */ - systemIpPoolServiceView: (_: EmptyObj, params: FetchParams = {}) => { - return this.request({ - path: `/v1/system/ip-pools-service`, - method: 'GET', - ...params, - }) - }, - /** - * List IP ranges for the Oxide service pool - */ - systemIpPoolServiceRangeList: ( - { query = {} }: { query?: SystemIpPoolServiceRangeListQueryParams }, - params: FetchParams = {} - ) => { - return this.request({ - path: `/v1/system/ip-pools-service/ranges`, - method: 'GET', - query, - ...params, - }) - }, - /** - * Add IP range to Oxide service pool - */ - systemIpPoolServiceRangeAdd: ( - { body }: { body: IpRange }, - params: FetchParams = {} - ) => { - return this.request({ - path: `/v1/system/ip-pools-service/ranges/add`, - method: 'POST', - body, - ...params, - }) - }, - /** - * Remove IP range from Oxide service pool - */ - systemIpPoolServiceRangeRemove: ( - { body }: { body: IpRange }, - params: FetchParams = {} - ) => { - return this.request({ - path: `/v1/system/ip-pools-service/ranges/remove`, - method: 'POST', - body, - ...params, - }) - }, /** * View metrics */ diff --git a/app/api/__generated__/OMICRON_VERSION b/app/api/__generated__/OMICRON_VERSION index b67956e3e..320208cea 100644 --- a/app/api/__generated__/OMICRON_VERSION +++ b/app/api/__generated__/OMICRON_VERSION @@ -1,2 +1,2 @@ # generated file. do not update manually. see docs/update-pinned-api.md -99249b41c3e8f2c5bf2606daa35c1f399aec6e56 +7a15082edfcd725891dada6e702948b3b0181e77 diff --git a/app/api/__generated__/msw-handlers.ts b/app/api/__generated__/msw-handlers.ts index e0c8700d9..53faab540 100644 --- a/app/api/__generated__/msw-handlers.ts +++ b/app/api/__generated__/msw-handlers.ts @@ -1295,6 +1295,13 @@ export interface MSWHandlers { req: Request cookies: Record }) => Promisable + /** `POST /v1/system/ip-pools/:pool/assignment` */ + systemIpPoolAssign: (params: { + path: Api.SystemIpPoolAssignPathParams + body: Json + req: Request + cookies: Record + }) => Promisable> /** `GET /v1/system/ip-pools/:pool/ranges` */ systemIpPoolRangeList: (params: { path: Api.SystemIpPoolRangeListPathParams @@ -1349,29 +1356,6 @@ export interface MSWHandlers { req: Request cookies: Record }) => Promisable> - /** `GET /v1/system/ip-pools-service` */ - systemIpPoolServiceView: (params: { - req: Request - cookies: Record - }) => Promisable> - /** `GET /v1/system/ip-pools-service/ranges` */ - systemIpPoolServiceRangeList: (params: { - query: Api.SystemIpPoolServiceRangeListQueryParams - req: Request - cookies: Record - }) => Promisable> - /** `POST /v1/system/ip-pools-service/ranges/add` */ - systemIpPoolServiceRangeAdd: (params: { - body: Json - req: Request - cookies: Record - }) => Promisable> - /** `POST /v1/system/ip-pools-service/ranges/remove` */ - systemIpPoolServiceRangeRemove: (params: { - body: Json - req: Request - cookies: Record - }) => Promisable /** `GET /v1/system/metrics/:metricName` */ systemMetric: (params: { path: Api.SystemMetricPathParams @@ -3250,6 +3234,14 @@ export function makeHandlers(handlers: MSWHandlers): HttpHandler[] { '/v1/system/ip-pools/:pool', handler(handlers['systemIpPoolDelete'], schema.SystemIpPoolDeleteParams, null) ), + http.post( + '/v1/system/ip-pools/:pool/assignment', + handler( + handlers['systemIpPoolAssign'], + schema.SystemIpPoolAssignParams, + schema.IpPoolAssignParam + ) + ), http.get( '/v1/system/ip-pools/:pool/ranges', handler(handlers['systemIpPoolRangeList'], schema.SystemIpPoolRangeListParams, null) @@ -3302,26 +3294,6 @@ export function makeHandlers(handlers: MSWHandlers): HttpHandler[] { null ) ), - http.get( - '/v1/system/ip-pools-service', - handler(handlers['systemIpPoolServiceView'], null, null) - ), - http.get( - '/v1/system/ip-pools-service/ranges', - handler( - handlers['systemIpPoolServiceRangeList'], - schema.SystemIpPoolServiceRangeListParams, - null - ) - ), - http.post( - '/v1/system/ip-pools-service/ranges/add', - handler(handlers['systemIpPoolServiceRangeAdd'], null, schema.IpRange) - ), - http.post( - '/v1/system/ip-pools-service/ranges/remove', - handler(handlers['systemIpPoolServiceRangeRemove'], null, schema.IpRange) - ), http.get( '/v1/system/metrics/:metricName', handler(handlers['systemMetric'], schema.SystemMetricParams, null) diff --git a/app/api/__generated__/validate.ts b/app/api/__generated__/validate.ts index cc5b26724..9145d37bc 100644 --- a/app/api/__generated__/validate.ts +++ b/app/api/__generated__/validate.ts @@ -2780,6 +2780,14 @@ export const InternetGatewayResultsPage = z.preprocess( z.object({ items: InternetGateway.array(), nextPage: z.string().nullable().optional() }) ) +/** + * Assignment of an IP pool to resources and services. + */ +export const IpPoolAssignment = z.preprocess( + processResponseBody, + z.enum(['silos', 'system_services']) +) + /** * Type of IP pool. */ @@ -2789,11 +2797,12 @@ export const IpPoolType = z.preprocess( ) /** - * A collection of IP ranges. If a pool is linked to a silo, IP addresses from the pool can be allocated within that silo. + * A collection of IP ranges. */ export const IpPool = z.preprocess( processResponseBody, z.object({ + assignment: IpPoolAssignment, description: z.string(), id: z.uuid(), ipVersion: IpVersion, @@ -2804,6 +2813,14 @@ export const IpPool = z.preprocess( }) ) +/** + * Body parameters for reassigning an IP pool. + */ +export const IpPoolAssignParam = z.preprocess( + processResponseBody, + z.object({ assignment: IpPoolAssignment }) +) + /** * Create-time parameters for an `IpPool`. * @@ -2814,6 +2831,7 @@ export const IpPool = z.preprocess( export const IpPoolCreate = z.preprocess( processResponseBody, z.object({ + assignment: IpPoolAssignment.default('silos'), description: z.string(), ipVersion: IpVersion.default('v4'), name: Name, @@ -6629,8 +6647,10 @@ export const IpPoolListParams = z.preprocess( z.object({ path: z.object({}), query: z.object({ + ipVersion: IpVersion.optional(), limit: z.number().min(1).max(4294967295).nullable().optional(), pageToken: z.string().nullable().optional(), + poolType: IpPoolType.optional(), sortBy: NameOrIdSortMode.optional(), }), }) @@ -7418,8 +7438,11 @@ export const SystemIpPoolListParams = z.preprocess( z.object({ path: z.object({}), query: z.object({ + assignment: IpPoolAssignment.optional(), + ipVersion: IpVersion.optional(), limit: z.number().min(1).max(4294967295).nullable().optional(), pageToken: z.string().nullable().optional(), + poolType: IpPoolType.optional(), sortBy: NameOrIdSortMode.optional(), }), }) @@ -7463,6 +7486,16 @@ export const SystemIpPoolDeleteParams = z.preprocess( }) ) +export const SystemIpPoolAssignParams = z.preprocess( + processResponseBody, + z.object({ + path: z.object({ + pool: NameOrId, + }), + query: z.object({}), + }) +) + export const SystemIpPoolRangeListParams = z.preprocess( processResponseBody, z.object({ @@ -7552,41 +7585,6 @@ export const SystemIpPoolUtilizationViewParams = z.preprocess( }) ) -export const SystemIpPoolServiceViewParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({}), - query: z.object({}), - }) -) - -export const SystemIpPoolServiceRangeListParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({}), - query: z.object({ - limit: z.number().min(1).max(4294967295).nullable().optional(), - pageToken: z.string().nullable().optional(), - }), - }) -) - -export const SystemIpPoolServiceRangeAddParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({}), - query: z.object({}), - }) -) - -export const SystemIpPoolServiceRangeRemoveParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({}), - query: z.object({}), - }) -) - export const SystemMetricParams = z.preprocess( processResponseBody, z.object({ From 6a645de0134f51c65194f9e071d8ef062d4e4799 Mon Sep 17 00:00:00 2001 From: David Crespo Date: Sat, 8 Aug 2026 15:50:14 -0400 Subject: [PATCH 2/4] fix errors --- app/components/IpPoolDetailSideModal.tsx | 4 ++-- mock-api/ip-pool.ts | 7 +++++++ mock-api/msw/handlers.ts | 6 ++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/components/IpPoolDetailSideModal.tsx b/app/components/IpPoolDetailSideModal.tsx index 7b74063fb..3b97a7828 100644 --- a/app/components/IpPoolDetailSideModal.tsx +++ b/app/components/IpPoolDetailSideModal.tsx @@ -5,7 +5,7 @@ * * Copyright Oxide Computer Company */ -import { type IpPool } from '@oxide/api' +import { type SiloIpPool } from '@oxide/api' import { IpGlobal16Icon } from '@oxide/design-system/icons/react' import { Badge } from '@oxide/design-system/ui' @@ -17,7 +17,7 @@ import { ResourceLabel } from '~/ui/lib/SideModal' import { docLinks } from '~/util/links' type IpPoolDetailSideModalProps = { - pool: IpPool + pool: SiloIpPool onDismiss: () => void } diff --git a/mock-api/ip-pool.ts b/mock-api/ip-pool.ts index 247c9c574..b902a86ef 100644 --- a/mock-api/ip-pool.ts +++ b/mock-api/ip-pool.ts @@ -17,6 +17,7 @@ export const ipPool1: Json = { description: 'public IPs', time_created: new Date().toISOString(), time_modified: new Date().toISOString(), + assignment: 'silos', ip_version: 'v4', pool_type: 'unicast', } @@ -27,6 +28,7 @@ export const ipPool2: Json = { description: 'VPN IPs', time_created: new Date().toISOString(), time_modified: new Date().toISOString(), + assignment: 'silos', ip_version: 'v6', pool_type: 'unicast', } @@ -37,6 +39,7 @@ export const ipPool3: Json = { description: '', time_created: new Date().toISOString(), time_modified: new Date().toISOString(), + assignment: 'silos', ip_version: 'v4', pool_type: 'unicast', } @@ -47,6 +50,7 @@ export const ipPool4: Json = { description: '', time_created: new Date().toISOString(), time_modified: new Date().toISOString(), + assignment: 'silos', ip_version: 'v6', pool_type: 'unicast', } @@ -58,6 +62,7 @@ export const ipPool5Multicast: Json = { description: 'Multicast v4 pool', time_created: new Date().toISOString(), time_modified: new Date().toISOString(), + assignment: 'silos', ip_version: 'v4', pool_type: 'multicast', } @@ -68,6 +73,7 @@ export const ipPool6Multicast: Json = { description: 'Multicast v6 pool', time_created: new Date().toISOString(), time_modified: new Date().toISOString(), + assignment: 'silos', ip_version: 'v6', pool_type: 'multicast', } @@ -80,6 +86,7 @@ export const ipPoolEphemeralAttachFail: Json = { description: 'Sentinel: ephemeral IP attach returns 500', time_created: new Date().toISOString(), time_modified: new Date().toISOString(), + assignment: 'silos', ip_version: 'v6', pool_type: 'unicast', } diff --git a/mock-api/msw/handlers.ts b/mock-api/msw/handlers.ts index 5f2b05637..cad779d02 100644 --- a/mock-api/msw/handlers.ts +++ b/mock-api/msw/handlers.ts @@ -1418,6 +1418,7 @@ export const handlers = makeHandlers({ // See https://zod.dev/v4/changelog?id=defaults-applied-within-optional-fields#defaults-applied-within-optional-fields ip_version: body.ip_version || 'v4', pool_type: body.pool_type || 'unicast', + assignment: body.assignment || 'silos', ...getTimestamps(), } db.ipPools.push(newPool) @@ -2657,10 +2658,6 @@ export const handlers = makeHandlers({ internetGatewayIpAddressDelete: NotImplemented, internetGatewayIpPoolCreate: NotImplemented, internetGatewayIpPoolDelete: NotImplemented, - systemIpPoolServiceRangeAdd: NotImplemented, - systemIpPoolServiceRangeList: NotImplemented, - systemIpPoolServiceRangeRemove: NotImplemented, - systemIpPoolServiceView: NotImplemented, localIdpUserCreate: NotImplemented, localIdpUserDelete: NotImplemented, localIdpUserSetPassword: NotImplemented, @@ -2736,6 +2733,7 @@ export const handlers = makeHandlers({ supportBundleUpdate: NotImplemented, supportBundleView: NotImplemented, switchView: NotImplemented, + systemIpPoolAssign: NotImplemented, systemNetworkingSettingsUpdate: NotImplemented, systemNetworkingSettingsView: NotImplemented, systemQuotasList: NotImplemented, From eb1afd873c7f86cf900e39d1587a1d1a01a12e1a Mon Sep 17 00:00:00 2001 From: David Crespo Date: Mon, 10 Aug 2026 13:54:33 -0500 Subject: [PATCH 3/4] filter system service pools from IP pool lists for now --- app/pages/system/networking/IpPoolsPage.tsx | 8 ++++++-- app/pages/system/silos/SiloIpPoolsTab.tsx | 5 ++++- mock-api/ip-pool.ts | 12 ++++++++++++ mock-api/msw/handlers.ts | 5 ++++- test/e2e/ip-pools.e2e.ts | 2 ++ test/e2e/silos.e2e.ts | 4 ++++ 6 files changed, 32 insertions(+), 4 deletions(-) diff --git a/app/pages/system/networking/IpPoolsPage.tsx b/app/pages/system/networking/IpPoolsPage.tsx index 64e14c3d4..6e83812c0 100644 --- a/app/pages/system/networking/IpPoolsPage.tsx +++ b/app/pages/system/networking/IpPoolsPage.tsx @@ -76,7 +76,11 @@ const staticColumns = [ colHelper.accessor('timeCreated', Columns.timeCreated), ] -const ipPoolList = getListQFn(api.systemIpPoolList, {}) +// Filter out system services pools. Eventually we probably want to show both +// types of pool, with a column indicating the assignment, but for now keep the +// page working like it did before the service and silo pool lists were unified. +// There is currently no way to manage service pools in the console. +const ipPoolList = getListQFn(api.systemIpPoolList, { query: { assignment: 'silos' } }) export async function clientLoader() { await queryClient.prefetchQuery(ipPoolList.optionsFn()) @@ -130,7 +134,7 @@ export default function IpPoolsPage() { }) const { data: allPools } = useQuery( - q(api.systemIpPoolList, { query: { limit: ALL_ISH } }) + q(api.systemIpPoolList, { query: { assignment: 'silos', limit: ALL_ISH } }) ) useQuickActions( diff --git a/app/pages/system/silos/SiloIpPoolsTab.tsx b/app/pages/system/silos/SiloIpPoolsTab.tsx index eaab1e628..7c22514e1 100644 --- a/app/pages/system/silos/SiloIpPoolsTab.tsx +++ b/app/pages/system/silos/SiloIpPoolsTab.tsx @@ -91,7 +91,10 @@ function EmptyState({ onLinkPool }: { onLinkPool: () => void }) { const colHelper = createColumnHelper() -const allPoolsQuery = getListQFn(api.systemIpPoolList, { query: { limit: ALL_ISH } }) +// system service pools cannot be linked to silos +const allPoolsQuery = getListQFn(api.systemIpPoolList, { + query: { assignment: 'silos', limit: ALL_ISH }, +}) const allSiloPoolsQuery = (silo: string) => getListQFn(api.siloIpPoolList, { path: { silo }, query: { limit: ALL_ISH } }) diff --git a/mock-api/ip-pool.ts b/mock-api/ip-pool.ts index b902a86ef..b0e184bad 100644 --- a/mock-api/ip-pool.ts +++ b/mock-api/ip-pool.ts @@ -91,6 +91,17 @@ export const ipPoolEphemeralAttachFail: Json = { pool_type: 'unicast', } +export const systemServicesIpPool: Json = { + id: 'd2d2e5c1-6d18-4c83-ae62-849f187df1ce', + name: 'service-pool-v4', + description: 'IPv4 pool for system services', + time_created: new Date().toISOString(), + time_modified: new Date().toISOString(), + assignment: 'system_services', + ip_version: 'v4', + pool_type: 'unicast', +} + export const ipPools: Json[] = [ ipPool1, ipPool2, @@ -99,6 +110,7 @@ export const ipPools: Json[] = [ ipPool5Multicast, ipPool6Multicast, ipPoolEphemeralAttachFail, + systemServicesIpPool, ] export const ipPoolSilos: Json[] = [ diff --git a/mock-api/msw/handlers.ts b/mock-api/msw/handlers.ts index cad779d02..c21817f67 100644 --- a/mock-api/msw/handlers.ts +++ b/mock-api/msw/handlers.ts @@ -1203,7 +1203,10 @@ export const handlers = makeHandlers({ }, systemIpPoolList: ({ query, cookies }) => { requireFleetViewer(cookies) - return paginated(query, db.ipPools) + const pools = query.assignment + ? db.ipPools.filter((pool) => pool.assignment === query.assignment) + : db.ipPools + return paginated(query, pools) }, systemIpPoolUtilizationView({ path, cookies }) { requireFleetViewer(cookies) diff --git a/test/e2e/ip-pools.e2e.ts b/test/e2e/ip-pools.e2e.ts index 5e6b19f30..700d3a880 100644 --- a/test/e2e/ip-pools.e2e.ts +++ b/test/e2e/ip-pools.e2e.ts @@ -21,6 +21,8 @@ test('IP pool list', async ({ page }) => { await expect(table.getByRole('row')).toHaveCount(8) // header + 7 rows (includes multicast pools and `attach-fail` sentinel) + await expect(table.getByRole('cell', { name: 'service-pool-v4' })).toBeHidden() + await expectRowVisible(table, { name: 'ip-pool-1', 'IPs REMAINING': '15 / 24', diff --git a/test/e2e/silos.e2e.ts b/test/e2e/silos.e2e.ts index 175e41c24..f51961cdc 100644 --- a/test/e2e/silos.e2e.ts +++ b/test/e2e/silos.e2e.ts @@ -370,6 +370,10 @@ test('Silo IP pools link pool', async ({ page }) => { await page.getByPlaceholder('Select a pool').fill('x') await expect(page.getByText('No items match')).toBeVisible() + // system service pools cannot be linked to silos + await page.getByPlaceholder('Select a pool').fill('service-pool-v4') + await expect(page.getByText('No items match')).toBeVisible() + // before a pool is selected, the default checkbox label is generic await expect( page.getByRole('checkbox', { name: 'Make default pool for silo' }) From 280d3b8229c9de785cecafc9b70f7a36a7958440 Mon Sep 17 00:00:00 2001 From: David Crespo Date: Mon, 10 Aug 2026 14:14:54 -0500 Subject: [PATCH 4/4] fix mock silo IP pool responses --- mock-api/msw/db.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/mock-api/msw/db.ts b/mock-api/msw/db.ts index 9986205ed..631f65173 100644 --- a/mock-api/msw/db.ts +++ b/mock-api/msw/db.ts @@ -123,6 +123,22 @@ export const getIpFromPool = (pool: Json) => { return ipPoolRange.range.first } +const toSiloIpPool = ( + pool: Json, + isDefault: boolean +): Json => ({ + ...R.pick(pool, [ + 'description', + 'id', + 'ip_version', + 'name', + 'pool_type', + 'time_created', + 'time_modified', + ]), + is_default: isDefault, +}) + export const lookup = { affinityGroup({ affinityGroup: id, @@ -498,7 +514,7 @@ export const lookup = { throw json({ message }, { status: 500 }) } - return { ...pool, is_default: link.is_default } + return toSiloIpPool(pool, link.is_default) }) }, siloIpPool(path: Sel.Silo & Sel.IpPool): Json { @@ -513,7 +529,7 @@ export const lookup = { throw notFoundErr(`link for pool '${path.pool}' and silo '${path.silo}'`) } - return { ...pool, is_default: ipPoolSilo.is_default } + return toSiloIpPool(pool, ipPoolSilo.is_default) }, siloDefaultIpPool(path: Sel.Silo): Json { const silo = lookup.silo(path)