google-cloud-functions-v2 1.1.0

Google Cloud Client Libraries for Rust - Cloud Functions API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate gtype;
extern crate iam_v1;
extern crate lazy_static;
extern crate location;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// Describes a Cloud Function that contains user computation executed in
/// response to an event. It encapsulates function and trigger configurations.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Function {
    /// A user-defined name of the function. Function names must be unique
    /// globally and match pattern `projects/*/locations/*/functions/*`
    pub name: std::string::String,

    /// User-provided description of a function.
    pub description: std::string::String,

    /// Describes the Build step of the function that builds a container from the
    /// given source.
    pub build_config: std::option::Option<crate::model::BuildConfig>,

    /// Describes the Service being deployed. Currently deploys services to Cloud
    /// Run (fully managed).
    pub service_config: std::option::Option<crate::model::ServiceConfig>,

    /// An Eventarc trigger managed by Google Cloud Functions that fires events in
    /// response to a condition in another service.
    pub event_trigger: std::option::Option<crate::model::EventTrigger>,

    /// Output only. State of the function.
    pub state: crate::model::function::State,

    /// Output only. The last update timestamp of a Cloud Function.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Labels associated with this Cloud Function.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Output only. State Messages for this Cloud Function.
    pub state_messages: std::vec::Vec<crate::model::StateMessage>,

    /// Describe whether the function is 1st Gen or 2nd Gen.
    pub environment: crate::model::Environment,

    /// Output only. The deployed url for the function.
    pub url: std::string::String,

    /// Resource name of a KMS crypto key (managed by the user) used to
    /// encrypt/decrypt function resources.
    ///
    /// It must match the pattern
    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
    pub kms_key_name: std::string::String,

    /// Output only. Reserved for future use.
    pub satisfies_pzs: bool,

    /// Output only. The create timestamp of a Cloud Function. This is only
    /// applicable to 2nd Gen functions.
    pub create_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Function {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Function::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::Function::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [build_config][crate::model::Function::build_config].
    pub fn set_build_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::BuildConfig>,
    {
        self.build_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [build_config][crate::model::Function::build_config].
    pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::BuildConfig>,
    {
        self.build_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [service_config][crate::model::Function::service_config].
    pub fn set_service_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ServiceConfig>,
    {
        self.service_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [service_config][crate::model::Function::service_config].
    pub fn set_or_clear_service_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ServiceConfig>,
    {
        self.service_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [event_trigger][crate::model::Function::event_trigger].
    pub fn set_event_trigger<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::EventTrigger>,
    {
        self.event_trigger = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [event_trigger][crate::model::Function::event_trigger].
    pub fn set_or_clear_event_trigger<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::EventTrigger>,
    {
        self.event_trigger = v.map(|x| x.into());
        self
    }

    /// Sets the value of [state][crate::model::Function::state].
    pub fn set_state<T: std::convert::Into<crate::model::function::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [update_time][crate::model::Function::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Function::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::Function::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [state_messages][crate::model::Function::state_messages].
    pub fn set_state_messages<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::StateMessage>,
    {
        use std::iter::Iterator;
        self.state_messages = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [environment][crate::model::Function::environment].
    pub fn set_environment<T: std::convert::Into<crate::model::Environment>>(
        mut self,
        v: T,
    ) -> Self {
        self.environment = v.into();
        self
    }

    /// Sets the value of [url][crate::model::Function::url].
    pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.url = v.into();
        self
    }

    /// Sets the value of [kms_key_name][crate::model::Function::kms_key_name].
    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.kms_key_name = v.into();
        self
    }

    /// Sets the value of [satisfies_pzs][crate::model::Function::satisfies_pzs].
    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.satisfies_pzs = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Function::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Function::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for Function {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.Function"
    }
}

/// Defines additional types related to [Function].
pub mod function {
    #[allow(unused_imports)]
    use super::*;

    /// Describes the current state of the function.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Not specified. Invalid state.
        Unspecified,
        /// Function has been successfully deployed and is serving.
        Active,
        /// Function deployment failed and the function is not serving.
        Failed,
        /// Function is being created or updated.
        Deploying,
        /// Function is being deleted.
        Deleting,
        /// Function deployment failed and the function serving state is undefined.
        /// The function should be updated or deleted to move it out of this state.
        Unknown,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Active => std::option::Option::Some(1),
                Self::Failed => std::option::Option::Some(2),
                Self::Deploying => std::option::Option::Some(3),
                Self::Deleting => std::option::Option::Some(4),
                Self::Unknown => std::option::Option::Some(5),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Active => std::option::Option::Some("ACTIVE"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Deploying => std::option::Option::Some("DEPLOYING"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::Unknown => std::option::Option::Some("UNKNOWN"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Active,
                2 => Self::Failed,
                3 => Self::Deploying,
                4 => Self::Deleting,
                5 => Self::Unknown,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "ACTIVE" => Self::Active,
                "FAILED" => Self::Failed,
                "DEPLOYING" => Self::Deploying,
                "DELETING" => Self::Deleting,
                "UNKNOWN" => Self::Unknown,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Active => serializer.serialize_i32(1),
                Self::Failed => serializer.serialize_i32(2),
                Self::Deploying => serializer.serialize_i32(3),
                Self::Deleting => serializer.serialize_i32(4),
                Self::Unknown => serializer.serialize_i32(5),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.functions.v2.Function.State",
            ))
        }
    }
}

/// Informational messages about the state of the Cloud Function or Operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StateMessage {
    /// Severity of the state message.
    pub severity: crate::model::state_message::Severity,

    /// One-word CamelCase type of the state message.
    pub r#type: std::string::String,

    /// The message.
    pub message: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl StateMessage {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [severity][crate::model::StateMessage::severity].
    pub fn set_severity<T: std::convert::Into<crate::model::state_message::Severity>>(
        mut self,
        v: T,
    ) -> Self {
        self.severity = v.into();
        self
    }

    /// Sets the value of [r#type][crate::model::StateMessage::type].
    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.r#type = v.into();
        self
    }

    /// Sets the value of [message][crate::model::StateMessage::message].
    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.message = v.into();
        self
    }
}

impl wkt::message::Message for StateMessage {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.StateMessage"
    }
}

/// Defines additional types related to [StateMessage].
pub mod state_message {
    #[allow(unused_imports)]
    use super::*;

    /// Severity of the state message.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Severity {
        /// Not specified. Invalid severity.
        Unspecified,
        /// ERROR-level severity.
        Error,
        /// WARNING-level severity.
        Warning,
        /// INFO-level severity.
        Info,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Severity::value] or
        /// [Severity::name].
        UnknownValue(severity::UnknownValue),
    }

    #[doc(hidden)]
    pub mod severity {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Severity {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Error => std::option::Option::Some(1),
                Self::Warning => std::option::Option::Some(2),
                Self::Info => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
                Self::Error => std::option::Option::Some("ERROR"),
                Self::Warning => std::option::Option::Some("WARNING"),
                Self::Info => std::option::Option::Some("INFO"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Severity {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Severity {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Severity {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Error,
                2 => Self::Warning,
                3 => Self::Info,
                _ => Self::UnknownValue(severity::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Severity {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
                "ERROR" => Self::Error,
                "WARNING" => Self::Warning,
                "INFO" => Self::Info,
                _ => Self::UnknownValue(severity::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Severity {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Error => serializer.serialize_i32(1),
                Self::Warning => serializer.serialize_i32(2),
                Self::Info => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Severity {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
                ".google.cloud.functions.v2.StateMessage.Severity",
            ))
        }
    }
}

/// Location of the source in an archive file in Google Cloud Storage.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StorageSource {
    /// Google Cloud Storage bucket containing the source (see
    /// [Bucket Name
    /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
    pub bucket: std::string::String,

    /// Google Cloud Storage object containing the source.
    ///
    /// This object must be a gzipped archive file (`.tar.gz`) containing source to
    /// build.
    pub object: std::string::String,

    /// Google Cloud Storage generation for the object. If the generation is
    /// omitted, the latest generation will be used.
    pub generation: i64,

    /// When the specified storage bucket is a 1st gen function uploard url bucket,
    /// this field should be set as the generated upload url for 1st gen
    /// deployment.
    pub source_upload_url: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl StorageSource {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [bucket][crate::model::StorageSource::bucket].
    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.bucket = v.into();
        self
    }

    /// Sets the value of [object][crate::model::StorageSource::object].
    pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.object = v.into();
        self
    }

    /// Sets the value of [generation][crate::model::StorageSource::generation].
    pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.generation = v.into();
        self
    }

    /// Sets the value of [source_upload_url][crate::model::StorageSource::source_upload_url].
    pub fn set_source_upload_url<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.source_upload_url = v.into();
        self
    }
}

impl wkt::message::Message for StorageSource {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.StorageSource"
    }
}

/// Location of the source in a Google Cloud Source Repository.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RepoSource {
    /// ID of the project that owns the Cloud Source Repository. If omitted, the
    /// project ID requesting the build is assumed.
    pub project_id: std::string::String,

    /// Name of the Cloud Source Repository.
    pub repo_name: std::string::String,

    /// Directory, relative to the source root, in which to run the build.
    ///
    /// This must be a relative path. If a step's `dir` is specified and is an
    /// absolute path, this value is ignored for that step's execution.
    /// eg. helloworld (no leading slash allowed)
    pub dir: std::string::String,

    /// Only trigger a build if the revision regex does NOT match the revision
    /// regex.
    pub invert_regex: bool,

    /// A revision within the Cloud Source Repository must be specified in
    /// one of these ways.
    pub revision: std::option::Option<crate::model::repo_source::Revision>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RepoSource {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [project_id][crate::model::RepoSource::project_id].
    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.project_id = v.into();
        self
    }

    /// Sets the value of [repo_name][crate::model::RepoSource::repo_name].
    pub fn set_repo_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.repo_name = v.into();
        self
    }

    /// Sets the value of [dir][crate::model::RepoSource::dir].
    pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.dir = v.into();
        self
    }

    /// Sets the value of [invert_regex][crate::model::RepoSource::invert_regex].
    pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.invert_regex = v.into();
        self
    }

    /// Sets the value of [revision][crate::model::RepoSource::revision].
    ///
    /// Note that all the setters affecting `revision` are mutually
    /// exclusive.
    pub fn set_revision<
        T: std::convert::Into<std::option::Option<crate::model::repo_source::Revision>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.revision = v.into();
        self
    }

    /// The value of [revision][crate::model::RepoSource::revision]
    /// if it holds a `BranchName`, `None` if the field is not set or
    /// holds a different branch.
    pub fn branch_name(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.revision.as_ref().and_then(|v| match v {
            crate::model::repo_source::Revision::BranchName(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [revision][crate::model::RepoSource::revision]
    /// to hold a `BranchName`.
    ///
    /// Note that all the setters affecting `revision` are
    /// mutually exclusive.
    pub fn set_branch_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.revision =
            std::option::Option::Some(crate::model::repo_source::Revision::BranchName(v.into()));
        self
    }

    /// The value of [revision][crate::model::RepoSource::revision]
    /// if it holds a `TagName`, `None` if the field is not set or
    /// holds a different branch.
    pub fn tag_name(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.revision.as_ref().and_then(|v| match v {
            crate::model::repo_source::Revision::TagName(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [revision][crate::model::RepoSource::revision]
    /// to hold a `TagName`.
    ///
    /// Note that all the setters affecting `revision` are
    /// mutually exclusive.
    pub fn set_tag_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.revision =
            std::option::Option::Some(crate::model::repo_source::Revision::TagName(v.into()));
        self
    }

    /// The value of [revision][crate::model::RepoSource::revision]
    /// if it holds a `CommitSha`, `None` if the field is not set or
    /// holds a different branch.
    pub fn commit_sha(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.revision.as_ref().and_then(|v| match v {
            crate::model::repo_source::Revision::CommitSha(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [revision][crate::model::RepoSource::revision]
    /// to hold a `CommitSha`.
    ///
    /// Note that all the setters affecting `revision` are
    /// mutually exclusive.
    pub fn set_commit_sha<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.revision =
            std::option::Option::Some(crate::model::repo_source::Revision::CommitSha(v.into()));
        self
    }
}

impl wkt::message::Message for RepoSource {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.RepoSource"
    }
}

/// Defines additional types related to [RepoSource].
pub mod repo_source {
    #[allow(unused_imports)]
    use super::*;

    /// A revision within the Cloud Source Repository must be specified in
    /// one of these ways.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Revision {
        /// Regex matching branches to build.
        ///
        /// The syntax of the regular expressions accepted is the syntax accepted by
        /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
        BranchName(std::string::String),
        /// Regex matching tags to build.
        ///
        /// The syntax of the regular expressions accepted is the syntax accepted by
        /// RE2 and described at <https://github.com/google/re2/wiki/Syntax>
        TagName(std::string::String),
        /// Explicit commit SHA to build.
        CommitSha(std::string::String),
    }
}

/// The location of the function source code.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Source {
    /// Location of the source.
    /// At least one source needs to be provided for the deployment to succeed.
    pub source: std::option::Option<crate::model::source::Source>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Source {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [source][crate::model::Source::source].
    ///
    /// Note that all the setters affecting `source` are mutually
    /// exclusive.
    pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::source::Source>>>(
        mut self,
        v: T,
    ) -> Self {
        self.source = v.into();
        self
    }

    /// The value of [source][crate::model::Source::source]
    /// if it holds a `StorageSource`, `None` if the field is not set or
    /// holds a different branch.
    pub fn storage_source(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::source::Source::StorageSource(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::Source::source]
    /// to hold a `StorageSource`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_storage_source<
        T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source =
            std::option::Option::Some(crate::model::source::Source::StorageSource(v.into()));
        self
    }

    /// The value of [source][crate::model::Source::source]
    /// if it holds a `RepoSource`, `None` if the field is not set or
    /// holds a different branch.
    pub fn repo_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::RepoSource>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::source::Source::RepoSource(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::Source::source]
    /// to hold a `RepoSource`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_repo_source<T: std::convert::Into<std::boxed::Box<crate::model::RepoSource>>>(
        mut self,
        v: T,
    ) -> Self {
        self.source = std::option::Option::Some(crate::model::source::Source::RepoSource(v.into()));
        self
    }

    /// The value of [source][crate::model::Source::source]
    /// if it holds a `GitUri`, `None` if the field is not set or
    /// holds a different branch.
    pub fn git_uri(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::source::Source::GitUri(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::Source::source]
    /// to hold a `GitUri`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_git_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.source = std::option::Option::Some(crate::model::source::Source::GitUri(v.into()));
        self
    }
}

impl wkt::message::Message for Source {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.Source"
    }
}

/// Defines additional types related to [Source].
pub mod source {
    #[allow(unused_imports)]
    use super::*;

    /// Location of the source.
    /// At least one source needs to be provided for the deployment to succeed.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Source {
        /// If provided, get the source from this location in Google Cloud Storage.
        StorageSource(std::boxed::Box<crate::model::StorageSource>),
        /// If provided, get the source from this location in a Cloud Source
        /// Repository.
        RepoSource(std::boxed::Box<crate::model::RepoSource>),
        /// If provided, get the source from GitHub repository. This option is valid
        /// only for GCF 1st Gen function.
        /// Example: <https://github.com/>\<user\>/\<repo\>/blob/\<commit\>/\<path-to-code\>
        GitUri(std::string::String),
    }
}

/// Provenance of the source. Ways to find the original source, or verify that
/// some source was used for this build.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SourceProvenance {
    /// A copy of the build's `source.storage_source`, if exists, with any
    /// generations resolved.
    pub resolved_storage_source: std::option::Option<crate::model::StorageSource>,

    /// A copy of the build's `source.repo_source`, if exists, with any
    /// revisions resolved.
    pub resolved_repo_source: std::option::Option<crate::model::RepoSource>,

    /// A copy of the build's `source.git_uri`, if exists, with any commits
    /// resolved.
    pub git_uri: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SourceProvenance {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
    pub fn set_resolved_storage_source<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::StorageSource>,
    {
        self.resolved_storage_source = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [resolved_storage_source][crate::model::SourceProvenance::resolved_storage_source].
    pub fn set_or_clear_resolved_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::StorageSource>,
    {
        self.resolved_storage_source = v.map(|x| x.into());
        self
    }

    /// Sets the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
    pub fn set_resolved_repo_source<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::RepoSource>,
    {
        self.resolved_repo_source = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [resolved_repo_source][crate::model::SourceProvenance::resolved_repo_source].
    pub fn set_or_clear_resolved_repo_source<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::RepoSource>,
    {
        self.resolved_repo_source = v.map(|x| x.into());
        self
    }

    /// Sets the value of [git_uri][crate::model::SourceProvenance::git_uri].
    pub fn set_git_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.git_uri = v.into();
        self
    }
}

impl wkt::message::Message for SourceProvenance {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.SourceProvenance"
    }
}

/// Describes the Build step of the function that builds a container from the
/// given source.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BuildConfig {
    /// Output only. The Cloud Build name of the latest successful deployment of
    /// the function.
    pub build: std::string::String,

    /// The runtime in which to run the function. Required when deploying a new
    /// function, optional when updating an existing function. For a complete
    /// list of possible choices, see the
    /// [`gcloud` command
    /// reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime).
    pub runtime: std::string::String,

    /// The name of the function (as defined in source code) that will be
    /// executed. Defaults to the resource name suffix, if not specified. For
    /// backward compatibility, if function with given name is not found, then the
    /// system will try to use function named "function".
    /// For Node.js this is name of a function exported by the module specified
    /// in `source_location`.
    pub entry_point: std::string::String,

    /// The location of the function source code.
    pub source: std::option::Option<crate::model::Source>,

    /// Output only. A permanent fixed identifier for source.
    pub source_provenance: std::option::Option<crate::model::SourceProvenance>,

    /// Name of the Cloud Build Custom Worker Pool that should be used to build the
    /// function. The format of this field is
    /// `projects/{project}/locations/{region}/workerPools/{workerPool}` where
    /// {project} and {region} are the project id and region respectively where the
    /// worker pool is defined and {workerPool} is the short name of the worker
    /// pool.
    ///
    /// If the project id is not the same as the function, then the Cloud
    /// Functions Service Agent
    /// (service-<project_number>@gcf-admin-robot.iam.gserviceaccount.com) must be
    /// granted the role Cloud Build Custom Workers Builder
    /// (roles/cloudbuild.customworkers.builder) in the project.
    pub worker_pool: std::string::String,

    /// User-provided build-time environment variables for the function
    pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,

    /// Docker Registry to use for this deployment. This configuration is only
    /// applicable to 1st Gen functions, 2nd Gen functions can only use Artifact
    /// Registry.
    /// Deprecated: As of March 2025, `CONTAINER_REGISTRY` option is no longer
    /// available in response to Container Registry's deprecation:
    /// <https://cloud.google.com/artifact-registry/docs/transition/transition-from-gcr>
    /// Please use Artifact Registry instead, which is the default choice.
    ///
    /// If unspecified, it defaults to `ARTIFACT_REGISTRY`.
    /// If `docker_repository` field is specified, this field should either be left
    /// unspecified or set to `ARTIFACT_REGISTRY`.
    #[deprecated]
    pub docker_registry: crate::model::build_config::DockerRegistry,

    /// Repository in Artifact Registry to which the function docker image will be
    /// pushed after it is built by Cloud Build. If specified by user, it is
    /// created and managed by user with a customer managed encryption key.
    /// Otherwise, GCF will create and use a repository named 'gcf-artifacts'
    /// for every deployed region.
    ///
    /// It must match the pattern
    /// `projects/{project}/locations/{location}/repositories/{repository}`.
    /// Repository format must be 'DOCKER'.
    pub docker_repository: std::string::String,

    /// Service account to be used for building the container. The format of this
    /// field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.
    pub service_account: std::string::String,

    /// This controls when security patches are applied to the runtime environment.
    pub runtime_update_policy: std::option::Option<crate::model::build_config::RuntimeUpdatePolicy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl BuildConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [build][crate::model::BuildConfig::build].
    pub fn set_build<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.build = v.into();
        self
    }

    /// Sets the value of [runtime][crate::model::BuildConfig::runtime].
    pub fn set_runtime<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.runtime = v.into();
        self
    }

    /// Sets the value of [entry_point][crate::model::BuildConfig::entry_point].
    pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.entry_point = v.into();
        self
    }

    /// Sets the value of [source][crate::model::BuildConfig::source].
    pub fn set_source<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Source>,
    {
        self.source = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [source][crate::model::BuildConfig::source].
    pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Source>,
    {
        self.source = v.map(|x| x.into());
        self
    }

    /// Sets the value of [source_provenance][crate::model::BuildConfig::source_provenance].
    pub fn set_source_provenance<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::SourceProvenance>,
    {
        self.source_provenance = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [source_provenance][crate::model::BuildConfig::source_provenance].
    pub fn set_or_clear_source_provenance<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::SourceProvenance>,
    {
        self.source_provenance = v.map(|x| x.into());
        self
    }

    /// Sets the value of [worker_pool][crate::model::BuildConfig::worker_pool].
    pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.worker_pool = v.into();
        self
    }

    /// Sets the value of [environment_variables][crate::model::BuildConfig::environment_variables].
    pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [docker_registry][crate::model::BuildConfig::docker_registry].
    #[deprecated]
    pub fn set_docker_registry<
        T: std::convert::Into<crate::model::build_config::DockerRegistry>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.docker_registry = v.into();
        self
    }

    /// Sets the value of [docker_repository][crate::model::BuildConfig::docker_repository].
    pub fn set_docker_repository<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.docker_repository = v.into();
        self
    }

    /// Sets the value of [service_account][crate::model::BuildConfig::service_account].
    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.service_account = v.into();
        self
    }

    /// Sets the value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy].
    ///
    /// Note that all the setters affecting `runtime_update_policy` are mutually
    /// exclusive.
    pub fn set_runtime_update_policy<
        T: std::convert::Into<std::option::Option<crate::model::build_config::RuntimeUpdatePolicy>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.runtime_update_policy = v.into();
        self
    }

    /// The value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
    /// if it holds a `AutomaticUpdatePolicy`, `None` if the field is not set or
    /// holds a different branch.
    pub fn automatic_update_policy(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::AutomaticUpdatePolicy>> {
        #[allow(unreachable_patterns)]
        self.runtime_update_policy.as_ref().and_then(|v| match v {
            crate::model::build_config::RuntimeUpdatePolicy::AutomaticUpdatePolicy(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
    /// to hold a `AutomaticUpdatePolicy`.
    ///
    /// Note that all the setters affecting `runtime_update_policy` are
    /// mutually exclusive.
    pub fn set_automatic_update_policy<
        T: std::convert::Into<std::boxed::Box<crate::model::AutomaticUpdatePolicy>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.runtime_update_policy = std::option::Option::Some(
            crate::model::build_config::RuntimeUpdatePolicy::AutomaticUpdatePolicy(v.into()),
        );
        self
    }

    /// The value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
    /// if it holds a `OnDeployUpdatePolicy`, `None` if the field is not set or
    /// holds a different branch.
    pub fn on_deploy_update_policy(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::OnDeployUpdatePolicy>> {
        #[allow(unreachable_patterns)]
        self.runtime_update_policy.as_ref().and_then(|v| match v {
            crate::model::build_config::RuntimeUpdatePolicy::OnDeployUpdatePolicy(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [runtime_update_policy][crate::model::BuildConfig::runtime_update_policy]
    /// to hold a `OnDeployUpdatePolicy`.
    ///
    /// Note that all the setters affecting `runtime_update_policy` are
    /// mutually exclusive.
    pub fn set_on_deploy_update_policy<
        T: std::convert::Into<std::boxed::Box<crate::model::OnDeployUpdatePolicy>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.runtime_update_policy = std::option::Option::Some(
            crate::model::build_config::RuntimeUpdatePolicy::OnDeployUpdatePolicy(v.into()),
        );
        self
    }
}

impl wkt::message::Message for BuildConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.BuildConfig"
    }
}

/// Defines additional types related to [BuildConfig].
pub mod build_config {
    #[allow(unused_imports)]
    use super::*;

    /// Docker Registry to use for storing function Docker images.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum DockerRegistry {
        /// Unspecified.
        Unspecified,
        /// Docker images will be stored in multi-regional Container Registry
        /// repositories named `gcf`.
        ContainerRegistry,
        /// Docker images will be stored in regional Artifact Registry repositories.
        /// By default, GCF will create and use repositories named `gcf-artifacts`
        /// in every region in which a function is deployed. But the repository to
        /// use can also be specified by the user using the `docker_repository`
        /// field.
        ArtifactRegistry,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [DockerRegistry::value] or
        /// [DockerRegistry::name].
        UnknownValue(docker_registry::UnknownValue),
    }

    #[doc(hidden)]
    pub mod docker_registry {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl DockerRegistry {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::ContainerRegistry => std::option::Option::Some(1),
                Self::ArtifactRegistry => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("DOCKER_REGISTRY_UNSPECIFIED"),
                Self::ContainerRegistry => std::option::Option::Some("CONTAINER_REGISTRY"),
                Self::ArtifactRegistry => std::option::Option::Some("ARTIFACT_REGISTRY"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for DockerRegistry {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for DockerRegistry {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for DockerRegistry {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::ContainerRegistry,
                2 => Self::ArtifactRegistry,
                _ => Self::UnknownValue(docker_registry::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for DockerRegistry {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "DOCKER_REGISTRY_UNSPECIFIED" => Self::Unspecified,
                "CONTAINER_REGISTRY" => Self::ContainerRegistry,
                "ARTIFACT_REGISTRY" => Self::ArtifactRegistry,
                _ => Self::UnknownValue(docker_registry::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for DockerRegistry {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::ContainerRegistry => serializer.serialize_i32(1),
                Self::ArtifactRegistry => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for DockerRegistry {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DockerRegistry>::new(
                ".google.cloud.functions.v2.BuildConfig.DockerRegistry",
            ))
        }
    }

    /// This controls when security patches are applied to the runtime environment.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum RuntimeUpdatePolicy {
        AutomaticUpdatePolicy(std::boxed::Box<crate::model::AutomaticUpdatePolicy>),
        OnDeployUpdatePolicy(std::boxed::Box<crate::model::OnDeployUpdatePolicy>),
    }
}

/// Describes the Service being deployed.
/// Currently Supported : Cloud Run (fully managed).
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServiceConfig {
    /// Output only. Name of the service associated with a Function.
    /// The format of this field is
    /// `projects/{project}/locations/{region}/services/{service}`
    pub service: std::string::String,

    /// The function execution timeout. Execution is considered failed and
    /// can be terminated if the function is not completed at the end of the
    /// timeout period. Defaults to 60 seconds.
    pub timeout_seconds: i32,

    /// The amount of memory available for a function.
    /// Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is
    /// supplied the value is interpreted as bytes.
    /// See
    /// <https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go>
    /// a full description.
    pub available_memory: std::string::String,

    /// The number of CPUs used in a single container instance.
    /// Default value is calculated from available memory.
    /// Supports the same values as Cloud Run, see
    /// <https://cloud.google.com/run/docs/reference/rest/v1/Container#resourcerequirements>
    /// Example: "1" indicates 1 vCPU
    pub available_cpu: std::string::String,

    /// Environment variables that shall be available during function execution.
    pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,

    /// The limit on the maximum number of function instances that may coexist at a
    /// given time.
    ///
    /// In some cases, such as rapid traffic surges, Cloud Functions may, for a
    /// short period of time, create more instances than the specified max
    /// instances limit. If your function cannot tolerate this temporary behavior,
    /// you may want to factor in a safety margin and set a lower max instances
    /// value than your function can tolerate.
    ///
    /// See the [Max
    /// Instances](https://cloud.google.com/functions/docs/max-instances) Guide for
    /// more details.
    pub max_instance_count: i32,

    /// The limit on the minimum number of function instances that may coexist at a
    /// given time.
    ///
    /// Function instances are kept in idle state for a short period after they
    /// finished executing the request to reduce cold start time for subsequent
    /// requests. Setting a minimum instance count will ensure that the given
    /// number of instances are kept running in idle state always. This can help
    /// with cold start times when jump in incoming request count occurs after the
    /// idle instance would have been stopped in the default case.
    pub min_instance_count: i32,

    /// The Serverless VPC Access connector that this cloud function can connect
    /// to. The format of this field is `projects/*/locations/*/connectors/*`.
    pub vpc_connector: std::string::String,

    /// The egress settings for the connector, controlling what traffic is diverted
    /// through it.
    pub vpc_connector_egress_settings: crate::model::service_config::VpcConnectorEgressSettings,

    /// The ingress settings for the function, controlling what traffic can reach
    /// it.
    pub ingress_settings: crate::model::service_config::IngressSettings,

    /// Output only. URI of the Service deployed.
    pub uri: std::string::String,

    /// The email of the service's service account. If empty, defaults to
    /// `{project_number}-compute@developer.gserviceaccount.com`.
    pub service_account_email: std::string::String,

    /// Whether 100% of traffic is routed to the latest revision.
    /// On CreateFunction and UpdateFunction, when set to true, the revision being
    /// deployed will serve 100% of traffic, ignoring any traffic split settings,
    /// if any. On GetFunction, true will be returned if the latest revision is
    /// serving 100% of traffic.
    pub all_traffic_on_latest_revision: bool,

    /// Secret environment variables configuration.
    pub secret_environment_variables: std::vec::Vec<crate::model::SecretEnvVar>,

    /// Secret volumes configuration.
    pub secret_volumes: std::vec::Vec<crate::model::SecretVolume>,

    /// Output only. The name of service revision.
    pub revision: std::string::String,

    /// Sets the maximum number of concurrent requests that each instance
    /// can receive. Defaults to 1.
    pub max_instance_request_concurrency: i32,

    /// Security level configure whether the function only accepts https.
    /// This configuration is only applicable to 1st Gen functions with Http
    /// trigger. By default https is optional for 1st Gen functions; 2nd Gen
    /// functions are https ONLY.
    pub security_level: crate::model::service_config::SecurityLevel,

    /// Optional. The binary authorization policy to be checked when deploying the
    /// Cloud Run service.
    pub binary_authorization_policy: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ServiceConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [service][crate::model::ServiceConfig::service].
    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.service = v.into();
        self
    }

    /// Sets the value of [timeout_seconds][crate::model::ServiceConfig::timeout_seconds].
    pub fn set_timeout_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.timeout_seconds = v.into();
        self
    }

    /// Sets the value of [available_memory][crate::model::ServiceConfig::available_memory].
    pub fn set_available_memory<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.available_memory = v.into();
        self
    }

    /// Sets the value of [available_cpu][crate::model::ServiceConfig::available_cpu].
    pub fn set_available_cpu<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.available_cpu = v.into();
        self
    }

    /// Sets the value of [environment_variables][crate::model::ServiceConfig::environment_variables].
    pub fn set_environment_variables<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [max_instance_count][crate::model::ServiceConfig::max_instance_count].
    pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.max_instance_count = v.into();
        self
    }

    /// Sets the value of [min_instance_count][crate::model::ServiceConfig::min_instance_count].
    pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.min_instance_count = v.into();
        self
    }

    /// Sets the value of [vpc_connector][crate::model::ServiceConfig::vpc_connector].
    pub fn set_vpc_connector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.vpc_connector = v.into();
        self
    }

    /// Sets the value of [vpc_connector_egress_settings][crate::model::ServiceConfig::vpc_connector_egress_settings].
    pub fn set_vpc_connector_egress_settings<
        T: std::convert::Into<crate::model::service_config::VpcConnectorEgressSettings>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.vpc_connector_egress_settings = v.into();
        self
    }

    /// Sets the value of [ingress_settings][crate::model::ServiceConfig::ingress_settings].
    pub fn set_ingress_settings<
        T: std::convert::Into<crate::model::service_config::IngressSettings>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.ingress_settings = v.into();
        self
    }

    /// Sets the value of [uri][crate::model::ServiceConfig::uri].
    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uri = v.into();
        self
    }

    /// Sets the value of [service_account_email][crate::model::ServiceConfig::service_account_email].
    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.service_account_email = v.into();
        self
    }

    /// Sets the value of [all_traffic_on_latest_revision][crate::model::ServiceConfig::all_traffic_on_latest_revision].
    pub fn set_all_traffic_on_latest_revision<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.all_traffic_on_latest_revision = v.into();
        self
    }

    /// Sets the value of [secret_environment_variables][crate::model::ServiceConfig::secret_environment_variables].
    pub fn set_secret_environment_variables<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::SecretEnvVar>,
    {
        use std::iter::Iterator;
        self.secret_environment_variables = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [secret_volumes][crate::model::ServiceConfig::secret_volumes].
    pub fn set_secret_volumes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::SecretVolume>,
    {
        use std::iter::Iterator;
        self.secret_volumes = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [revision][crate::model::ServiceConfig::revision].
    pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.revision = v.into();
        self
    }

    /// Sets the value of [max_instance_request_concurrency][crate::model::ServiceConfig::max_instance_request_concurrency].
    pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
        mut self,
        v: T,
    ) -> Self {
        self.max_instance_request_concurrency = v.into();
        self
    }

    /// Sets the value of [security_level][crate::model::ServiceConfig::security_level].
    pub fn set_security_level<
        T: std::convert::Into<crate::model::service_config::SecurityLevel>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.security_level = v.into();
        self
    }

    /// Sets the value of [binary_authorization_policy][crate::model::ServiceConfig::binary_authorization_policy].
    pub fn set_binary_authorization_policy<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.binary_authorization_policy = v.into();
        self
    }
}

