From efc160a03b4d4316586bd1307f85ebee26bb9a40 Mon Sep 17 00:00:00 2001 From: Victor Fan Date: Tue, 8 Nov 2022 23:31:54 -0800 Subject: [PATCH] Allow v1 and v2 functions to set the Omit option on a function (#1298) --- src/runtime/manifest.ts | 1 + src/v1/cloud-functions.ts | 1 + src/v1/function-configuration.ts | 4 ++++ src/v2/options.ts | 6 ++++++ src/v2/providers/alerts/alerts.ts | 5 +++++ src/v2/providers/alerts/appDistribution.ts | 5 +++++ src/v2/providers/alerts/crashlytics.ts | 5 +++++ src/v2/providers/database.ts | 5 +++++ src/v2/providers/eventarc.ts | 5 +++++ src/v2/providers/https.ts | 5 +++++ src/v2/providers/identity.ts | 5 +++++ src/v2/providers/pubsub.ts | 5 +++++ src/v2/providers/storage.ts | 5 +++++ src/v2/providers/tasks.ts | 5 +++++ 14 files changed, 62 insertions(+) diff --git a/src/runtime/manifest.ts b/src/runtime/manifest.ts index 9780b1af4..65cb28dec 100644 --- a/src/runtime/manifest.ts +++ b/src/runtime/manifest.ts @@ -32,6 +32,7 @@ import { WireParamSpec } from "../params/types"; export interface ManifestEndpoint { entryPoint?: string; region?: string[]; + omit?: boolean | Expression; platform?: string; availableMemoryMb?: number | Expression | ResetValue; maxInstances?: number | Expression | ResetValue; diff --git a/src/v1/cloud-functions.ts b/src/v1/cloud-functions.ts index d2551e516..7909fc10d 100644 --- a/src/v1/cloud-functions.ts +++ b/src/v1/cloud-functions.ts @@ -597,6 +597,7 @@ export function optionsToEndpoint(options: DeploymentOptions): ManifestEndpoint copyIfPresent( endpoint, options, + "omit", "minInstances", "maxInstances", "ingressSettings", diff --git a/src/v1/function-configuration.ts b/src/v1/function-configuration.ts index 1f0d9c4b5..504e392ca 100644 --- a/src/v1/function-configuration.ts +++ b/src/v1/function-configuration.ts @@ -252,6 +252,10 @@ export interface RuntimeOptions { * Configuration options for a function that applies during function deployment. */ export interface DeploymentOptions extends RuntimeOptions { + /** + * If true, do not deploy or emulate this function. + */ + omit?: boolean | Expression; /** * Regions where function should be deployed. */ diff --git a/src/v2/options.ts b/src/v2/options.ts index cfe951917..a4cc00eef 100644 --- a/src/v2/options.ts +++ b/src/v2/options.ts @@ -94,6 +94,11 @@ export type IngressSetting = "ALLOW_ALL" | "ALLOW_INTERNAL_ONLY" | "ALLOW_INTERN * These options are common to HTTPS and Event handling functions. */ export interface GlobalOptions { + /** + * If true, do not deploy or emulate this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ @@ -317,6 +322,7 @@ export function optionsToEndpoint( copyIfPresent( endpoint, opts, + "omit", "concurrency", "minInstances", "maxInstances", diff --git a/src/v2/providers/alerts/alerts.ts b/src/v2/providers/alerts/alerts.ts index 3b544ecd1..0eb9176e3 100644 --- a/src/v2/providers/alerts/alerts.ts +++ b/src/v2/providers/alerts/alerts.ts @@ -86,6 +86,11 @@ export interface FirebaseAlertOptions extends options.EventHandlerOptions { /** Scope the function to trigger on a specific application. */ appId?: string; + /** + * If true, do not deploy or emulate this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/alerts/appDistribution.ts b/src/v2/providers/alerts/appDistribution.ts index e98085f84..0d2c5ccd4 100644 --- a/src/v2/providers/alerts/appDistribution.ts +++ b/src/v2/providers/alerts/appDistribution.ts @@ -97,6 +97,11 @@ export interface AppDistributionOptions extends options.EventHandlerOptions { /** Scope the function to trigger on a specific application. */ appId?: string; + /** + * If true, do not deploy or emulate this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/alerts/crashlytics.ts b/src/v2/providers/alerts/crashlytics.ts index e142406b6..6fd255430 100644 --- a/src/v2/providers/alerts/crashlytics.ts +++ b/src/v2/providers/alerts/crashlytics.ts @@ -177,6 +177,11 @@ export interface CrashlyticsOptions extends options.EventHandlerOptions { /** Scope the function to trigger on a specific application. */ appId?: string; + /** + * If true, do not deploy or emulate this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/database.ts b/src/v2/providers/database.ts index af9ced565..4ceb6ac97 100644 --- a/src/v2/providers/database.ts +++ b/src/v2/providers/database.ts @@ -98,6 +98,11 @@ export interface ReferenceOptions extends options.E */ instance?: string; + /** + * If true, do not deploy or emulate this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/eventarc.ts b/src/v2/providers/eventarc.ts index 4f425faef..e765eb268 100644 --- a/src/v2/providers/eventarc.ts +++ b/src/v2/providers/eventarc.ts @@ -62,6 +62,11 @@ export interface EventarcTriggerOptions extends options.EventHandlerOptions { */ filters?: Record; + /** + * If true, do not deploy or emulate this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/https.ts b/src/v2/providers/https.ts index 010a4a355..f45c19254 100644 --- a/src/v2/providers/https.ts +++ b/src/v2/providers/https.ts @@ -50,6 +50,11 @@ export { Request, CallableRequest, FunctionsErrorCode, HttpsError }; * Options that can be set on an onRequest HTTPS function. */ export interface HttpsOptions extends Omit { + /** + * If true, do not deploy or emulate this function. + */ + omit?: boolean | Expression; + /** HTTP functions can override global options and can specify multiple regions to deploy to. */ region?: SupportedRegion | string | Array; diff --git a/src/v2/providers/identity.ts b/src/v2/providers/identity.ts index a1a29a252..13cb1ee6e 100644 --- a/src/v2/providers/identity.ts +++ b/src/v2/providers/identity.ts @@ -64,6 +64,11 @@ export interface BlockingOptions { /** Pass the Refresh Token credential to the function. */ refreshToken?: boolean; + /** + * If true, do not deploy or emulate this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/pubsub.ts b/src/v2/providers/pubsub.ts index 2f215d52b..98b966c45 100644 --- a/src/v2/providers/pubsub.ts +++ b/src/v2/providers/pubsub.ts @@ -155,6 +155,11 @@ export interface PubSubOptions extends options.EventHandlerOptions { /** The Pub/Sub topic to watch for message events */ topic: string; + /** + * If true, do not deploy or emulate this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/storage.ts b/src/v2/providers/storage.ts index cf88cdc51..7e38f1ee7 100644 --- a/src/v2/providers/storage.ts +++ b/src/v2/providers/storage.ts @@ -203,6 +203,11 @@ export interface StorageOptions extends options.EventHandlerOptions { /** The name of the bucket containing this object. */ bucket?: string; + /** + * If true, do not deploy or emulate this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */ diff --git a/src/v2/providers/tasks.ts b/src/v2/providers/tasks.ts index d5974b722..6a493fe51 100644 --- a/src/v2/providers/tasks.ts +++ b/src/v2/providers/tasks.ts @@ -60,6 +60,11 @@ export interface TaskQueueOptions extends options.EventHandlerOptions { */ invoker?: "private" | string | string[]; + /** + * If true, do not deploy or emulate this function. + */ + omit?: boolean | Expression; + /** * Region where functions should be deployed. */