FunctionBuilder class Stay organized with collections Save and categorize content based on your preferences.
Signature:
exportdeclareclassFunctionBuilderConstructors
| Constructor | Modifiers | Description |
|---|---|---|
| (constructor)(options) | Constructs a new instance of theFunctionBuilder 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 theFunctionBuilder class
Signature:
constructor(options:DeploymentOptions);Parameters
| Parameter | Type | Description |
|---|---|---|
| options | DeploymentOptions |
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
| Parameter | Type | Description |
|---|---|---|
| regions | Array<(typeofSUPPORTED_REGIONS)[number] | string |Expression<string> | ResetValue> | One or more region strings. |
Returns:
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 booleantrue being equivalent to providing an empty retry object. 4.vpcConnector: id of a VPC connector in the same project and region 5.vpcConnectorEgressSettings: when avpcConnector is set, control which egress traffic is sent through thevpcConnector.Value must not be null. |
Returns:
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-04-24 UTC.