Skip to content

Commit 43f3e50

Browse files
feat(functions): add support for VPC integration (#2175)
Co-authored-by: Jonathan R. <[email protected]>
1 parent 7c8eeee commit 43f3e50

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

packages_generated/function/src/v1beta1/api.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export class API extends ParentAPI {
185185
* @param request - The request {@link CreateNamespaceRequest}
186186
* @returns A Promise of Namespace
187187
*/
188-
createNamespace = (request: Readonly<CreateNamespaceRequest> = {}) =>
188+
createNamespace = (request: Readonly<CreateNamespaceRequest>) =>
189189
this.client.fetch<Namespace>(
190190
{
191191
body: JSON.stringify(

packages_generated/function/src/v1beta1/marshalling.gen.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export const unmarshalFunction = (data: unknown): Function => {
117117
name: data.name,
118118
namespaceId: data.namespace_id,
119119
privacy: data.privacy,
120+
privateNetworkId: data.private_network_id,
120121
readyAt: unmarshalDate(data.ready_at),
121122
region: data.region,
122123
runtime: data.runtime,
@@ -159,6 +160,7 @@ export const unmarshalNamespace = (data: unknown): Namespace => {
159160
status: data.status,
160161
tags: data.tags,
161162
updatedAt: unmarshalDate(data.updated_at),
163+
vpcIntegrationActivated: data.vpc_integration_activated,
162164
} as Namespace
163165
}
164166

@@ -452,6 +454,7 @@ export const marshalCreateFunctionRequest = (
452454
name: request.name || randomName('fn'),
453455
namespace_id: request.namespaceId,
454456
privacy: request.privacy,
457+
private_network_id: request.privateNetworkId,
455458
runtime: request.runtime,
456459
sandbox: request.sandbox,
457460
secret_environment_variables:
@@ -468,6 +471,7 @@ export const marshalCreateNamespaceRequest = (
468471
request: CreateNamespaceRequest,
469472
defaults: DefaultValues,
470473
): Record<string, unknown> => ({
474+
activate_vpc_integration: request.activateVpcIntegration,
471475
description: request.description,
472476
environment_variables: request.environmentVariables,
473477
name: request.name || randomName('ns'),
@@ -585,6 +589,7 @@ export const marshalUpdateFunctionRequest = (
585589
memory_limit: request.memoryLimit,
586590
min_scale: request.minScale,
587591
privacy: request.privacy,
592+
private_network_id: request.privateNetworkId,
588593
redeploy: request.redeploy,
589594
runtime: request.runtime,
590595
sandbox: request.sandbox,

packages_generated/function/src/v1beta1/types.gen.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ export interface Function {
409409
* List of tags applied to the Serverless Function.
410410
*/
411411
tags: string[]
412+
/**
413+
* When connected to a Private Network, the function can access other Scaleway resources in this Private Network.
414+
*/
415+
privateNetworkId?: string
412416
}
413417

414418
export interface Namespace {
@@ -472,6 +476,11 @@ export interface Namespace {
472476
* Last update date of the namespace.
473477
*/
474478
updatedAt?: Date
479+
/**
480+
* @deprecated When activated, functions in the namespace can be connected to a Private Network.
481+
Note that activating the VPC integration can only be done when creating a new namespace.
482+
*/
483+
vpcIntegrationActivated?: boolean
475484
}
476485

477486
export interface Token {
@@ -669,6 +678,12 @@ export type CreateFunctionRequest = {
669678
* Tags of the Serverless Function.
670679
*/
671680
tags?: string[]
681+
/**
682+
* When connected to a Private Network, the function can access other Scaleway resources in this Private Network.
683+
684+
Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag.
685+
*/
686+
privateNetworkId?: string
672687
}
673688

674689
export type CreateNamespaceRequest = {
@@ -697,6 +712,10 @@ export type CreateNamespaceRequest = {
697712
* Tags of the Serverless Function Namespace.
698713
*/
699714
tags?: string[]
715+
/**
716+
* When activated, functions in the namespace can be connected to a Private Network.
717+
*/
718+
activateVpcIntegration: boolean
700719
}
701720

702721
export type CreateTokenRequest = {
@@ -1282,6 +1301,12 @@ export type UpdateFunctionRequest = {
12821301
* Tags of the Serverless Function.
12831302
*/
12841303
tags?: string[]
1304+
/**
1305+
* When connected to a Private Network, the function can access other Scaleway resources in this Private Network.
1306+
1307+
Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag.
1308+
*/
1309+
privateNetworkId?: string
12851310
}
12861311

12871312
export type UpdateNamespaceRequest = {

0 commit comments

Comments
 (0)