@@ -39,34 +39,15 @@ import * as https from './providers/https';
3939import * as pubsub from './providers/pubsub' ;
4040import * as remoteConfig from './providers/remoteConfig' ;
4141import * as storage from './providers/storage' ;
42- import { CloudFunction , EventContext , Schedule } from './cloud-functions' ;
43-
44- /**
45- * List of all regions supported by Cloud Functions.
46- */
47- const SUPPORTED_REGIONS = [
48- 'us-central1' ,
49- 'us-east1' ,
50- 'europe-west1' ,
51- 'europe-west2' ,
52- 'asia-east2' ,
53- 'asia-northeast1' ,
54- ] ;
55-
56- /**
57- * List of available memory options supported by Cloud Functions.
58- */
59- const VALID_MEMORY_OPTS = [ '128MB' , '256MB' , '512MB' , '1GB' , '2GB' ] as const ;
60-
61- /**
62- * Cloud Functions min timeout value.
63- */
64- const MIN_TIMEOUT_SECONDS = 0 ;
65-
66- /**
67- * Cloud Functions max timeout value.
68- */
69- const MAX_TIMEOUT_SECONDS = 540 ;
42+ import { CloudFunction , EventContext } from './cloud-functions' ;
43+ import {
44+ RuntimeOptions ,
45+ VALID_MEMORY_OPTS ,
46+ MIN_TIMEOUT_SECONDS ,
47+ MAX_TIMEOUT_SECONDS ,
48+ SUPPORTED_REGIONS ,
49+ DeploymentOptions ,
50+ } from './function-configuration' ;
7051
7152/**
7253 * Assert that the runtime options passed in are valid.
@@ -174,31 +155,6 @@ export function runWith(runtimeOptions: RuntimeOptions): FunctionBuilder {
174155 return new FunctionBuilder ( runtimeOptions ) ;
175156}
176157
177- export interface FailurePolicy {
178- retry : { } ;
179- }
180-
181- export interface RuntimeOptions {
182- /**
183- * Failure policy of the function, boolean `true` is equivalent to providing
184- * an empty policy.
185- */
186- failurePolicy ?: FailurePolicy | boolean ;
187- /**
188- * Amount of memory to allocate to the function.
189- */
190- memory ?: typeof VALID_MEMORY_OPTS [ number ] ;
191- /**
192- * Timeout for the function in seconds, possible values are 0 to 540.
193- */
194- timeoutSeconds ?: number ;
195- }
196-
197- export interface DeploymentOptions extends RuntimeOptions {
198- regions ?: string [ ] ;
199- schedule ?: Schedule ;
200- }
201-
202158export class FunctionBuilder {
203159 constructor ( private options : DeploymentOptions ) { }
204160
@@ -237,6 +193,12 @@ export class FunctionBuilder {
237193 }
238194
239195 get https ( ) {
196+ if ( this . options . failurePolicy !== undefined ) {
197+ console . warn (
198+ 'RuntimeOptions.failurePolicy is not supported in https functions.'
199+ ) ;
200+ }
201+
240202 return {
241203 /**
242204 * Handle HTTP requests.
0 commit comments