Skip to content

Commit 2b3e541

Browse files
committed
Add support for vpcConnector and vpcConnectorEgressSettings
1 parent 76ad222 commit 2b3e541

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/deploy/functions/release.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ module.exports = function(context, options, payload) {
217217
timeout: functionInfo.timeout,
218218
maxInstances: functionInfo.maxInstances,
219219
environmentVariables: defaultEnvVariables,
220+
vpcConnector: functionInfo.vpcConnector,
221+
vpcConnectorEgressSettings: functionInfo.vpcConnectorEgressSettings,
220222
})
221223
.then((createRes) => {
222224
if (_.has(functionTrigger, "httpsTrigger")) {
@@ -292,6 +294,8 @@ module.exports = function(context, options, payload) {
292294
timeout: functionInfo.timeout,
293295
runtime: runtime,
294296
maxInstances: functionInfo.maxInstances,
297+
vpcConnector: functionInfo.vpcConnector,
298+
vpcConnectorEgressSettings: functionInfo.vpcConnectorEgressSettings,
295299
environmentVariables: _.assign(
296300
{},
297301
existingFunction.environmentVariables,

src/gcp/cloudfunctions.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,21 @@ function _createFunction(options) {
6565
const location = "projects/" + options.projectId + "/locations/" + options.region;
6666
const func = location + "/functions/" + options.functionName;
6767
const endpoint = "/" + API_VERSION + "/" + location + "/functions";
68+
6869
const data = {
6970
sourceUploadUrl: options.sourceUploadUrl,
7071
name: func,
7172
entryPoint: options.entryPoint,
7273
labels: options.labels,
7374
runtime: options.runtime,
7475
};
76+
77+
if (options.vpcConnector) {
78+
data.vpcConnector = options.vpcConnector;
79+
}
80+
if (options.vpcConnectorEgressSettings) {
81+
data.vpcConnectorEgressSettings = options.vpcConnectorEgressSettings
82+
}
7583
if (options.availableMemoryMb) {
7684
data.availableMemoryMb = options.availableMemoryMb;
7785
}
@@ -143,6 +151,7 @@ function _updateFunction(options) {
143151
const location = "projects/" + options.projectId + "/locations/" + options.region;
144152
const func = location + "/functions/" + options.functionName;
145153
const endpoint = "/" + API_VERSION + "/" + func;
154+
146155
const data = _.assign(
147156
{
148157
sourceUploadUrl: options.sourceUploadUrl,
@@ -153,6 +162,14 @@ function _updateFunction(options) {
153162
);
154163
let masks = ["sourceUploadUrl", "name", "labels"];
155164

165+
if (options.vpcConnector) {
166+
data.vpcConnector = options.vpcConnector;
167+
masks.push("vpcConnector");
168+
}
169+
if (options.vpcConnectorEgressSettings) {
170+
data.vpcConnectorEgressSettings = options.vpcConnectorEgressSettings;
171+
masks.push("vpcConnectorEgressSettings");
172+
}
156173
if (options.runtime) {
157174
data.runtime = options.runtime;
158175
masks = _.concat(masks, "runtime");

0 commit comments

Comments
 (0)