FunctionBuilder class

簽名:

export declare class FunctionBuilder 

建構函式

建構函式 修飾符 說明
(建構函式)(選項) 建構 FunctionBuilder 類別的新例項

屬性

屬性 修飾符 類型 說明
Analytics { event: (analyticsEventType: string) =>analytics.AnalyticsEventBuilder;}
驗證 { 使用者:(userOptions?: auth.UserOptions) =>auth.UserBuilder;}
資料庫 { 例項: (執行個體:字串) =>database.InstanceBuilder;參照:<Ref 擴充 s string>(path: Ref) =>database.RefBuilder<Ref>;}
Firestore { 文件:<路徑擴充字串>(路徑:路徑) =>firestore.DocumentBuilder<路徑>;命名空間:(命名空間:字串) =>firestore.NamespaceBuilder;資料庫:(資料庫:字串) =>firestore.DatabaseBuilder;}
https { onRequest: (handler: (req: https.Request, resp: express.Response) => void | Promise<void>) =>import("./cloud-functions")HttpsFunction;onCall:(data: any, context: https.CallableContext) => any | Promise<any>) =>import(「./cloud-functions」)。HttpsFunction &import(「./cloud-functions」)。可執行<任何>;}
發布/訂閱 { topic: (主題:字串) =>pubsub.TopicBuilder;排程:(排程:字串) =>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(regions) 設定要部署函式的區域。
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;
    };

FunctionBuilder.testLab

簽名:

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

FunctionBuilder.region()

設定要部署函式的區域。

簽名:

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

參數

參數 類型 說明
個區域 陣列<(類型 SUPPORTED_REGIONS)[數字] |字串 |運算式<字串>|重設值> 一或多個區域字串。

傳回:

FunctionBuilder

範例 1

functions.region('us-east1')

範例 2

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

FunctionBuilder.runWith()

設定函式的執行階段選項。

簽名:

runWith(runtimeOptions: RuntimeOptions): FunctionBuilder;

參數

參數 類型 說明
RuntimeOptions 執行階段選項 含有選用欄位的物件:1.memory:要分配給函式的記憶體量,可能的值包括:「128MB」、「256MB」、「512MB」、「1GB」、「2GB」、「4GB」和「8GB」。2. timeoutSeconds:函式的逾時時間 (以秒為單位),可能值為 0 到 540。3. failurePolicy:函式的失敗政策,其中布林值 true 相當於提供空白的重試物件。4. vpcConnector:相同專案和區域 5 中的虛擬私有雲連接器 ID。vpcConnectorEgressSettings:設定 vpcConnector 時,控管透過 vpcConnector 傳送的輸出流量。值不得為空值。

傳回:

FunctionBuilder