FunctionBuilder class

Tanda Tangan:

export declare class FunctionBuilder 

Konstruktor

Konstruktor Pengubah Deskripsi
(konstruktor)(opsi) Membuat instance baru dari class FunctionBuilder

Properti

Properti Pengubah Jenis Deskripsi
analisis { event: (analyticsEventType: string) => analytics.AnalyticsEventBuilder; }
autentikasi { user: (userOptions?: auth.UserOptions) => auth.UserBuilder; }
database { instance: (instance: string) => database.InstanceBuilder; ref: <Ref extended string>(path: Ref) => database.RefBuilder<Ref>; }
firestore { document: <Pathextended 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").Dapat dijalankan<any>; }
pubsub { topic: (topic: string) => pubsub.TopicBuilder; jadwal: (jadwal: string) => pubsub.ScheduleBuilder; }
remoteConfig { onUpdate: (handler: (versi: remoteConfig.TemplateVersion, konteks: EventContext) => PromiseLike<any> | any) => import("./cloud-functions").CloudFunction<remoteConfig.TemplateVersion>; }
penyimpanan { bucket: (bucket?: string) => storage.BucketBuilder; object: () => storage.ObjectBuilder; }
tugas { taskQueue: (options?: tasks.TaskQueueOptions) => tasks.TaskQueueBuilder; }
testLab { testMatrix: () => testLab.TestMatrixBuilder; }

Metode

Metode Pengubah Deskripsi
region) Konfigurasi region tempat fungsi di-deploy.
runWith(runtimeOptions) Konfigurasi opsi runtime untuk fungsi.

FunctionBuilder.(konstruktor)

Membuat instance baru dari class FunctionBuilder

Tanda Tangan:

constructor(options: DeploymentOptions);

Parameter

Parameter Jenis Deskripsi
opsi DeploymentOptions

FunctionBuilder.analytics

Tanda Tangan:

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

FunctionBuilder.auth

Tanda Tangan:

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

FunctionBuilder.database

Tanda Tangan:

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

FunctionBuilder.firestore

Tanda Tangan:

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

FunctionBuilder.https

Tanda Tangan:

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

Tanda Tangan:

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

FunctionBuilder.remoteConfig

Tanda Tangan:

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

FunctionBuilder.storage

Tanda Tangan:

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

FunctionBuilder.tasks

Tanda Tangan:

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

FunctionBuilder.testLab

Tanda Tangan:

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

FunctionBuilder.region()

Konfigurasi region tempat fungsi di-deploy.

Tanda Tangan:

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

Parameter

Parameter Jenis Deskripsi
kawasan Array<(typeof SUPPORTED_REGIONS)[angka] | rangkaian | Ekspresi<string> | NilaiReset> Satu atau beberapa string wilayah.

Hasil:

FunctionBuilder

Contoh 1

functions.region('us-east1')

Contoh 2

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

FunctionBuilder.runWith()

Konfigurasi opsi runtime untuk fungsi.

Tanda Tangan:

runWith(runtimeOptions: RuntimeOptions): FunctionBuilder;

Parameter

Parameter Jenis Deskripsi
runtimeOptions RuntimeOptions Objek dengan kolom opsional: 1. memory: jumlah memori untuk dialokasikan ke fungsi, nilai yang mungkin adalah: '128MB', '256MB', '512MB', '1GB', '2GB', '4GB', dan '8GB'. 2. timeoutSeconds: waktu tunggu untuk fungsi dalam detik, nilai yang mungkin adalah 0 hingga 540. 3. failurePolicy: kebijakan kegagalan fungsi, dengan boolean true yang setara dengan menyediakan objek percobaan ulang kosong. 4. vpcConnector: ID konektor VPC dalam project dan region 5 yang sama. vpcConnectorEgressSettings: saat vpcConnector ditetapkan, kontrol traffic keluar yang dikirim melalui vpcConnector.Nilai tidak boleh null.

Hasil:

FunctionBuilder