From 1fb1db8d9b4823198a1051646816abb8c712ffef Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Fri, 29 Dec 2023 15:14:09 +0000 Subject: [PATCH] feat: update generated APIs --- packages/clients/src/api/ipam/v1/index.gen.ts | 1 + .../src/api/ipam/v1/marshalling.gen.ts | 27 +++++++++++++++++++ packages/clients/src/api/ipam/v1/types.gen.ts | 14 ++++++++++ 3 files changed, 42 insertions(+) diff --git a/packages/clients/src/api/ipam/v1/index.gen.ts b/packages/clients/src/api/ipam/v1/index.gen.ts index 7e0df4959..8e9bc4578 100644 --- a/packages/clients/src/api/ipam/v1/index.gen.ts +++ b/packages/clients/src/api/ipam/v1/index.gen.ts @@ -11,6 +11,7 @@ export type { ReleaseIPRequest, Resource, ResourceType, + Reverse, Source, UpdateIPRequest, } from './types.gen' diff --git a/packages/clients/src/api/ipam/v1/marshalling.gen.ts b/packages/clients/src/api/ipam/v1/marshalling.gen.ts index 7751be623..29cb9a54c 100644 --- a/packages/clients/src/api/ipam/v1/marshalling.gen.ts +++ b/packages/clients/src/api/ipam/v1/marshalling.gen.ts @@ -12,6 +12,7 @@ import type { IP, ListIPsResponse, Resource, + Reverse, Source, UpdateIPRequest, } from './types.gen' @@ -31,6 +32,19 @@ const unmarshalResource = (data: unknown): Resource => { } as Resource } +const unmarshalReverse = (data: unknown): Reverse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Reverse' failed as data isn't a dictionary.`, + ) + } + + return { + address: data.address, + hostname: data.hostname, + } as Reverse +} + const unmarshalSource = (data: unknown): Source => { if (!isJSONObject(data)) { throw new TypeError( @@ -60,6 +74,7 @@ export const unmarshalIP = (data: unknown): IP => { projectId: data.project_id, region: data.region, resource: data.resource ? unmarshalResource(data.resource) : undefined, + reverses: unmarshalArrayOfObject(data.reverses, unmarshalReverse), source: unmarshalSource(data.source), tags: data.tags, updatedAt: unmarshalDate(data.updated_at), @@ -102,9 +117,21 @@ export const marshalBookIPRequest = ( tags: request.tags, }) +const marshalReverse = ( + request: Reverse, + defaults: DefaultValues, +): Record => ({ + address: request.address, + hostname: request.hostname, +}) + export const marshalUpdateIPRequest = ( request: UpdateIPRequest, defaults: DefaultValues, ): Record => ({ + reverses: + request.reverses !== undefined + ? request.reverses.map(elt => marshalReverse(elt, defaults)) + : undefined, tags: request.tags, }) diff --git a/packages/clients/src/api/ipam/v1/types.gen.ts b/packages/clients/src/api/ipam/v1/types.gen.ts index be1fd188b..ad2f725f4 100644 --- a/packages/clients/src/api/ipam/v1/types.gen.ts +++ b/packages/clients/src/api/ipam/v1/types.gen.ts @@ -40,6 +40,13 @@ export interface Resource { name?: string } +export interface Reverse { + /** Reverse domain name. */ + hostname: string + /** IP corresponding to the hostname. */ + address?: string +} + export interface Source { /** * This source is global. @@ -83,6 +90,8 @@ export interface IP { resource?: Resource /** Tags for the IP. */ tags: string[] + /** Array of reverses associated with the IP. */ + reverses: Reverse[] /** Region of the IP. */ region: Region /** Zone of the IP, if zonal. */ @@ -214,4 +223,9 @@ export type UpdateIPRequest = { ipId: string /** Tags for the IP. */ tags?: string[] + /** + * Array of reverse domain names associated with an IP in the subnet of the + * current IP. + */ + reverses?: Reverse[] }