File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,9 @@ functions:
179179 input:
180180 key-a: "value-a"
181181 key-b: "value-b"
182+
183+ # ID of the private network to attach the function to
184+ privateNetworkId: "3fd741d4-f686-4afc-bcea-d720c695748f"
182185` ` `
183186
184187# ## Container-specific configuration
@@ -264,6 +267,9 @@ custom:
264267 # Deprecated: number of simultaneous requests to handle
265268 # Please use scalingOption of type concurrentRequests instead
266269 # maxConcurrency: 20
270+
271+ # ID of the private network to attach the container to
272+ privateNetworkId: "3fd741d4-f686-4afc-bcea-d720c695748f"
267273` ` `
268274
269275# # Supported commands
Original file line number Diff line number Diff line change @@ -154,6 +154,7 @@ module.exports = {
154154 sandbox : container . sandbox ,
155155 health_check : adaptHealthCheckToAPI ( container . healthCheck ) ,
156156 scaling_option : adaptScalingOptionToAPI ( container . scalingOption ) ,
157+ private_network_id : container . privateNetworkId ,
157158 } ;
158159
159160 // checking if there is custom_domains set on container creation.
@@ -177,6 +178,12 @@ module.exports = {
177178 } ,
178179
179180 async updateSingleContainer ( container , foundContainer ) {
181+ let privateNetworkId = container . privateNetworkId ;
182+ const hasToDeletePrivateNetwork = foundContainer . private_network_id && ! container . privateNetworkId ;
183+ if ( hasToDeletePrivateNetwork ) {
184+ privateNetworkId = "" ;
185+ }
186+
180187 const params = {
181188 redeploy : false ,
182189 environment_variables : container . env ,
@@ -201,6 +208,7 @@ module.exports = {
201208 sandbox : container . sandbox ,
202209 health_check : adaptHealthCheckToAPI ( container . healthCheck ) ,
203210 scaling_option : adaptScalingOptionToAPI ( container . scalingOption ) ,
211+ private_network_id : privateNetworkId ,
204212 } ;
205213
206214 // note about maxConcurrency deprecation
Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/refer
183183 domain_name : func . domain_name ,
184184 http_option : func . httpOption ,
185185 sandbox : func . sandbox ,
186+ private_network_id : func . privateNetworkId ,
186187 } ;
187188
188189 const availableRuntimes = await this . listRuntimes ( ) ;
@@ -208,6 +209,12 @@ Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/refer
208209 } ,
209210
210211 async updateSingleFunction ( func , foundFunc ) {
212+ let privateNetworkId = func . privateNetworkId ;
213+ const hasToDeletePrivateNetwork = foundFunc . private_network_id && ! func . privateNetworkId ;
214+ if ( hasToDeletePrivateNetwork ) {
215+ privateNetworkId = "" ;
216+ }
217+
211218 const params = {
212219 redeploy : false ,
213220 environment_variables : func . env ,
@@ -226,6 +233,7 @@ Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/refer
226233 domain_name : func . domain_name ,
227234 http_option : func . httpOption ,
228235 sandbox : func . sandbox ,
236+ private_network_id : privateNetworkId ,
229237 } ;
230238
231239 const availableRuntimes = await this . listRuntimes ( ) ;
You can’t perform that action at this time.
0 commit comments