diff --git a/packages/clients/src/api/vpc/index.ts b/packages/clients/src/api/vpc/index.ts index 73ddaf23c..cd5521c9c 100644 --- a/packages/clients/src/api/vpc/index.ts +++ b/packages/clients/src/api/vpc/index.ts @@ -1 +1,2 @@ export * as v1 from './v1/index.gen' +export * as v2 from './v2/index.gen' diff --git a/packages/clients/src/api/vpc/v2/api.gen.ts b/packages/clients/src/api/vpc/v2/api.gen.ts new file mode 100644 index 000000000..f1021d95c --- /dev/null +++ b/packages/clients/src/api/vpc/v2/api.gen.ts @@ -0,0 +1,411 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +import { + API as ParentAPI, + enrichForPagination, + urlParams, + validatePathParam, +} from '../../../bridge' +import type { Region } from '../../../bridge' +import { + marshalAddSubnetsRequest, + marshalCreatePrivateNetworkRequest, + marshalCreateVPCRequest, + marshalDeleteSubnetsRequest, + marshalMigrateZonalPrivateNetworksRequest, + marshalSetSubnetsRequest, + marshalUpdatePrivateNetworkRequest, + marshalUpdateVPCRequest, + unmarshalAddSubnetsResponse, + unmarshalDeleteSubnetsResponse, + unmarshalListPrivateNetworksResponse, + unmarshalListVPCsResponse, + unmarshalPrivateNetwork, + unmarshalSetSubnetsResponse, + unmarshalVPC, +} from './marshalling.gen' +import type { + AddSubnetsRequest, + AddSubnetsResponse, + CreatePrivateNetworkRequest, + CreateVPCRequest, + DeletePrivateNetworkRequest, + DeleteSubnetsRequest, + DeleteSubnetsResponse, + DeleteVPCRequest, + GetPrivateNetworkRequest, + GetVPCRequest, + ListPrivateNetworksRequest, + ListPrivateNetworksResponse, + ListVPCsRequest, + ListVPCsResponse, + MigrateZonalPrivateNetworksRequest, + PrivateNetwork, + SetSubnetsRequest, + SetSubnetsResponse, + UpdatePrivateNetworkRequest, + UpdateVPCRequest, + VPC, +} from './types.gen' + +const jsonContentHeaders = { + 'Content-Type': 'application/json; charset=utf-8', +} + +/** VPC API. */ +export class API extends ParentAPI { + /** Lists the available regions of the API. */ + public static readonly LOCALITIES: Region[] = ['fr-par', 'nl-ams', 'pl-waw'] + + protected pageOfListVPCs = (request: Readonly = {}) => + this.client.fetch( + { + method: 'GET', + path: `/vpc/v2/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/vpcs`, + urlParams: urlParams( + ['is_default', request.isDefault], + ['name', request.name], + ['order_by', request.orderBy ?? 'created_at_asc'], + ['organization_id', request.organizationId], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['project_id', request.projectId], + ['tags', request.tags], + ), + }, + unmarshalListVPCsResponse, + ) + + /** + * List VPCs. List existing VPCs in the specified region. + * + * @param request - The request {@link ListVPCsRequest} + * @returns A Promise of ListVPCsResponse + */ + listVPCs = (request: Readonly = {}) => + enrichForPagination('vpcs', this.pageOfListVPCs, request) + + /** + * Create a VPC. Create a new VPC in the specified region. + * + * @param request - The request {@link CreateVPCRequest} + * @returns A Promise of VPC + */ + createVPC = (request: Readonly = {}) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreateVPCRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/vpc/v2/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/vpcs`, + }, + unmarshalVPC, + ) + + /** + * Get a VPC. Retrieve details of an existing VPC, specified by its VPC ID. + * + * @param request - The request {@link GetVPCRequest} + * @returns A Promise of VPC + */ + getVPC = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/vpc/v2/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/vpcs/${validatePathParam('vpcId', request.vpcId)}`, + }, + unmarshalVPC, + ) + + /** + * Update VPC. Update parameters including name and tags of the specified VPC. + * + * @param request - The request {@link UpdateVPCRequest} + * @returns A Promise of VPC + */ + updateVPC = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpdateVPCRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/vpc/v2/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/vpcs/${validatePathParam('vpcId', request.vpcId)}`, + }, + unmarshalVPC, + ) + + /** + * Delete a VPC. Delete a VPC specified by its VPC ID. + * + * @param request - The request {@link DeleteVPCRequest} + */ + deleteVPC = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/vpc/v2/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/vpcs/${validatePathParam('vpcId', request.vpcId)}`, + }) + + protected pageOfListPrivateNetworks = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + method: 'GET', + path: `/vpc/v2/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/private-networks`, + urlParams: urlParams( + ['name', request.name], + ['order_by', request.orderBy ?? 'created_at_asc'], + ['organization_id', request.organizationId], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + ['private_network_ids', request.privateNetworkIds], + ['project_id', request.projectId], + ['tags', request.tags], + ['vpc_id', request.vpcId], + ), + }, + unmarshalListPrivateNetworksResponse, + ) + + /** + * List Private Networks. List existing Private Networks in the specified + * region. By default, the Private Networks returned in the list are ordered + * by creation date in ascending order, though this can be modified via the + * order_by field. + * + * @param request - The request {@link ListPrivateNetworksRequest} + * @returns A Promise of ListPrivateNetworksResponse + */ + listPrivateNetworks = (request: Readonly = {}) => + enrichForPagination( + 'privateNetworks', + this.pageOfListPrivateNetworks, + request, + ) + + /** + * Create a Private Network. Create a new Private Network. Once created, you + * can attach Scaleway resources which are in the same region. + * + * @param request - The request {@link CreatePrivateNetworkRequest} + * @returns A Promise of PrivateNetwork + */ + createPrivateNetwork = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreatePrivateNetworkRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/vpc/v2/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/private-networks`, + }, + unmarshalPrivateNetwork, + ) + + /** + * Get a Private Network. Retrieve information about an existing Private + * Network, specified by its Private Network ID. Its full details are returned + * in the response object. + * + * @param request - The request {@link GetPrivateNetworkRequest} + * @returns A Promise of PrivateNetwork + */ + getPrivateNetwork = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/vpc/v2/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/private-networks/${validatePathParam( + 'privateNetworkId', + request.privateNetworkId, + )}`, + }, + unmarshalPrivateNetwork, + ) + + /** + * Update Private Network. Update parameters (such as name or tags) of an + * existing Private Network, specified by its Private Network ID. + * + * @param request - The request {@link UpdatePrivateNetworkRequest} + * @returns A Promise of PrivateNetwork + */ + updatePrivateNetwork = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpdatePrivateNetworkRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/vpc/v2/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/private-networks/${validatePathParam( + 'privateNetworkId', + request.privateNetworkId, + )}`, + }, + unmarshalPrivateNetwork, + ) + + /** + * Delete a Private Network. Delete an existing Private Network. Note that you + * must first detach all resources from the network, in order to delete it. + * + * @param request - The request {@link DeletePrivateNetworkRequest} + */ + deletePrivateNetwork = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/vpc/v2/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/private-networks/${validatePathParam( + 'privateNetworkId', + request.privateNetworkId, + )}`, + }) + + /** + * Migrate Private Networks from zoned to regional. Transform multiple + * existing zoned Private Networks (scoped to a single Availability Zone) into + * regional Private Networks, scoped to an entire region. You can transform + * one or many Private Networks (specified by their Private Network IDs) + * within a single Scaleway Organization or Project, with the same call. + * + * @param request - The request {@link MigrateZonalPrivateNetworksRequest} + */ + migrateZonalPrivateNetworks = ( + request: Readonly = {}, + ) => + this.client.fetch({ + body: JSON.stringify( + marshalMigrateZonalPrivateNetworksRequest( + request, + this.client.settings, + ), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/vpc/v2/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/private-networks/migrate-zonal`, + }) + + /** + * Set the subnets of a Private Network. Set subnets for an existing Private + * Network. Note that the method is PUT and not PATCH. Any existing subnets + * will be removed in favor of the new specified set of subnets. + * + * @param request - The request {@link SetSubnetsRequest} + * @returns A Promise of SetSubnetsResponse + */ + setSubnets = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalSetSubnetsRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PUT', + path: `/vpc/v2/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/private-networks/${validatePathParam( + 'privateNetworkId', + request.privateNetworkId, + )}/subnets`, + }, + unmarshalSetSubnetsResponse, + ) + + /** + * Add subnets to a Private Network. Add new subnets to an existing Private + * Network. + * + * @param request - The request {@link AddSubnetsRequest} + * @returns A Promise of AddSubnetsResponse + */ + addSubnets = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalAddSubnetsRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/vpc/v2/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/private-networks/${validatePathParam( + 'privateNetworkId', + request.privateNetworkId, + )}/subnets`, + }, + unmarshalAddSubnetsResponse, + ) + + /** + * Delete subnets from a Private Network. Delete the specified subnets from a + * Private Network. + * + * @param request - The request {@link DeleteSubnetsRequest} + * @returns A Promise of DeleteSubnetsResponse + */ + deleteSubnets = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalDeleteSubnetsRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'DELETE', + path: `/vpc/v2/regions/${validatePathParam( + 'region', + request.region ?? this.client.settings.defaultRegion, + )}/private-networks/${validatePathParam( + 'privateNetworkId', + request.privateNetworkId, + )}/subnets`, + }, + unmarshalDeleteSubnetsResponse, + ) +} diff --git a/packages/clients/src/api/vpc/v2/index.gen.ts b/packages/clients/src/api/vpc/v2/index.gen.ts new file mode 100644 index 000000000..493a12aa7 --- /dev/null +++ b/packages/clients/src/api/vpc/v2/index.gen.ts @@ -0,0 +1,29 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +export { API } from './api.gen' +export type { + AddSubnetsRequest, + AddSubnetsResponse, + CreatePrivateNetworkRequest, + CreateVPCRequest, + DeletePrivateNetworkRequest, + DeleteSubnetsRequest, + DeleteSubnetsResponse, + DeleteVPCRequest, + GetPrivateNetworkRequest, + GetVPCRequest, + ListPrivateNetworksRequest, + ListPrivateNetworksRequestOrderBy, + ListPrivateNetworksResponse, + ListVPCsRequest, + ListVPCsRequestOrderBy, + ListVPCsResponse, + MigrateZonalPrivateNetworksRequest, + PrivateNetwork, + SetSubnetsRequest, + SetSubnetsResponse, + Subnet, + UpdatePrivateNetworkRequest, + UpdateVPCRequest, + VPC, +} from './types.gen' diff --git a/packages/clients/src/api/vpc/v2/marshalling.gen.ts b/packages/clients/src/api/vpc/v2/marshalling.gen.ts new file mode 100644 index 000000000..091e25b51 --- /dev/null +++ b/packages/clients/src/api/vpc/v2/marshalling.gen.ts @@ -0,0 +1,219 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +import randomName from '@scaleway/random-name' +import { + isJSONObject, + resolveOneOf, + unmarshalArrayOfObject, + unmarshalDate, +} from '../../../bridge' +import type { DefaultValues } from '../../../bridge' +import type { + AddSubnetsRequest, + AddSubnetsResponse, + CreatePrivateNetworkRequest, + CreateVPCRequest, + DeleteSubnetsRequest, + DeleteSubnetsResponse, + ListPrivateNetworksResponse, + ListVPCsResponse, + MigrateZonalPrivateNetworksRequest, + PrivateNetwork, + SetSubnetsRequest, + SetSubnetsResponse, + Subnet, + UpdatePrivateNetworkRequest, + UpdateVPCRequest, + VPC, +} from './types.gen' + +const unmarshalSubnet = (data: unknown) => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Subnet' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + id: data.id, + subnet: data.subnet, + updatedAt: unmarshalDate(data.updated_at), + } as Subnet +} + +export const unmarshalPrivateNetwork = (data: unknown) => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'PrivateNetwork' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + id: data.id, + name: data.name, + organizationId: data.organization_id, + projectId: data.project_id, + region: data.region, + subnets: unmarshalArrayOfObject(data.subnets, unmarshalSubnet), + tags: data.tags, + updatedAt: unmarshalDate(data.updated_at), + vpcId: data.vpc_id, + } as PrivateNetwork +} + +export const unmarshalVPC = (data: unknown) => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'VPC' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + id: data.id, + isDefault: data.is_default, + name: data.name, + organizationId: data.organization_id, + projectId: data.project_id, + region: data.region, + tags: data.tags, + updatedAt: unmarshalDate(data.updated_at), + } as VPC +} + +export const unmarshalAddSubnetsResponse = (data: unknown) => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'AddSubnetsResponse' failed as data isn't a dictionary.`, + ) + } + + return { subnets: data.subnets } as AddSubnetsResponse +} + +export const unmarshalDeleteSubnetsResponse = (data: unknown) => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'DeleteSubnetsResponse' failed as data isn't a dictionary.`, + ) + } + + return { subnets: data.subnets } as DeleteSubnetsResponse +} + +export const unmarshalListPrivateNetworksResponse = (data: unknown) => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListPrivateNetworksResponse' failed as data isn't a dictionary.`, + ) + } + + return { + privateNetworks: unmarshalArrayOfObject( + data.private_networks, + unmarshalPrivateNetwork, + ), + totalCount: data.total_count, + } as ListPrivateNetworksResponse +} + +export const unmarshalListVPCsResponse = (data: unknown) => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListVPCsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + totalCount: data.total_count, + vpcs: unmarshalArrayOfObject(data.vpcs, unmarshalVPC), + } as ListVPCsResponse +} + +export const unmarshalSetSubnetsResponse = (data: unknown) => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'SetSubnetsResponse' failed as data isn't a dictionary.`, + ) + } + + return { subnets: data.subnets } as SetSubnetsResponse +} + +export const marshalAddSubnetsRequest = ( + request: AddSubnetsRequest, + defaults: DefaultValues, +): Record => ({ + subnets: request.subnets, +}) + +export const marshalCreatePrivateNetworkRequest = ( + request: CreatePrivateNetworkRequest, + defaults: DefaultValues, +): Record => ({ + name: request.name || randomName('pn'), + project_id: request.projectId ?? defaults.defaultProjectId, + subnets: request.subnets, + tags: request.tags, + vpc_id: request.vpcId, +}) + +export const marshalCreateVPCRequest = ( + request: CreateVPCRequest, + defaults: DefaultValues, +): Record => ({ + name: request.name || randomName('vpc'), + project_id: request.projectId ?? defaults.defaultProjectId, + tags: request.tags, +}) + +export const marshalDeleteSubnetsRequest = ( + request: DeleteSubnetsRequest, + defaults: DefaultValues, +): Record => ({ + subnets: request.subnets, +}) + +export const marshalMigrateZonalPrivateNetworksRequest = ( + request: MigrateZonalPrivateNetworksRequest, + defaults: DefaultValues, +): Record => ({ + private_network_ids: request.privateNetworkIds, + ...resolveOneOf([ + { + default: defaults.defaultProjectId, + param: 'project_id', + value: request.projectId, + }, + { + default: defaults.defaultOrganizationId, + param: 'organization_id', + value: request.organizationId, + }, + ]), +}) + +export const marshalSetSubnetsRequest = ( + request: SetSubnetsRequest, + defaults: DefaultValues, +): Record => ({ + subnets: request.subnets, +}) + +export const marshalUpdatePrivateNetworkRequest = ( + request: UpdatePrivateNetworkRequest, + defaults: DefaultValues, +): Record => ({ + name: request.name, + tags: request.tags, +}) + +export const marshalUpdateVPCRequest = ( + request: UpdateVPCRequest, + defaults: DefaultValues, +): Record => ({ + name: request.name, + tags: request.tags, +}) diff --git a/packages/clients/src/api/vpc/v2/types.gen.ts b/packages/clients/src/api/vpc/v2/types.gen.ts new file mode 100644 index 000000000..2d72baf53 --- /dev/null +++ b/packages/clients/src/api/vpc/v2/types.gen.ts @@ -0,0 +1,340 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. +import type { Region } from '../../../bridge' + +export type ListPrivateNetworksRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + | 'name_asc' + | 'name_desc' + +export type ListVPCsRequestOrderBy = + | 'created_at_asc' + | 'created_at_desc' + | 'name_asc' + | 'name_desc' + +export interface AddSubnetsResponse { + subnets: string[] +} + +export interface DeleteSubnetsResponse { + subnets: string[] +} + +export interface ListPrivateNetworksResponse { + privateNetworks: PrivateNetwork[] + totalCount: number +} + +export interface ListVPCsResponse { + vpcs: VPC[] + totalCount: number +} + +/** Private network. */ +export interface PrivateNetwork { + /** Private Network ID. */ + id: string + /** Private Network name. */ + name: string + /** Scaleway Organization the Private Network belongs to. */ + organizationId: string + /** Scaleway Project the Private Network belongs to. */ + projectId: string + /** Region in which the Private Network is available. */ + region: Region + /** Tags of the Private Network. */ + tags: string[] + /** Date the Private Network was created. */ + createdAt?: Date + /** Date the Private Network was last modified. */ + updatedAt?: Date + /** Private Network subnets. */ + subnets: Subnet[] + /** VPC the Private Network belongs to. */ + vpcId: string +} + +export interface SetSubnetsResponse { + subnets: string[] +} + +/** Subnet. */ +export interface Subnet { + /** ID of the subnet. */ + id: string + /** Subnet creation date. */ + createdAt?: Date + /** Subnet last modification date. */ + updatedAt?: Date + /** Subnet CIDR. */ + subnet: string +} + +/** Vpc. */ +export interface VPC { + /** VPC ID. */ + id: string + /** VPC name. */ + name: string + /** Scaleway Organization the VPC belongs to. */ + organizationId: string + /** Scaleway Project the VPC belongs to. */ + projectId: string + /** Region of the VPC. */ + region: Region + /** Tags for the VPC. */ + tags: string[] + /** Defines whether the VPC is the default one for its Project. */ + isDefault: boolean + /** Date the VPC was created. */ + createdAt?: Date + /** Date the VPC was last modified. */ + updatedAt?: Date +} + +export type ListVPCsRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Sort order of the returned VPCs. */ + orderBy?: ListVPCsRequestOrderBy + /** Page number to return, from the paginated results. */ + page?: number + /** Maximum number of VPCs to return per page. */ + pageSize?: number + /** + * Name to filter for. Only VPCs with names containing this string will be + * returned. + */ + name?: string + /** + * Tags to filter for. Only VPCs with one more more matching tags will be + * returned. + */ + tags?: string[] + /** + * Organization ID to filter for. Only VPCs belonging to this Organization + * will be returned. + */ + organizationId?: string + /** + * Project ID to filter for. Only VPCs belonging to this Project will be + * returned. + */ + projectId?: string + /** + * Defines whether to filter only for VPCs which are the default one for their + * Project. + */ + isDefault?: boolean +} + +export type CreateVPCRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Name for the VPC. */ + name?: string + /** Scaleway Project in which to create the VPC. */ + projectId?: string + /** Tags for the VPC. */ + tags?: string[] +} + +export type GetVPCRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** VPC ID. */ + vpcId: string +} + +export type UpdateVPCRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** VPC ID. */ + vpcId: string + /** Name for the VPC. */ + name?: string + /** Tags for the VPC. */ + tags?: string[] +} + +export type DeleteVPCRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** VPC ID. */ + vpcId: string +} + +export type ListPrivateNetworksRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Sort order of the returned Private Networks. */ + orderBy?: ListPrivateNetworksRequestOrderBy + /** Page number to return, from the paginated results. */ + page?: number + /** Maximum number of Private Networks to return per page. */ + pageSize?: number + /** + * Name to filter for. Only Private Networks with names containing this string + * will be returned. + */ + name?: string + /** + * Tags to filter for. Only Private Networks with one or more matching tags + * will be returned. + */ + tags?: string[] + /** + * Organization ID to filter for. Only Private Networks belonging to this + * Organization will be returned. + */ + organizationId?: string + /** + * Project ID to filter for. Only Private Networks belonging to this Project + * will be returned. + */ + projectId?: string + /** + * Private Network IDs to filter for. Only Private Networks with one of these + * IDs will be returned. + */ + privateNetworkIds?: string[] + /** + * VPC ID to filter for. Only Private Networks belonging to this VPC will be + * returned. + */ + vpcId?: string +} + +export type CreatePrivateNetworkRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Name for the Private Network. */ + name?: string + /** Scaleway Project in which to create the Private Network. */ + projectId?: string + /** Tags for the Private Network. */ + tags?: string[] + /** Private Network subnets CIDR. */ + subnets?: string[] + /** VPC in which to create the Private Network. */ + vpcId?: string +} + +export type GetPrivateNetworkRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Private Network ID. */ + privateNetworkId: string +} + +export type UpdatePrivateNetworkRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Private Network ID. */ + privateNetworkId: string + /** Name for the Private Network. */ + name?: string + /** Tags for the Private Network. */ + tags?: string[] +} + +export type DeletePrivateNetworkRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Private Network ID. */ + privateNetworkId: string +} + +export type MigrateZonalPrivateNetworksRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** + * Organization ID to target. The specified zoned Private Networks within this + * Organization will be migrated to regional. + * + * One-of ('scope'): at most one of 'organizationId', 'projectId' could be + * set. + */ + organizationId?: string + /** + * Project to target. The specified zoned Private Networks within this Project + * will be migrated to regional. + * + * One-of ('scope'): at most one of 'organizationId', 'projectId' could be + * set. + */ + projectId?: string + /** IDs of the Private Networks to migrate. */ + privateNetworkIds?: string[] +} + +export type SetSubnetsRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Private Network ID. */ + privateNetworkId: string + /** Private Network subnets CIDR. */ + subnets?: string[] +} + +export type AddSubnetsRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Private Network ID. */ + privateNetworkId: string + /** Private Network subnets CIDR. */ + subnets?: string[] +} + +export type DeleteSubnetsRequest = { + /** + * Region to target. If none is passed will use default region from the + * config. + */ + region?: Region + /** Private Network ID. */ + privateNetworkId: string + /** Private Network subnets CIDR. */ + subnets?: string[] +}