FunctionBuilder class

Signature:

exportdeclareclassFunctionBuilder

Constructors

ConstructorModifiersDescription
(constructor)(options)Constructs a new instance of the FunctionBuilder class

Properties

PropertyModifiersTypeDescription
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

MethodModifiersDescription
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

ParameterTypeDescription
optionsDeploymentOptions

FunctionBuilder.analytics

Signature:

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

FunctionBuilder.auth

Signature:

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

FunctionBuilder.database

Signature:

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

FunctionBuilder.firestore

Signature:

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

FunctionBuilder.https

Signature:

gethttps():{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:

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

FunctionBuilder.remoteConfig

Signature:

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

FunctionBuilder.storage

Signature:

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

FunctionBuilder.tasks

Signature:

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

FunctionBuilder.testLab

Signature:

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

FunctionBuilder.region()

Configure the regions that the function is deployed to.

Signature:

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

Parameters

ParameterTypeDescription
regionsArray<(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

ParameterTypeDescription
runtimeOptionsRuntimeOptionsObject 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