Skip to content

Commit

Permalink
Allow v1 and v2 functions to set the Omit option on a function (#1298)
Browse files Browse the repository at this point in the history
  • Loading branch information
Berlioz authored Nov 9, 2022
1 parent 39cff12 commit efc160a
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/runtime/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { WireParamSpec } from "../params/types";
export interface ManifestEndpoint {
entryPoint?: string;
region?: string[];
omit?: boolean | Expression<boolean>;
platform?: string;
availableMemoryMb?: number | Expression<number> | ResetValue;
maxInstances?: number | Expression<number> | ResetValue;
Expand Down
1 change: 1 addition & 0 deletions src/v1/cloud-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ export function optionsToEndpoint(options: DeploymentOptions): ManifestEndpoint
copyIfPresent(
endpoint,
options,
"omit",
"minInstances",
"maxInstances",
"ingressSettings",
Expand Down
4 changes: 4 additions & 0 deletions src/v1/function-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>;
/**
* Regions where function should be deployed.
*/
Expand Down
6 changes: 6 additions & 0 deletions src/v2/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>;

/**
* Region where functions should be deployed.
*/
Expand Down Expand Up @@ -317,6 +322,7 @@ export function optionsToEndpoint(
copyIfPresent(
endpoint,
opts,
"omit",
"concurrency",
"minInstances",
"maxInstances",
Expand Down
5 changes: 5 additions & 0 deletions src/v2/providers/alerts/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>;

/**
* Region where functions should be deployed.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/v2/providers/alerts/appDistribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>;

/**
* Region where functions should be deployed.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/v2/providers/alerts/crashlytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>;

/**
* Region where functions should be deployed.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/v2/providers/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ export interface ReferenceOptions<Ref extends string = string> extends options.E
*/
instance?: string;

/**
* If true, do not deploy or emulate this function.
*/
omit?: boolean | Expression<boolean>;

/**
* Region where functions should be deployed.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/v2/providers/eventarc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ export interface EventarcTriggerOptions extends options.EventHandlerOptions {
*/
filters?: Record<string, string>;

/**
* If true, do not deploy or emulate this function.
*/
omit?: boolean | Expression<boolean>;

/**
* Region where functions should be deployed.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/v2/providers/https.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export { Request, CallableRequest, FunctionsErrorCode, HttpsError };
* Options that can be set on an onRequest HTTPS function.
*/
export interface HttpsOptions extends Omit<GlobalOptions, "region"> {
/**
* If true, do not deploy or emulate this function.
*/
omit?: boolean | Expression<boolean>;

/** HTTP functions can override global options and can specify multiple regions to deploy to. */
region?: SupportedRegion | string | Array<SupportedRegion | string>;

Expand Down
5 changes: 5 additions & 0 deletions src/v2/providers/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>;

/**
* Region where functions should be deployed.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/v2/providers/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>;

/**
* Region where functions should be deployed.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/v2/providers/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>;

/**
* Region where functions should be deployed.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/v2/providers/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>;

/**
* Region where functions should be deployed.
*/
Expand Down

0 comments on commit efc160a

Please sign in to comment.