impl wkt::message::Message for ServiceConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.ServiceConfig"
    }
}

/// Defines additional types related to [ServiceConfig].
pub mod service_config {
    #[allow(unused_imports)]
    use super::*;

    /// Available egress settings.
    ///
    /// This controls what traffic is diverted through the VPC Access Connector
    /// resource. By default PRIVATE_RANGES_ONLY will be used.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum VpcConnectorEgressSettings {
        /// Unspecified.
        Unspecified,
        /// Use the VPC Access Connector only for private IP space from RFC1918.
        PrivateRangesOnly,
        /// Force the use of VPC Access Connector for all egress traffic from the
        /// function.
        AllTraffic,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [VpcConnectorEgressSettings::value] or
        /// [VpcConnectorEgressSettings::name].
        UnknownValue(vpc_connector_egress_settings::UnknownValue),
    }

    #[doc(hidden)]
    pub mod vpc_connector_egress_settings {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl VpcConnectorEgressSettings {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::PrivateRangesOnly => std::option::Option::Some(1),
                Self::AllTraffic => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => {
                    std::option::Option::Some("VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED")
                }
                Self::PrivateRangesOnly => std::option::Option::Some("PRIVATE_RANGES_ONLY"),
                Self::AllTraffic => std::option::Option::Some("ALL_TRAFFIC"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for VpcConnectorEgressSettings {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for VpcConnectorEgressSettings {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for VpcConnectorEgressSettings {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::PrivateRangesOnly,
                2 => Self::AllTraffic,
                _ => Self::UnknownValue(vpc_connector_egress_settings::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for VpcConnectorEgressSettings {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" => Self::Unspecified,
                "PRIVATE_RANGES_ONLY" => Self::PrivateRangesOnly,
                "ALL_TRAFFIC" => Self::AllTraffic,
                _ => Self::UnknownValue(vpc_connector_egress_settings::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for VpcConnectorEgressSettings {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::PrivateRangesOnly => serializer.serialize_i32(1),
                Self::AllTraffic => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for VpcConnectorEgressSettings {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(
                wkt::internal::EnumVisitor::<VpcConnectorEgressSettings>::new(
                    ".google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings",
                ),
            )
        }
    }

    /// Available ingress settings.
    ///
    /// This controls what traffic can reach the function.
    ///
    /// If unspecified, ALLOW_ALL will be used.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum IngressSettings {
        /// Unspecified.
        Unspecified,
        /// Allow HTTP traffic from public and private sources.
        AllowAll,
        /// Allow HTTP traffic from only private VPC sources.
        AllowInternalOnly,
        /// Allow HTTP traffic from private VPC sources and through GCLB.
        AllowInternalAndGclb,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [IngressSettings::value] or
        /// [IngressSettings::name].
        UnknownValue(ingress_settings::UnknownValue),
    }

    #[doc(hidden)]
    pub mod ingress_settings {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl IngressSettings {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::AllowAll => std::option::Option::Some(1),
                Self::AllowInternalOnly => std::option::Option::Some(2),
                Self::AllowInternalAndGclb => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("INGRESS_SETTINGS_UNSPECIFIED"),
                Self::AllowAll => std::option::Option::Some("ALLOW_ALL"),
                Self::AllowInternalOnly => std::option::Option::Some("ALLOW_INTERNAL_ONLY"),
                Self::AllowInternalAndGclb => std::option::Option::Some("ALLOW_INTERNAL_AND_GCLB"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for IngressSettings {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for IngressSettings {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for IngressSettings {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::AllowAll,
                2 => Self::AllowInternalOnly,
                3 => Self::AllowInternalAndGclb,
                _ => Self::UnknownValue(ingress_settings::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for IngressSettings {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "INGRESS_SETTINGS_UNSPECIFIED" => Self::Unspecified,
                "ALLOW_ALL" => Self::AllowAll,
                "ALLOW_INTERNAL_ONLY" => Self::AllowInternalOnly,
                "ALLOW_INTERNAL_AND_GCLB" => Self::AllowInternalAndGclb,
                _ => Self::UnknownValue(ingress_settings::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for IngressSettings {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::AllowAll => serializer.serialize_i32(1),
                Self::AllowInternalOnly => serializer.serialize_i32(2),
                Self::AllowInternalAndGclb => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for IngressSettings {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngressSettings>::new(
                ".google.cloud.functions.v2.ServiceConfig.IngressSettings",
            ))
        }
    }

    /// Available security level settings.
    ///
    /// This enforces security protocol on function URL.
    ///
    /// Security level is only configurable for 1st Gen functions, If unspecified,
    /// SECURE_OPTIONAL will be used. 2nd Gen functions are SECURE_ALWAYS ONLY.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum SecurityLevel {
        /// Unspecified.
        Unspecified,
        /// Requests for a URL that match this handler that do not use HTTPS are
        /// automatically redirected to the HTTPS URL with the same path. Query
        /// parameters are reserved for the redirect.
        SecureAlways,
        /// Both HTTP and HTTPS requests with URLs that match the handler succeed
        /// without redirects. The application can examine the request to determine
        /// which protocol was used and respond accordingly.
        SecureOptional,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [SecurityLevel::value] or
        /// [SecurityLevel::name].
        UnknownValue(security_level::UnknownValue),
    }

    #[doc(hidden)]
    pub mod security_level {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl SecurityLevel {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::SecureAlways => std::option::Option::Some(1),
                Self::SecureOptional => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("SECURITY_LEVEL_UNSPECIFIED"),
                Self::SecureAlways => std::option::Option::Some("SECURE_ALWAYS"),
                Self::SecureOptional => std::option::Option::Some("SECURE_OPTIONAL"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for SecurityLevel {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for SecurityLevel {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for SecurityLevel {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::SecureAlways,
                2 => Self::SecureOptional,
                _ => Self::UnknownValue(security_level::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for SecurityLevel {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "SECURITY_LEVEL_UNSPECIFIED" => Self::Unspecified,
                "SECURE_ALWAYS" => Self::SecureAlways,
                "SECURE_OPTIONAL" => Self::SecureOptional,
                _ => Self::UnknownValue(security_level::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for SecurityLevel {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::SecureAlways => serializer.serialize_i32(1),
                Self::SecureOptional => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for SecurityLevel {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SecurityLevel>::new(
                ".google.cloud.functions.v2.ServiceConfig.SecurityLevel",
            ))
        }
    }
}

/// Configuration for a secret environment variable. It has the information
/// necessary to fetch the secret value from secret manager and expose it as an
/// environment variable.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SecretEnvVar {
    /// Name of the environment variable.
    pub key: std::string::String,

    /// Project identifier (preferably project number but can also be the
    /// project ID) of the project that contains the secret. If not set, it is
    /// assumed that the secret is in the same project as the function.
    pub project_id: std::string::String,

    /// Name of the secret in secret manager (not the full resource name).
    pub secret: std::string::String,

    /// Version of the secret (version number or the string 'latest'). It is
    /// recommended to use a numeric version for secret environment variables as
    /// any updates to the secret value is not reflected until new instances
    /// start.
    pub version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SecretEnvVar {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [key][crate::model::SecretEnvVar::key].
    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.key = v.into();
        self
    }

    /// Sets the value of [project_id][crate::model::SecretEnvVar::project_id].
    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.project_id = v.into();
        self
    }

    /// Sets the value of [secret][crate::model::SecretEnvVar::secret].
    pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.secret = v.into();
        self
    }

    /// Sets the value of [version][crate::model::SecretEnvVar::version].
    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.version = v.into();
        self
    }
}

impl wkt::message::Message for SecretEnvVar {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.SecretEnvVar"
    }
}

/// Configuration for a secret volume. It has the information necessary to fetch
/// the secret value from secret manager and make it available as files mounted
/// at the requested paths within the application container.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SecretVolume {
    /// The path within the container to mount the secret volume. For example,
    /// setting the mount_path as `/etc/secrets` would mount the secret value files
    /// under the `/etc/secrets` directory. This directory will also be completely
    /// shadowed and unavailable to mount any other secrets.
    /// Recommended mount path: /etc/secrets
    pub mount_path: std::string::String,

    /// Project identifier (preferably project number but can also be the project
    /// ID) of the project that contains the secret. If not set, it is
    /// assumed that the secret is in the same project as the function.
    pub project_id: std::string::String,

    /// Name of the secret in secret manager (not the full resource name).
    pub secret: std::string::String,

    /// List of secret versions to mount for this secret. If empty, the `latest`
    /// version of the secret will be made available in a file named after the
    /// secret under the mount point.
    pub versions: std::vec::Vec<crate::model::secret_volume::SecretVersion>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SecretVolume {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [mount_path][crate::model::SecretVolume::mount_path].
    pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.mount_path = v.into();
        self
    }

    /// Sets the value of [project_id][crate::model::SecretVolume::project_id].
    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.project_id = v.into();
        self
    }

    /// Sets the value of [secret][crate::model::SecretVolume::secret].
    pub fn set_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.secret = v.into();
        self
    }

    /// Sets the value of [versions][crate::model::SecretVolume::versions].
    pub fn set_versions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::secret_volume::SecretVersion>,
    {
        use std::iter::Iterator;
        self.versions = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for SecretVolume {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.SecretVolume"
    }
}

/// Defines additional types related to [SecretVolume].
pub mod secret_volume {
    #[allow(unused_imports)]
    use super::*;

    /// Configuration for a single version.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct SecretVersion {
        /// Version of the secret (version number or the string 'latest'). It is
        /// preferable to use `latest` version with secret volumes as secret value
        /// changes are reflected immediately.
        pub version: std::string::String,

        /// Relative path of the file under the mount path where the secret value for
        /// this version will be fetched and made available. For example, setting the
        /// mount_path as '/etc/secrets' and path as `secret_foo` would mount the
        /// secret value file at `/etc/secrets/secret_foo`.
        pub path: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl SecretVersion {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [version][crate::model::secret_volume::SecretVersion::version].
        pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.version = v.into();
            self
        }

        /// Sets the value of [path][crate::model::secret_volume::SecretVersion::path].
        pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.path = v.into();
            self
        }
    }

    impl wkt::message::Message for SecretVersion {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.functions.v2.SecretVolume.SecretVersion"
        }
    }
}

/// Describes EventTrigger, used to request events to be sent from another
/// service.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EventTrigger {
    /// Output only. The resource name of the Eventarc trigger. The format of this
    /// field is `projects/{project}/locations/{region}/triggers/{trigger}`.
    pub trigger: std::string::String,

    /// The region that the trigger will be in. The trigger will only receive
    /// events originating in this region. It can be the same
    /// region as the function, a different region or multi-region, or the global
    /// region. If not provided, defaults to the same region as the function.
    pub trigger_region: std::string::String,

    /// Required. The type of event to observe. For example:
    /// `google.cloud.audit.log.v1.written` or
    /// `google.cloud.pubsub.topic.v1.messagePublished`.
    pub event_type: std::string::String,

    /// Criteria used to filter events.
    pub event_filters: std::vec::Vec<crate::model::EventFilter>,

    /// Optional. The name of a Pub/Sub topic in the same project that will be used
    /// as the transport topic for the event delivery. Format:
    /// `projects/{project}/topics/{topic}`.
    ///
    /// This is only valid for events of type
    /// `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here
    /// will not be deleted at function deletion.
    pub pubsub_topic: std::string::String,

    /// Optional. The email of the trigger's service account. The service account
    /// must have permission to invoke Cloud Run services, the permission is
    /// `run.routes.invoke`.
    /// If empty, defaults to the Compute Engine default service account:
    /// `{project_number}-compute@developer.gserviceaccount.com`.
    pub service_account_email: std::string::String,

    /// Optional. If unset, then defaults to ignoring failures (i.e. not retrying
    /// them).
    pub retry_policy: crate::model::event_trigger::RetryPolicy,

    /// Optional. The name of the channel associated with the trigger in
    /// `projects/{project}/locations/{location}/channels/{channel}` format.
    /// You must provide a channel to receive events from Eventarc SaaS partners.
    pub channel: std::string::String,

    /// Optional. The hostname of the service that 1st Gen function should be
    /// observed.
    ///
    /// If no string is provided, the default service implementing the API will
    /// be used. For example, `storage.googleapis.com` is the default for all
    /// event types in the `google.storage` namespace.
    ///
    /// The field is only applicable to 1st Gen functions.
    pub service: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EventTrigger {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [trigger][crate::model::EventTrigger::trigger].
    pub fn set_trigger<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.trigger = v.into();
        self
    }

    /// Sets the value of [trigger_region][crate::model::EventTrigger::trigger_region].
    pub fn set_trigger_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.trigger_region = v.into();
        self
    }

    /// Sets the value of [event_type][crate::model::EventTrigger::event_type].
    pub fn set_event_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.event_type = v.into();
        self
    }

    /// Sets the value of [event_filters][crate::model::EventTrigger::event_filters].
    pub fn set_event_filters<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::EventFilter>,
    {
        use std::iter::Iterator;
        self.event_filters = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [pubsub_topic][crate::model::EventTrigger::pubsub_topic].
    pub fn set_pubsub_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.pubsub_topic = v.into();
        self
    }

    /// Sets the value of [service_account_email][crate::model::EventTrigger::service_account_email].
    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.service_account_email = v.into();
        self
    }

    /// Sets the value of [retry_policy][crate::model::EventTrigger::retry_policy].
    pub fn set_retry_policy<T: std::convert::Into<crate::model::event_trigger::RetryPolicy>>(
        mut self,
        v: T,
    ) -> Self {
        self.retry_policy = v.into();
        self
    }

    /// Sets the value of [channel][crate::model::EventTrigger::channel].
    pub fn set_channel<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.channel = v.into();
        self
    }

    /// Sets the value of [service][crate::model::EventTrigger::service].
    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.service = v.into();
        self
    }
}

impl wkt::message::Message for EventTrigger {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.EventTrigger"
    }
}

/// Defines additional types related to [EventTrigger].
pub mod event_trigger {
    #[allow(unused_imports)]
    use super::*;

    /// Describes the retry policy in case of function's execution failure.
    /// Retried execution is charged as any other execution.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum RetryPolicy {
        /// Not specified.
        Unspecified,
        /// Do not retry.
        DoNotRetry,
        /// Retry on any failure, retry up to 7 days with an exponential backoff
        /// (capped at 10 seconds).
        Retry,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [RetryPolicy::value] or
        /// [RetryPolicy::name].
        UnknownValue(retry_policy::UnknownValue),
    }

    #[doc(hidden)]
    pub mod retry_policy {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl RetryPolicy {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::DoNotRetry => std::option::Option::Some(1),
                Self::Retry => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("RETRY_POLICY_UNSPECIFIED"),
                Self::DoNotRetry => std::option::Option::Some("RETRY_POLICY_DO_NOT_RETRY"),
                Self::Retry => std::option::Option::Some("RETRY_POLICY_RETRY"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for RetryPolicy {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for RetryPolicy {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for RetryPolicy {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::DoNotRetry,
                2 => Self::Retry,
                _ => Self::UnknownValue(retry_policy::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for RetryPolicy {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "RETRY_POLICY_UNSPECIFIED" => Self::Unspecified,
                "RETRY_POLICY_DO_NOT_RETRY" => Self::DoNotRetry,
                "RETRY_POLICY_RETRY" => Self::Retry,
                _ => Self::UnknownValue(retry_policy::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for RetryPolicy {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::DoNotRetry => serializer.serialize_i32(1),
                Self::Retry => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for RetryPolicy {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetryPolicy>::new(
                ".google.cloud.functions.v2.EventTrigger.RetryPolicy",
            ))
        }
    }
}

/// Filters events based on exact matches on the CloudEvents attributes.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EventFilter {
    /// Required. The name of a CloudEvents attribute.
    pub attribute: std::string::String,

    /// Required. The value for the attribute.
    pub value: std::string::String,

    /// Optional. The operator used for matching the events with the value of the
    /// filter. If not specified, only events that have an exact key-value pair
    /// specified in the filter are matched. The only allowed value is
    /// `match-path-pattern`.
    pub operator: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EventFilter {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [attribute][crate::model::EventFilter::attribute].
    pub fn set_attribute<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.attribute = v.into();
        self
    }

    /// Sets the value of [value][crate::model::EventFilter::value].
    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.value = v.into();
        self
    }

    /// Sets the value of [operator][crate::model::EventFilter::operator].
    pub fn set_operator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.operator = v.into();
        self
    }
}

impl wkt::message::Message for EventFilter {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.EventFilter"
    }
}

/// Request for the `GetFunction` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetFunctionRequest {
    /// Required. The name of the function which details should be obtained.
    pub name: std::string::String,

    /// Optional. The optional version of the 1st gen function whose details should
    /// be obtained. The version of a 1st gen function is an integer that starts
    /// from 1 and gets incremented on redeployments. GCF may keep historical
    /// configs for old versions of 1st gen function. This field can be specified
    /// to fetch the historical configs. This field is valid only for GCF 1st gen
    /// function.
    pub revision: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetFunctionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetFunctionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [revision][crate::model::GetFunctionRequest::revision].
    pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.revision = v.into();
        self
    }
}

impl wkt::message::Message for GetFunctionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.GetFunctionRequest"
    }
}

/// Request for the `ListFunctions` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListFunctionsRequest {
    /// Required. The project and location from which the function should be
    /// listed, specified in the format `projects/*/locations/*` If you want to
    /// list functions in all locations, use "-" in place of a location. When
    /// listing functions in all locations, if one or more location(s) are
    /// unreachable, the response will contain functions from all reachable
    /// locations along with the names of any unreachable locations.
    pub parent: std::string::String,

    /// Maximum number of functions to return per call. The largest allowed
    /// page_size is 1,000, if the page_size is omitted or specified as greater
    /// than 1,000 then it will be replaced as 1,000. The size of the list
    /// response can be less than specified when used with filters.
    pub page_size: i32,

    /// The value returned by the last
    /// `ListFunctionsResponse`; indicates that
    /// this is a continuation of a prior `ListFunctions` call, and that the
    /// system should return the next page of data.
    pub page_token: std::string::String,

    /// The filter for Functions that match the filter expression,
    /// following the syntax outlined in <https://google.aip.dev/160>.
    pub filter: std::string::String,

    /// The sorting order of the resources returned. Value should be a comma
    /// separated list of fields. The default sorting order is ascending.
    /// See <https://google.aip.dev/132#ordering>.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListFunctionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListFunctionsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListFunctionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListFunctionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListFunctionsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListFunctionsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListFunctionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.ListFunctionsRequest"
    }
}

/// Response for the `ListFunctions` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListFunctionsResponse {
    /// The functions that match the request.
    pub functions: std::vec::Vec<crate::model::Function>,

    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached. The response does not include any
    /// functions from these locations.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListFunctionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [functions][crate::model::ListFunctionsResponse::functions].
    pub fn set_functions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Function>,
    {
        use std::iter::Iterator;
        self.functions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListFunctionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListFunctionsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListFunctionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.ListFunctionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListFunctionsResponse {
    type PageItem = crate::model::Function;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.functions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request for the `CreateFunction` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateFunctionRequest {
    /// Required. The project and location in which the function should be created,
    /// specified in the format `projects/*/locations/*`
    pub parent: std::string::String,

    /// Required. Function to be created.
    pub function: std::option::Option<crate::model::Function>,

    /// The ID to use for the function, which will become the final component of
    /// the function's resource name.
    ///
    /// This value should be 4-63 characters, and valid characters
    /// are /[a-z][0-9]-/.
    pub function_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateFunctionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateFunctionRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [function][crate::model::CreateFunctionRequest::function].
    pub fn set_function<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Function>,
    {
        self.function = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [function][crate::model::CreateFunctionRequest::function].
    pub fn set_or_clear_function<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Function>,
    {
        self.function = v.map(|x| x.into());
        self
    }

    /// Sets the value of [function_id][crate::model::CreateFunctionRequest::function_id].
    pub fn set_function_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.function_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateFunctionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.CreateFunctionRequest"
    }
}

/// Request for the `UpdateFunction` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateFunctionRequest {
    /// Required. New version of the function.
    pub function: std::option::Option<crate::model::Function>,

    /// The list of fields to be updated.
    /// If no field mask is provided, all fields will be updated.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateFunctionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [function][crate::model::UpdateFunctionRequest::function].
    pub fn set_function<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Function>,
    {
        self.function = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [function][crate::model::UpdateFunctionRequest::function].
    pub fn set_or_clear_function<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Function>,
    {
        self.function = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateFunctionRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateFunctionRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateFunctionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.UpdateFunctionRequest"
    }
}

/// Request for the `DeleteFunction` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteFunctionRequest {
    /// Required. The name of the function which should be deleted.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteFunctionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteFunctionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteFunctionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.DeleteFunctionRequest"
    }
}

/// Request of `GenerateSourceUploadUrl` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateUploadUrlRequest {
    /// Required. The project and location in which the Google Cloud Storage signed
    /// URL should be generated, specified in the format `projects/*/locations/*`.
    pub parent: std::string::String,

    /// Resource name of a KMS crypto key (managed by the user) used to
    /// encrypt/decrypt function source code objects in intermediate Cloud Storage
    /// buckets. When you generate an upload url and upload your source code, it
    /// gets copied to an intermediate Cloud Storage bucket. The source code is
    /// then copied to a versioned directory in the sources bucket in the consumer
    /// project during the function deployment.
    ///
    /// It must match the pattern
    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
    ///
    /// The Google Cloud Functions service account
    /// (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be
    /// granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter
    /// (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the
    /// Key/KeyRing/Project/Organization (least access preferred).
    pub kms_key_name: std::string::String,

    /// The function environment the generated upload url will be used for.
    /// The upload url for 2nd Gen functions can also be used for 1st gen
    /// functions, but not vice versa. If not specified, 2nd generation-style
    /// upload URLs are generated.
    pub environment: crate::model::Environment,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GenerateUploadUrlRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::GenerateUploadUrlRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [kms_key_name][crate::model::GenerateUploadUrlRequest::kms_key_name].
    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.kms_key_name = v.into();
        self
    }

    /// Sets the value of [environment][crate::model::GenerateUploadUrlRequest::environment].
    pub fn set_environment<T: std::convert::Into<crate::model::Environment>>(
        mut self,
        v: T,
    ) -> Self {
        self.environment = v.into();
        self
    }
}

impl wkt::message::Message for GenerateUploadUrlRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.GenerateUploadUrlRequest"
    }
}

/// Response of `GenerateSourceUploadUrl` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateUploadUrlResponse {
    /// The generated Google Cloud Storage signed URL that should be used for a
    /// function source code upload. The uploaded file should be a zip archive
    /// which contains a function.
    pub upload_url: std::string::String,

    /// The location of the source code in the upload bucket.
    ///
    /// Once the archive is uploaded using the `upload_url` use this field to
    /// set the `function.build_config.source.storage_source`
    /// during CreateFunction and UpdateFunction.
    ///
    /// Generation defaults to 0, as Cloud Storage provides a new generation only
    /// upon uploading a new object or version of an object.
    pub storage_source: std::option::Option<crate::model::StorageSource>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GenerateUploadUrlResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [upload_url][crate::model::GenerateUploadUrlResponse::upload_url].
    pub fn set_upload_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.upload_url = v.into();
        self
    }

    /// Sets the value of [storage_source][crate::model::GenerateUploadUrlResponse::storage_source].
    pub fn set_storage_source<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::StorageSource>,
    {
        self.storage_source = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [storage_source][crate::model::GenerateUploadUrlResponse::storage_source].
    pub fn set_or_clear_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::StorageSource>,
    {
        self.storage_source = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for GenerateUploadUrlResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.GenerateUploadUrlResponse"
    }
}

