Chữ ký:
export declare class FunctionBuilder
nhà xây dựng
Người xây dựng | sửa đổi | Sự miêu tả |
---|---|---|
(hàm tạo)(tùy chọn) | Xây dựng một phiên bản mới của lớp FunctionBuilder |
Của cải
Tài sản | sửa đổi | Kiểu | Sự miêu tả |
---|---|---|---|
phân tích | { sự kiện: (analyticsEventType: string) => Analytics.AnalyticsEventBuilder ; } | ||
xác thực | { người dùng: (userOptions?: auth.UserOptions ) => auth.UserBuilder ; } | ||
cơ sở dữ liệu | { dụ: (dụ: chuỗi) => cơ sở dữ liệu.InstanceBuilder ; ref: <Ref mở rộng chuỗi>(đường dẫn: Ref) => cơ sở dữ liệu.RefBuilder <Tham khảo>; } | ||
lò sưởi | { document: <Path mở rộng chuỗi>(path: Path) => firestore.DocumentBuilder <Đường dẫn>; không gian tên: (không gian tên: chuỗi) => firestore.NamespaceBuilder ; cơ sở dữ liệu: (cơ sở dữ liệu: chuỗi) => firestore.DatabaseBuilder ; } | ||
https | { onRequest: (handler: (req: https.Request, resp: express.Response) => void | Promise<void>) => import("./cloud-functions"). Hàm Https ; onCall: (trình xử lý: (dữ liệu: bất kỳ, bối cảnh: https.CallableContext ) => bất kỳ | Promise<any>) => import("./cloud-functions"). HttpsFunction & import("./cloud-functions"). Có thể chạy được <bất kỳ>; } | ||
pubsub | { topic: (topic: string) => pubsub.TopicBuilder ; lịch trình: (lịch trình: chuỗi) => pubsub.ScheduleBuilder ; } | ||
cấu hình từ xa | { onUpdate: (trình xử lý: (phiên bản: remoteConfig.TemplateVersion , bối cảnh: EventContext ) => PromiseLike<any> | bất kỳ) => import("./cloud-functions"). Chức năng đám mây < remoteConfig.TemplateVersion >; } | ||
kho | { xô: (thùng?: chuỗi) => storage.BucketBuilder ; đối tượng: () => storage.ObjectBuilder ; } | ||
nhiệm vụ | { taskQueue: (tùy chọn?: task.TaskQueueOptions ) => task.TaskQueueBuilder ; } | ||
phòng thí nghiệm thử nghiệm | { testMatrix: () => testLab.TestMatrixBuilder ; } |
phương pháp
Phương pháp | sửa đổi | Sự miêu tả |
---|---|---|
khu vực (khu vực) | Định cấu hình các khu vực mà chức năng được triển khai. | |
runWith(runtimeOptions) | Định cấu hình các tùy chọn thời gian chạy cho hàm. |
FunctionBuilder.(hàm tạo)
Xây dựng một phiên bản mới của lớp FunctionBuilder
Chữ ký:
constructor(options: DeploymentOptions);
Thông số
Tham số | Kiểu | Sự miêu tả |
---|---|---|
tùy chọn | Tùy chọn triển khai |
FunctionBuilder.analytics
Chữ ký:
get analytics(): {
event: (analyticsEventType: string) => analytics.AnalyticsEventBuilder;
};
FunctionBuilder.auth
Chữ ký:
get auth(): {
user: (userOptions?: auth.UserOptions) => auth.UserBuilder;
};
FunctionBuilder.database
Chữ ký:
get database(): {
instance: (instance: string) => database.InstanceBuilder;
ref: <Ref extends string>(path: Ref) => database.RefBuilder<Ref>;
};
FunctionBuilder.firestore
Chữ ký:
get firestore(): {
document: <Path extends string>(path: Path) => firestore.DocumentBuilder<Path>;
namespace: (namespace: string) => firestore.NamespaceBuilder;
database: (database: string) => firestore.DatabaseBuilder;
};
FunctionBuilder.https
Chữ ký:
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
Chữ ký:
get pubsub(): {
topic: (topic: string) => pubsub.TopicBuilder;
schedule: (schedule: string) => pubsub.ScheduleBuilder;
};
FunctionBuilder.remoteConfig
Chữ ký:
get remoteConfig(): {
onUpdate: (handler: (version: remoteConfig.TemplateVersion, context: EventContext) => PromiseLike<any> | any) => import("./cloud-functions").CloudFunction<remoteConfig.TemplateVersion>;
};
FunctionBuilder.storage
Chữ ký:
get storage(): {
bucket: (bucket?: string) => storage.BucketBuilder;
object: () => storage.ObjectBuilder;
};
FunctionBuilder.tasks
Chữ ký:
get tasks(): {
taskQueue: (options?: tasks.TaskQueueOptions) => tasks.TaskQueueBuilder;
};
FunctionBuilder.testLab
Chữ ký:
get testLab(): {
testMatrix: () => testLab.TestMatrixBuilder;
};
FunctionBuilder.khu vực()
Định cấu hình các khu vực mà chức năng được triển khai.
Chữ ký:
region(...regions: Array<(typeof SUPPORTED_REGIONS)[number] | string | Expression<string> | ResetValue>): FunctionBuilder;
Thông số
Tham số | Kiểu | Sự miêu tả |
---|---|---|
vùng | Mảng<(typeof SUPPORTED_REGIONS )[số] | chuỗi | Sự biểu lộ <chuỗi> | Đặt lại giá trị> | Một hoặc nhiều chuỗi vùng. |
Trả về:
ví dụ 1
hàm.khu vực ('us-east1')
Ví dụ 2
Hàm.khu vực('us-east1', 'us-central1')
FunctionBuilder.runWith()
Định cấu hình các tùy chọn thời gian chạy cho hàm.
Chữ ký:
runWith(runtimeOptions: RuntimeOptions): FunctionBuilder;
Thông số
Tham số | Kiểu | Sự miêu tả |
---|---|---|
tùy chọn thời gian chạy | Tùy chọn thời gian chạy | Đối tượng có các trường tùy chọn: 1. memory : dung lượng bộ nhớ để phân bổ cho hàm, các giá trị có thể là: '128MB', '256MB', '512MB', '1GB', '2GB', '4GB' và '8GB' . 2. timeoutSeconds : thời gian chờ của hàm tính bằng giây, các giá trị có thể là từ 0 đến 540. 3. failurePolicy : chính sách lỗi của hàm, với boolean true tương đương với việc cung cấp một đối tượng thử lại trống. 4. vpcConnector : id của trình kết nối VPC trong cùng một dự án và khu vực 5. vpcConnectorEgressSettings : khi vpcConnector được đặt, hãy kiểm soát lưu lượng truy cập đầu ra nào được gửi qua vpcConnector . Giá trị không được rỗng. |
Trả về: