@@ -36,55 +36,28 @@ import { HttpsOptions } from './providers/https';
3636/**
3737 * List of all regions supported by Cloud Functions v2
3838 */
39- export const SUPPORTED_REGIONS = [
40- 'asia-northeast1' ,
41- 'europe-north1' ,
42- 'europe-west1' ,
43- 'europe-west4' ,
44- 'us-central1' ,
45- 'us-east1' ,
46- 'us-west1' ,
47- ] as const ;
48-
49- /**
50- * A region known to be supported by CloudFunctions v2
51- */
52- export type SupportedRegion = typeof SUPPORTED_REGIONS [ number ] ;
53-
54- /**
55- * Cloud Functions v2 min timeout value.
56- */
57- export const MIN_TIMEOUT_SECONDS = 1 ;
58-
59- /**
60- * Cloud Functions v2 max timeout value for event handlers.
61- */
62- export const MAX_EVENT_TIMEOUT_SECONDS = 540 ;
63-
64- /**
65- * Cloud Functions v2 max timeout for HTTPS functions.
66- */
67- export const MAX_HTTPS_TIMEOUT_SECONDS = 36_000 ;
68-
69- /**
70- * Maximum number of requests to serve on a single instance.
71- */
72- export const MAX_CONCURRENCY = 1_000 ;
39+ export type SupportedRegion =
40+ | 'asia-northeast1'
41+ | 'europe-north1'
42+ | 'europe-west1'
43+ | 'europe-west4'
44+ | 'us-central1'
45+ | 'us-east1'
46+ | 'us-west1' ;
7347
7448/**
7549 * List of available memory options supported by Cloud Functions.
7650 */
77- export const SUPPORTED_MEMORY_OPTIONS = [
78- '128MiB' ,
79- '256MiB' ,
80- '512MiB' ,
81- '1GiB' ,
82- '2GiB' ,
83- '4GiB' ,
84- '8GiB' ,
85- '16GiB' ,
86- '32GiB' ,
87- ] as const ;
51+ export type MemoryOption =
52+ | '128MiB'
53+ | '256MiB'
54+ | '512MiB'
55+ | '1GiB'
56+ | '2GiB'
57+ | '4GiB'
58+ | '8GiB'
59+ | '16GiB'
60+ | '32GiB' ;
8861
8962const MemoryOptionToMB : Record < MemoryOption , number > = {
9063 '128MiB' : 128 ,
@@ -98,34 +71,18 @@ const MemoryOptionToMB: Record<MemoryOption, number> = {
9871 '32GiB' : 32768 ,
9972} ;
10073
101- /**
102- * A supported memory option.
103- */
104- export type MemoryOption = typeof SUPPORTED_MEMORY_OPTIONS [ number ] ;
105-
10674/**
10775 * List of available options for VpcConnectorEgressSettings.
10876 */
109- export const SUPPORTED_VPC_EGRESS_SETTINGS = [
110- 'PRIVATE_RANGES_ONLY' ,
111- 'ALL_TRAFFIC' ,
112- ] as const ;
113-
114- /**
115- * A valid VPC Egress setting.
116- */
117- export type VpcEgressSetting = typeof SUPPORTED_VPC_EGRESS_SETTINGS [ number ] ;
77+ export type VpcEgressSetting = 'PRIVATE_RANGES_ONLY' | 'ALL_TRAFFIC' ;
11878
11979/**
12080 * List of available options for IngressSettings.
12181 */
122- export const SUPPORTED_INGRESS_SETTINGS = [
123- 'ALLOW_ALL' ,
124- 'ALLOW_INTERNAL_ONLY' ,
125- 'ALLOW_INTERNAL_AND_GCLB' ,
126- ] as const ;
127-
128- export type IngressSetting = typeof SUPPORTED_INGRESS_SETTINGS [ number ] ;
82+ export type IngressSetting =
83+ | 'ALLOW_ALL'
84+ | 'ALLOW_INTERNAL_ONLY'
85+ | 'ALLOW_INTERNAL_AND_GCLB' ;
12986
13087/**
13188 * GlobalOptions are options that can be set across an entire project.
@@ -148,6 +105,11 @@ export interface GlobalOptions {
148105 * Timeout for the function in sections, possible values are 0 to 540.
149106 * HTTPS functions can specify a higher timeout.
150107 * A value of null restores the default of 60s
108+ * The minimum timeout for a gen 2 function is 1s. The maximum timeout for a
109+ * function depends on the type of function: Event handling functions have a
110+ * maximum timeout of 540s (9 minutes). HTTPS and callable functions have a
111+ * maximum timeout of 36,00s (1 hour). Task queue functions have a maximum
112+ * timeout of 1,800s (30 minutes)
151113 */
152114 timeoutSeconds ?: number | null ;
153115
@@ -170,6 +132,7 @@ export interface GlobalOptions {
170132 * Can only be applied to functions running on Cloud Functions v2.
171133 * A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise).
172134 * Concurrency cannot be set to any value other than 1 if `cpu` is less than 1.
135+ * The maximum value for concurrency is 1,000.
173136 */
174137 concurrency ?: number | null ;
175138
@@ -246,7 +209,7 @@ export function getGlobalOptions(): GlobalOptions {
246209}
247210
248211/**
249- * Options that can be set on an individual event-handling Cloud Function.
212+ * Additional fields that can be set on any event-handling Cloud Function.
250213 */
251214export interface EventHandlerOptions extends GlobalOptions {
252215 retry ?: boolean ;
@@ -361,6 +324,7 @@ export function optionsToEndpoint(
361324
362325/**
363326 * @hidden
327+ * @alpha
364328 */
365329export function __getSpec ( ) : {
366330 globalOptions : GlobalOptions ;
0 commit comments