Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vpc/v2): drop MigrateZonalPrivateNetworks #1760

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/clients/src/api/iam/v1alpha1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export type {
ListUsersRequest,
ListUsersRequestOrderBy,
ListUsersResponse,
LocalityType,
LockUserRequest,
Log,
LogAction,
Expand All @@ -84,6 +85,7 @@ export type {
PermissionSetScopeType,
Policy,
Quotum,
QuotumLimit,
RemoveGroupMemberRequest,
Rule,
RuleSpecs,
Expand Down
34 changes: 6 additions & 28 deletions packages/clients/src/api/vpc/v2/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import {
urlParams,
validatePathParam,
} from '../../../bridge'
import type { Region } from '../../../bridge'
import type { Region as ScwRegion } from '../../../bridge'
import {
marshalAddSubnetsRequest,
marshalCreatePrivateNetworkRequest,
marshalCreateRouteRequest,
marshalCreateVPCRequest,
marshalDeleteSubnetsRequest,
marshalMigrateZonalPrivateNetworksRequest,
marshalSetSubnetsRequest,
marshalUpdatePrivateNetworkRequest,
marshalUpdateRouteRequest,
Expand Down Expand Up @@ -50,7 +49,6 @@ import type {
ListSubnetsResponse,
ListVPCsRequest,
ListVPCsResponse,
MigrateZonalPrivateNetworksRequest,
PrivateNetwork,
Route,
SetSubnetsRequest,
Expand All @@ -73,7 +71,11 @@ const jsonContentHeaders = {
*/
export class API extends ParentAPI {
/** Lists the available regions of the API. */
public static readonly LOCALITIES: Region[] = ['fr-par', 'nl-ams', 'pl-waw']
public static readonly LOCALITIES: ScwRegion[] = [
'fr-par',
'nl-ams',
'pl-waw',
]

protected pageOfListVPCs = (request: Readonly<ListVPCsRequest> = {}) =>
this.client.fetch<ListVPCsResponse>(
Expand Down Expand Up @@ -284,30 +286,6 @@ export class API extends ParentAPI {
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<MigrateZonalPrivateNetworksRequest> = {},
) =>
this.client.fetch<void>({
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`,
})

/**
* Enable DHCP on a Private Network. Enable DHCP managed on an existing
* Private Network. Note that you will not be able to deactivate it
Expand Down
1 change: 0 additions & 1 deletion packages/clients/src/api/vpc/v2/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export type {
ListVPCsRequest,
ListVPCsRequestOrderBy,
ListVPCsResponse,
MigrateZonalPrivateNetworksRequest,
PrivateNetwork,
Route,
SetSubnetsRequest,
Expand Down
21 changes: 0 additions & 21 deletions packages/clients/src/api/vpc/v2/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import randomName from '@scaleway/random-name'
import {
isJSONObject,
resolveOneOf,
unmarshalArrayOfObject,
unmarshalDate,
} from '../../../bridge'
Expand All @@ -19,7 +18,6 @@ import type {
ListPrivateNetworksResponse,
ListSubnetsResponse,
ListVPCsResponse,
MigrateZonalPrivateNetworksRequest,
PrivateNetwork,
Route,
SetSubnetsRequest,
Expand Down Expand Up @@ -250,25 +248,6 @@ export const marshalDeleteSubnetsRequest = (
subnets: request.subnets,
})

export const marshalMigrateZonalPrivateNetworksRequest = (
request: MigrateZonalPrivateNetworksRequest,
defaults: DefaultValues,
): Record<string, unknown> => ({
private_network_ids: request.privateNetworkIds,
...resolveOneOf([
{
default: defaults.defaultOrganizationId,
param: 'organization_id',
value: request.organizationId,
},
{
default: defaults.defaultProjectId,
param: 'project_id',
value: request.projectId,
},
]),
})

export const marshalSetSubnetsRequest = (
request: SetSubnetsRequest,
defaults: DefaultValues,
Expand Down
74 changes: 24 additions & 50 deletions packages/clients/src/api/vpc/v2/types.gen.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// 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'
import type { Region as ScwRegion } from '../../../bridge'

export type ListPrivateNetworksRequestOrderBy =
| 'created_at_asc'
Expand Down Expand Up @@ -43,7 +43,7 @@ export interface PrivateNetwork {
/** Scaleway Project the Private Network belongs to. */
projectId: string
/** Region in which the Private Network is available. */
region: Region
region: ScwRegion
/** Tags of the Private Network. */
tags: string[]
/** Date the Private Network was created. */
Expand Down Expand Up @@ -80,7 +80,7 @@ export interface Route {
/** Defines whether the route can be modified or deleted by the user. */
isReadOnly: boolean
/** Region of the Route. */
region: Region
region: ScwRegion
}

export interface VPC {
Expand All @@ -93,7 +93,7 @@ export interface VPC {
/** Scaleway Project the VPC belongs to. */
projectId: string
/** Region of the VPC. */
region: Region
region: ScwRegion
/** Tags for the VPC. */
tags: string[]
/** Defines whether the VPC is the default one for its Project. */
Expand All @@ -113,7 +113,7 @@ export type AddSubnetsRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Private Network ID. */
privateNetworkId: string
/** Private Network subnets CIDR. */
Expand All @@ -129,7 +129,7 @@ export type CreatePrivateNetworkRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Name for the Private Network. */
name?: string
/** Scaleway Project in which to create the Private Network. */
Expand All @@ -147,7 +147,7 @@ export type CreateRouteRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Route description. */
description: string
/** Tags of the Route. */
Expand All @@ -167,7 +167,7 @@ export type CreateVPCRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Name for the VPC. */
name?: string
/** Scaleway Project in which to create the VPC. */
Expand All @@ -183,7 +183,7 @@ export type DeletePrivateNetworkRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Private Network ID. */
privateNetworkId: string
}
Expand All @@ -193,7 +193,7 @@ export type DeleteRouteRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Route ID. */
routeId: string
}
Expand All @@ -203,7 +203,7 @@ export type DeleteSubnetsRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Private Network ID. */
privateNetworkId: string
/** Private Network subnets CIDR. */
Expand All @@ -219,7 +219,7 @@ export type DeleteVPCRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** VPC ID. */
vpcId: string
}
Expand All @@ -229,7 +229,7 @@ export type EnableDHCPRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Private Network ID. */
privateNetworkId: string
}
Expand All @@ -239,7 +239,7 @@ export type EnableRoutingRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** VPC ID. */
vpcId: string
}
Expand All @@ -249,7 +249,7 @@ export type GetPrivateNetworkRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Private Network ID. */
privateNetworkId: string
}
Expand All @@ -259,7 +259,7 @@ export type GetRouteRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Route ID. */
routeId: string
}
Expand All @@ -269,7 +269,7 @@ export type GetVPCRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** VPC ID. */
vpcId: string
}
Expand All @@ -279,7 +279,7 @@ export type ListPrivateNetworksRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Sort order of the returned Private Networks. */
orderBy?: ListPrivateNetworksRequestOrderBy
/** Page number to return, from the paginated results. */
Expand Down Expand Up @@ -333,7 +333,7 @@ export type ListSubnetsRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Sort order of the returned subnets. */
orderBy?: ListSubnetsRequestOrderBy
/** Page number to return, from the paginated results. */
Expand Down Expand Up @@ -369,7 +369,7 @@ export type ListVPCsRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Sort order of the returned VPCs. */
orderBy?: ListVPCsRequestOrderBy
/** Page number to return, from the paginated results. */
Expand Down Expand Up @@ -413,38 +413,12 @@ export interface ListVPCsResponse {
totalCount: number
}

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
region?: ScwRegion
/** Private Network ID. */
privateNetworkId: string
/** Private Network subnets CIDR. */
Expand All @@ -460,7 +434,7 @@ export type UpdatePrivateNetworkRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Private Network ID. */
privateNetworkId: string
/** Name for the Private Network. */
Expand All @@ -474,7 +448,7 @@ export type UpdateRouteRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** Route ID. */
routeId: string
/** Route description. */
Expand All @@ -494,7 +468,7 @@ export type UpdateVPCRequest = {
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
region?: ScwRegion
/** VPC ID. */
vpcId: string
/** Name for the VPC. */
Expand Down
Loading