FunctionBuilder class

Signature:

export declare class FunctionBuilder 

Constructors

Constructor Modifiers Description
(constructor)(options) Constructs a new instance of the FunctionBuilder class

Properties

Property Modifiers Type Description
analytics { event: (analyticsEventType: string) => analytics.AnalyticsEventBuilder; }
auth { user: (userOptions?: auth.UserOptions) => auth.UserBuilder; }
database { instance: (instance: string) => database.InstanceBuilder; ref: <Ref extends string>(path: Ref) => database.RefBuilder<Ref>; }
firestore { document: <Path extends string>(path: Path) => firestore.DocumentBuilder<Path>; namespace: (namespace: string) => firestore.NamespaceBuilder; database: (database: string) => firestore.DatabaseBuilder; }
https { onRequest: (handler: (req: https.Request, resp: express.Response) => void | Promise<void>) => import("./cloud-functions").HttpsFunction; onCall: (handler: (data: any, context: https.CallableContext) => any | Promise<any>) => import("./cloud-functions").HttpsFunction & import("./cloud-functions").Runnable<any>; }
pubsub { topic: (topic: string) => pubsub.TopicBuilder; schedule: (schedule: string) => pubsub.ScheduleBuilder; }
remoteConfig { onUpdate: (handler: (version: remoteConfig.TemplateVersion, context: EventContext) => PromiseLike<any> | any) => import("./cloud-functions").CloudFunction<remoteConfig.TemplateVersion>; }
storage { bucket: (bucket?: string) => storage.BucketBuilder; object: () => storage.ObjectBuilder; }
tasks { taskQueue: (options?: tasks.TaskQueueOptions) => tasks.TaskQueueBuilder; }
testLab { testMatrix: () => testLab.TestMatrixBuilder; }

Methods

Method Modifiers Description
region(regions) Configure the regions that the function is deployed to.
runWith(runtimeOptions) Configure runtime options for the function.

FunctionBuilder.(constructor)

Constructs a new instance of the FunctionBuilder class

Signature:

constructor(options: DeploymentOptions);

Parameters

Parameter Type Description
options DeploymentOptions

FunctionBuilder.analytics

Signature:

get analytics(): {
        event: (analyticsEventType: string) => analytics.AnalyticsEventBuilder;
    };

FunctionBuilder.auth

Signature:

get auth(): {
        user: (userOptions?: auth.UserOptions) => auth.UserBuilder;
    };

FunctionBuilder.database

Signature:

get database(): {
        instance: (instance: string) => database.InstanceBuilder;
        ref: <Ref extends string>(path: Ref) => database.RefBuilder<Ref>;
    };

FunctionBuilder.firestore

Signature:

get firestore(): {
        document: <Path extends string>(path: Path) => firestore.DocumentBuilder<Path>;
        namespace: (namespace: string) => firestore.NamespaceBuilder;
        database: (database: string) => firestore.DatabaseBuilder;
    };

FunctionBuilder.https

Signature:

get https(): {
        onRequest: (handler: (req: https.Request, resp: express.Response) => void | Promise<void>) => import("./cloud-functions").HttpsFunction;
        onCall: (handler: (data: any, context: https.CallableContext) => any | Promise<any>) => import("./cloud-functions").HttpsFunction & import("./cloud-functions").Runnable<any>;
    };

FunctionBuilder.pubsub

Signature:

get pubsub(): {
        topic: (topic: string) => pubsub.TopicBuilder;
        schedule: (schedule: string) => pubsub.ScheduleBuilder;
    };

FunctionBuilder.remoteConfig

Signature:

get remoteConfig(): {
        onUpdate: (handler: (version: remoteConfig.TemplateVersion, context: EventContext) => PromiseLike<any> | any) => import("./cloud-functions").CloudFunction<remoteConfig.TemplateVersion>;
    };

FunctionBuilder.storage

Signature:

get storage(): {
        bucket: (bucket?: string) => storage.BucketBuilder;
        object: () => storage.ObjectBuilder;
    };

FunctionBuilder.tasks

Signature:

get tasks(): {
        taskQueue: (options?: tasks.TaskQueueOptions) => tasks.TaskQueueBuilder;
    };

FunctionBuilder.testLab

Signature:

get testLab(): {
        testMatrix: () => testLab.TestMatrixBuilder;
    };

FunctionBuilder.region()

Configure the regions that the function is deployed to.

Signature:

region(...regions: Array<(typeof SUPPORTED_REGIONS)[number] | string | Expression<string> | ResetValue>): FunctionBuilder;

Parameters

Parameter Type Description
regions Array<(typeof SUPPORTED_REGIONS)[number] | string | Expression<string> | ResetValue> One or more region strings.

Returns:

FunctionBuilder

Example 1

functions.region('us-east1')

Example 2

functions.region('us-east1', 'us-central1')

FunctionBuilder.runWith()

Configure runtime options for the function.

Signature:

runWith(runtimeOptions: RuntimeOptions): FunctionBuilder;

Parameters

Parameter Type Description
runtimeOptions RuntimeOptions Object with optional fields: 1. memory: amount of memory to allocate to the function, possible values are: '128MB', '256MB', '512MB', '1GB', '2GB', '4GB', and '8GB'. 2. timeoutSeconds: timeout for the function in seconds, possible values are 0 to 540. 3. failurePolicy: failure policy of the function, with boolean true being equivalent to providing an empty retry object. 4. vpcConnector: id of a VPC connector in the same project and region 5. vpcConnectorEgressSettings: when a vpcConnector is set, control which egress traffic is sent through the vpcConnector.Value must not be null.

Returns:

FunctionBuilder