/// Request of `GenerateDownloadUrl` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateDownloadUrlRequest {
    /// Required. The name of function for which source code Google Cloud Storage
    /// signed URL should be generated.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GenerateDownloadUrlRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GenerateDownloadUrlRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GenerateDownloadUrlRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.GenerateDownloadUrlRequest"
    }
}

/// Response of `GenerateDownloadUrl` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateDownloadUrlResponse {
    /// The generated Google Cloud Storage signed URL that should be used for
    /// function source code download.
    pub download_url: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GenerateDownloadUrlResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [download_url][crate::model::GenerateDownloadUrlResponse::download_url].
    pub fn set_download_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.download_url = v.into();
        self
    }
}

impl wkt::message::Message for GenerateDownloadUrlResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.GenerateDownloadUrlResponse"
    }
}

/// Request for the `ListRuntimes` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRuntimesRequest {
    /// Required. The project and location from which the runtimes should be
    /// listed, specified in the format `projects/*/locations/*`
    pub parent: std::string::String,

    /// The filter for Runtimes that match the filter expression,
    /// following the syntax outlined in <https://google.aip.dev/160>.
    pub filter: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRuntimesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListRuntimesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListRuntimesRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }
}

impl wkt::message::Message for ListRuntimesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.ListRuntimesRequest"
    }
}

/// Response for the `ListRuntimes` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRuntimesResponse {
    /// The runtimes that match the request.
    pub runtimes: std::vec::Vec<crate::model::list_runtimes_response::Runtime>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRuntimesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [runtimes][crate::model::ListRuntimesResponse::runtimes].
    pub fn set_runtimes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::list_runtimes_response::Runtime>,
    {
        use std::iter::Iterator;
        self.runtimes = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListRuntimesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.ListRuntimesResponse"
    }
}

/// Defines additional types related to [ListRuntimesResponse].
pub mod list_runtimes_response {
    #[allow(unused_imports)]
    use super::*;

    /// Describes a runtime and any special information (e.g., deprecation status)
    /// related to it.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Runtime {
        /// The name of the runtime, e.g., 'go113', 'nodejs12', etc.
        pub name: std::string::String,

        /// The user facing name, eg 'Go 1.13', 'Node.js 12', etc.
        pub display_name: std::string::String,

        /// The stage of life this runtime is in, e.g., BETA, GA, etc.
        pub stage: crate::model::list_runtimes_response::RuntimeStage,

        /// Warning messages, e.g., a deprecation warning.
        pub warnings: std::vec::Vec<std::string::String>,

        /// The environment for the runtime.
        pub environment: crate::model::Environment,

        /// Deprecation date for the runtime.
        pub deprecation_date: std::option::Option<gtype::model::Date>,

        /// Decommission date for the runtime.
        pub decommission_date: std::option::Option<gtype::model::Date>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Runtime {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [name][crate::model::list_runtimes_response::Runtime::name].
        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.name = v.into();
            self
        }

        /// Sets the value of [display_name][crate::model::list_runtimes_response::Runtime::display_name].
        pub fn set_display_name<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.display_name = v.into();
            self
        }

        /// Sets the value of [stage][crate::model::list_runtimes_response::Runtime::stage].
        pub fn set_stage<
            T: std::convert::Into<crate::model::list_runtimes_response::RuntimeStage>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.stage = v.into();
            self
        }

        /// Sets the value of [warnings][crate::model::list_runtimes_response::Runtime::warnings].
        pub fn set_warnings<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.warnings = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [environment][crate::model::list_runtimes_response::Runtime::environment].
        pub fn set_environment<T: std::convert::Into<crate::model::Environment>>(
            mut self,
            v: T,
        ) -> Self {
            self.environment = v.into();
            self
        }

        /// Sets the value of [deprecation_date][crate::model::list_runtimes_response::Runtime::deprecation_date].
        pub fn set_deprecation_date<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<gtype::model::Date>,
        {
            self.deprecation_date = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [deprecation_date][crate::model::list_runtimes_response::Runtime::deprecation_date].
        pub fn set_or_clear_deprecation_date<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<gtype::model::Date>,
        {
            self.deprecation_date = v.map(|x| x.into());
            self
        }

        /// Sets the value of [decommission_date][crate::model::list_runtimes_response::Runtime::decommission_date].
        pub fn set_decommission_date<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<gtype::model::Date>,
        {
            self.decommission_date = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [decommission_date][crate::model::list_runtimes_response::Runtime::decommission_date].
        pub fn set_or_clear_decommission_date<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<gtype::model::Date>,
        {
            self.decommission_date = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for Runtime {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.functions.v2.ListRuntimesResponse.Runtime"
        }
    }

    /// The various stages that a runtime can be in.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum RuntimeStage {
        /// Not specified.
        Unspecified,
        /// The runtime is in development.
        Development,
        /// The runtime is in the Alpha stage.
        Alpha,
        /// The runtime is in the Beta stage.
        Beta,
        /// The runtime is generally available.
        Ga,
        /// The runtime is deprecated.
        Deprecated,
        /// The runtime is no longer supported.
        Decommissioned,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [RuntimeStage::value] or
        /// [RuntimeStage::name].
        UnknownValue(runtime_stage::UnknownValue),
    }

    #[doc(hidden)]
    pub mod runtime_stage {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl RuntimeStage {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Development => std::option::Option::Some(1),
                Self::Alpha => std::option::Option::Some(2),
                Self::Beta => std::option::Option::Some(3),
                Self::Ga => std::option::Option::Some(4),
                Self::Deprecated => std::option::Option::Some(5),
                Self::Decommissioned => std::option::Option::Some(6),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("RUNTIME_STAGE_UNSPECIFIED"),
                Self::Development => std::option::Option::Some("DEVELOPMENT"),
                Self::Alpha => std::option::Option::Some("ALPHA"),
                Self::Beta => std::option::Option::Some("BETA"),
                Self::Ga => std::option::Option::Some("GA"),
                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
                Self::Decommissioned => std::option::Option::Some("DECOMMISSIONED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for RuntimeStage {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for RuntimeStage {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for RuntimeStage {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Development,
                2 => Self::Alpha,
                3 => Self::Beta,
                4 => Self::Ga,
                5 => Self::Deprecated,
                6 => Self::Decommissioned,
                _ => Self::UnknownValue(runtime_stage::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for RuntimeStage {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "RUNTIME_STAGE_UNSPECIFIED" => Self::Unspecified,
                "DEVELOPMENT" => Self::Development,
                "ALPHA" => Self::Alpha,
                "BETA" => Self::Beta,
                "GA" => Self::Ga,
                "DEPRECATED" => Self::Deprecated,
                "DECOMMISSIONED" => Self::Decommissioned,
                _ => Self::UnknownValue(runtime_stage::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for RuntimeStage {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Development => serializer.serialize_i32(1),
                Self::Alpha => serializer.serialize_i32(2),
                Self::Beta => serializer.serialize_i32(3),
                Self::Ga => serializer.serialize_i32(4),
                Self::Deprecated => serializer.serialize_i32(5),
                Self::Decommissioned => serializer.serialize_i32(6),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for RuntimeStage {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RuntimeStage>::new(
                ".google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage",
            ))
        }
    }
}

/// Security patches are applied automatically to the runtime without requiring
/// the function to be redeployed.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AutomaticUpdatePolicy {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AutomaticUpdatePolicy {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for AutomaticUpdatePolicy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.AutomaticUpdatePolicy"
    }
}

/// Security patches are only applied when a function is redeployed.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OnDeployUpdatePolicy {
    /// Output only. contains the runtime version which was used during latest
    /// function deployment.
    pub runtime_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OnDeployUpdatePolicy {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [runtime_version][crate::model::OnDeployUpdatePolicy::runtime_version].
    pub fn set_runtime_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.runtime_version = v.into();
        self
    }
}

impl wkt::message::Message for OnDeployUpdatePolicy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.OnDeployUpdatePolicy"
    }
}

/// Represents the metadata of the long-running operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
    /// The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Human-readable status of the operation, if any.
    pub status_detail: std::string::String,

    /// Identifies whether the user has requested cancellation
    /// of the operation. Operations that have successfully been cancelled
    /// have
    /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
    /// corresponding to `Code.CANCELLED`.
    ///
    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub cancel_requested: bool,

    /// API version used to start the operation.
    pub api_version: std::string::String,

    /// The original request that started the operation.
    pub request_resource: std::option::Option<wkt::Any>,

    /// Mechanism for reporting in-progress stages
    pub stages: std::vec::Vec<crate::model::Stage>,

    /// An identifier for Firebase function sources. Disclaimer: This field is only
    /// supported for Firebase function deployments.
    pub source_token: std::string::String,

    /// The build name of the function for create and update operations.
    pub build_name: std::string::String,

    /// The operation type.
    pub operation_type: crate::model::OperationType,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::OperationMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
    pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_detail = v.into();
        self
    }

    /// Sets the value of [cancel_requested][crate::model::OperationMetadata::cancel_requested].
    pub fn set_cancel_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.cancel_requested = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }

    /// Sets the value of [request_resource][crate::model::OperationMetadata::request_resource].
    pub fn set_request_resource<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Any>,
    {
        self.request_resource = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [request_resource][crate::model::OperationMetadata::request_resource].
    pub fn set_or_clear_request_resource<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Any>,
    {
        self.request_resource = v.map(|x| x.into());
        self
    }

    /// Sets the value of [stages][crate::model::OperationMetadata::stages].
    pub fn set_stages<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Stage>,
    {
        use std::iter::Iterator;
        self.stages = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [source_token][crate::model::OperationMetadata::source_token].
    pub fn set_source_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.source_token = v.into();
        self
    }

    /// Sets the value of [build_name][crate::model::OperationMetadata::build_name].
    pub fn set_build_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.build_name = v.into();
        self
    }

    /// Sets the value of [operation_type][crate::model::OperationMetadata::operation_type].
    pub fn set_operation_type<T: std::convert::Into<crate::model::OperationType>>(
        mut self,
        v: T,
    ) -> Self {
        self.operation_type = v.into();
        self
    }
}

impl wkt::message::Message for OperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.OperationMetadata"
    }
}

/// Extra GCF specific location information.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LocationMetadata {
    /// The Cloud Function environments this location supports.
    pub environments: std::vec::Vec<crate::model::Environment>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl LocationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [environments][crate::model::LocationMetadata::environments].
    pub fn set_environments<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Environment>,
    {
        use std::iter::Iterator;
        self.environments = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for LocationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.LocationMetadata"
    }
}

/// Each Stage of the deployment process
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Stage {
    /// Name of the Stage. This will be unique for each Stage.
    pub name: crate::model::stage::Name,

    /// Message describing the Stage
    pub message: std::string::String,

    /// Current state of the Stage
    pub state: crate::model::stage::State,

    /// Resource of the Stage
    pub resource: std::string::String,

    /// Link to the current Stage resource
    pub resource_uri: std::string::String,

    /// State messages from the current Stage.
    pub state_messages: std::vec::Vec<crate::model::StateMessage>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Stage {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Stage::name].
    pub fn set_name<T: std::convert::Into<crate::model::stage::Name>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [message][crate::model::Stage::message].
    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.message = v.into();
        self
    }

    /// Sets the value of [state][crate::model::Stage::state].
    pub fn set_state<T: std::convert::Into<crate::model::stage::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [resource][crate::model::Stage::resource].
    pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.resource = v.into();
        self
    }

    /// Sets the value of [resource_uri][crate::model::Stage::resource_uri].
    pub fn set_resource_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.resource_uri = v.into();
        self
    }

    /// Sets the value of [state_messages][crate::model::Stage::state_messages].
    pub fn set_state_messages<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::StateMessage>,
    {
        use std::iter::Iterator;
        self.state_messages = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for Stage {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.functions.v2.Stage"
    }
}

/// Defines additional types related to [Stage].
pub mod stage {
    #[allow(unused_imports)]
    use super::*;

    /// Possible names for a Stage
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Name {
        /// Not specified. Invalid name.
        Unspecified,
        /// Artifact Registry Stage
        ArtifactRegistry,
        /// Build Stage
        Build,
        /// Service Stage
        Service,
        /// Trigger Stage
        Trigger,
        /// Service Rollback Stage
        ServiceRollback,
        /// Trigger Rollback Stage
        TriggerRollback,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Name::value] or
        /// [Name::name].
        UnknownValue(name::UnknownValue),
    }

    #[doc(hidden)]
    pub mod name {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Name {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::ArtifactRegistry => std::option::Option::Some(1),
                Self::Build => std::option::Option::Some(2),
                Self::Service => std::option::Option::Some(3),
                Self::Trigger => std::option::Option::Some(4),
                Self::ServiceRollback => std::option::Option::Some(5),
                Self::TriggerRollback => std::option::Option::Some(6),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("NAME_UNSPECIFIED"),
                Self::ArtifactRegistry => std::option::Option::Some("ARTIFACT_REGISTRY"),
                Self::Build => std::option::Option::Some("BUILD"),
                Self::Service => std::option::Option::Some("SERVICE"),
                Self::Trigger => std::option::Option::Some("TRIGGER"),
                Self::ServiceRollback => std::option::Option::Some("SERVICE_ROLLBACK"),
                Self::TriggerRollback => std::option::Option::Some("TRIGGER_ROLLBACK"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Name {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Name {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Name {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::ArtifactRegistry,
                2 => Self::Build,
                3 => Self::Service,
                4 => Self::Trigger,
                5 => Self::ServiceRollback,
                6 => Self::TriggerRollback,
                _ => Self::UnknownValue(name::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Name {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "NAME_UNSPECIFIED" => Self::Unspecified,
                "ARTIFACT_REGISTRY" => Self::ArtifactRegistry,
                "BUILD" => Self::Build,
                "SERVICE" => Self::Service,
                "TRIGGER" => Self::Trigger,
                "SERVICE_ROLLBACK" => Self::ServiceRollback,
                "TRIGGER_ROLLBACK" => Self::TriggerRollback,
                _ => Self::UnknownValue(name::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Name {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::ArtifactRegistry => serializer.serialize_i32(1),
                Self::Build => serializer.serialize_i32(2),
                Self::Service => serializer.serialize_i32(3),
                Self::Trigger => serializer.serialize_i32(4),
                Self::ServiceRollback => serializer.serialize_i32(5),
                Self::TriggerRollback => serializer.serialize_i32(6),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Name {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Name>::new(
                ".google.cloud.functions.v2.Stage.Name",
            ))
        }
    }

    /// Possible states for a Stage
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Not specified. Invalid state.
        Unspecified,
        /// Stage has not started.
        NotStarted,
        /// Stage is in progress.
        InProgress,
        /// Stage has completed.
        Complete,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::NotStarted => std::option::Option::Some(1),
                Self::InProgress => std::option::Option::Some(2),
                Self::Complete => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::NotStarted => std::option::Option::Some("NOT_STARTED"),
                Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
                Self::Complete => std::option::Option::Some("COMPLETE"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::NotStarted,
                2 => Self::InProgress,
                3 => Self::Complete,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "NOT_STARTED" => Self::NotStarted,
                "IN_PROGRESS" => Self::InProgress,
                "COMPLETE" => Self::Complete,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::NotStarted => serializer.serialize_i32(1),
                Self::InProgress => serializer.serialize_i32(2),
                Self::Complete => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.functions.v2.Stage.State",
            ))
        }
    }
}

/// The type of the long running operation.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum OperationType {
    /// Unspecified
    OperationtypeUnspecified,
    /// CreateFunction
    CreateFunction,
    /// UpdateFunction
    UpdateFunction,
    /// DeleteFunction
    DeleteFunction,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [OperationType::value] or
    /// [OperationType::name].
    UnknownValue(operation_type::UnknownValue),
}

#[doc(hidden)]
pub mod operation_type {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl OperationType {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::OperationtypeUnspecified => std::option::Option::Some(0),
            Self::CreateFunction => std::option::Option::Some(1),
            Self::UpdateFunction => std::option::Option::Some(2),
            Self::DeleteFunction => std::option::Option::Some(3),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::OperationtypeUnspecified => {
                std::option::Option::Some("OPERATIONTYPE_UNSPECIFIED")
            }
            Self::CreateFunction => std::option::Option::Some("CREATE_FUNCTION"),
            Self::UpdateFunction => std::option::Option::Some("UPDATE_FUNCTION"),
            Self::DeleteFunction => std::option::Option::Some("DELETE_FUNCTION"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for OperationType {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for OperationType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for OperationType {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::OperationtypeUnspecified,
            1 => Self::CreateFunction,
            2 => Self::UpdateFunction,
            3 => Self::DeleteFunction,
            _ => Self::UnknownValue(operation_type::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for OperationType {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "OPERATIONTYPE_UNSPECIFIED" => Self::OperationtypeUnspecified,
            "CREATE_FUNCTION" => Self::CreateFunction,
            "UPDATE_FUNCTION" => Self::UpdateFunction,
            "DELETE_FUNCTION" => Self::DeleteFunction,
            _ => Self::UnknownValue(operation_type::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for OperationType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::OperationtypeUnspecified => serializer.serialize_i32(0),
            Self::CreateFunction => serializer.serialize_i32(1),
            Self::UpdateFunction => serializer.serialize_i32(2),
            Self::DeleteFunction => serializer.serialize_i32(3),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for OperationType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
            ".google.cloud.functions.v2.OperationType",
        ))
    }
}

/// The environment the function is hosted on.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Environment {
    /// Unspecified
    Unspecified,
    /// Gen 1
    Gen1,
    /// Gen 2
    Gen2,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [Environment::value] or
    /// [Environment::name].
    UnknownValue(environment::UnknownValue),
}

#[doc(hidden)]
pub mod environment {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl Environment {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Gen1 => std::option::Option::Some(1),
            Self::Gen2 => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("ENVIRONMENT_UNSPECIFIED"),
            Self::Gen1 => std::option::Option::Some("GEN_1"),
            Self::Gen2 => std::option::Option::Some("GEN_2"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for Environment {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for Environment {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for Environment {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Gen1,
            2 => Self::Gen2,
            _ => Self::UnknownValue(environment::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for Environment {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "ENVIRONMENT_UNSPECIFIED" => Self::Unspecified,
            "GEN_1" => Self::Gen1,
            "GEN_2" => Self::Gen2,
            _ => Self::UnknownValue(environment::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for Environment {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Gen1 => serializer.serialize_i32(1),
            Self::Gen2 => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for Environment {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Environment>::new(
            ".google.cloud.functions.v2.Environment",
        ))
    }
}