签名:
export declare class FunctionBuilder
构造函数
构造函数 | 修饰符 | 说明 |
---|---|---|
(构造函数)(options) | 构造 FunctionBuilder 类的新实例 |
属性
属性 | 修饰符 | 类型 | 说明 |
---|---|---|---|
分析 | { event: (analyticsEventType: string) =>analytics.AnalyticsEventBuilder;} | ||
身份验证 | { user: (userOptions?: auth.UserOptions) =>auth.UserBuilder;} | ||
数据库 | { instance: (instance: string) =>database.InstanceBuilder;ref: <Ref 扩展字符串>(path: Ref) =>database.RefBuilder<Ref>;} | ||
firestore | { 文档: <路径扩展字符串>(path: 路径) =>firestore.DocumentBuilder<路径>;命名空间:(命名空间:字符串)=>firestore.NamespaceBuilder;数据库:(数据库:字符串)=>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>;} | ||
发布/订阅 | { topic: (topic: string) =>pubsub.TopicBuilder;时间表:(schedule: string) =>pubsub.ScheduleBuilder;} | ||
remoteConfig | { onUpdate: (handler: (version: remoteConfig.TemplateVersion, context: EventContext) => PromiseLike<any> | any) =>import("./cloud-functions")CloudFunction<remoteConfig.TemplateVersion>;} | ||
存储空间 | { bucket: (bucket?: string) =>storage.BucketBuilder;对象:() =>storage.ObjectBuilder;} | ||
任务 | { taskQueue: (options?: tasks.TaskQueueOptions) =>tasks.TaskQueueBuilder;} | ||
testLab | { testMatrix: () =>testLab.TestMatrixBuilder;} |
方法
方法 | 修饰符 | 说明 |
---|---|---|
region [地区] | 配置要在其中部署函数的区域。 | |
runWith(runtimeOptions) | 为函数配置运行时选项。 |
FunctionBuilder.(构造函数)
构造 FunctionBuilder
类的新实例
签名:
constructor(options: DeploymentOptions);
参数
参数 | 类型 | 说明 |
---|---|---|
选项 | DeploymentOptions |
FunctionBuilder.analytics
签名:
get analytics(): {
event: (analyticsEventType: string) => analytics.AnalyticsEventBuilder;
};
FunctionBuilder.auth
签名:
get auth(): {
user: (userOptions?: auth.UserOptions) => auth.UserBuilder;
};
FunctionBuilder.database
签名:
get database(): {
instance: (instance: string) => database.InstanceBuilder;
ref: <Ref extends string>(path: Ref) => database.RefBuilder<Ref>;
};
FunctionBuilder.firestore
签名:
get firestore(): {
document: <Path extends string>(path: Path) => firestore.DocumentBuilder<Path>;
namespace: (namespace: string) => firestore.NamespaceBuilder;
database: (database: string) => firestore.DatabaseBuilder;
};
FunctionBuilder.https
签名:
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
签名:
get pubsub(): {
topic: (topic: string) => pubsub.TopicBuilder;
schedule: (schedule: string) => pubsub.ScheduleBuilder;
};
FunctionBuilder.remoteConfig
签名:
get remoteConfig(): {
onUpdate: (handler: (version: remoteConfig.TemplateVersion, context: EventContext) => PromiseLike<any> | any) => import("./cloud-functions").CloudFunction<remoteConfig.TemplateVersion>;
};
FunctionBuilder.storage
签名:
get storage(): {
bucket: (bucket?: string) => storage.BucketBuilder;
object: () => storage.ObjectBuilder;
};
FunctionBuilder.tasks
签名:
get tasks(): {
taskQueue: (options?: tasks.TaskQueueOptions) => tasks.TaskQueueBuilder;
};
FunctionsBuilder.testLab
签名:
get testLab(): {
testMatrix: () => testLab.TestMatrixBuilder;
};
FunctionBuilder.region()
配置要在其中部署函数的区域。
签名:
region(...regions: Array<(typeof SUPPORTED_REGIONS)[number] | string | Expression<string> | ResetValue>): FunctionBuilder;
参数
参数 | 类型 | 说明 |
---|---|---|
区域 | 数组<(类型 SUPPORTED_REGIONS)[number] |字符串 |表达式<string>|重置值> | 一个或多个区域字符串。 |
返回:
示例 1
functions.region('us-east1')
示例 2
functions.region('us-east1', 'us-central1')
FunctionBuilder.runWith()
为函数配置运行时选项。
签名:
runWith(runtimeOptions: RuntimeOptions): FunctionBuilder;
参数
参数 | 类型 | 说明 |
---|---|---|
runtimeOptions | RuntimeOptions | 包含可选字段的对象:1.memory :要分配给函数的内存量,可能的值包括:“128MB”“256MB”“512MB”“1GB”“2GB”“4GB”和“8GB”。2. timeoutSeconds :函数的超时时间(以秒为单位),可能的值为 0 到 540。3. failurePolicy :函数的失败政策,布尔值 true 相当于提供一个空的重试对象。4. vpcConnector :同一项目和区域中的 VPC 连接器的 ID。5.vpcConnectorEgressSettings :设置 vpcConnector 时,控制通过 vpcConnector 发送哪些出站流量。值不得为 null。 |
返回: