k8s-crds-cluster-api 1.12.5

Kubernetes CRDs for cluster-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
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium -f clusterclasses.yml --schema=derived --docs -b --derive=Default --derive=PartialEq --smart-derive-elision
// kopium version: 0.23.0

#[allow(unused_imports)]
mod prelude {
    pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
    pub use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
    pub use kube_derive::CustomResource;
    #[cfg(feature = "schemars")]
    pub use schemars::JsonSchema;
    pub use serde::{Deserialize, Serialize};
    pub use std::collections::BTreeMap;
    #[cfg(feature = "builder")]
    pub use typed_builder::TypedBuilder;
}

use self::prelude::*;

/// spec is the desired state of ClusterClass.
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
#[cfg_attr(not(feature = "schemars"), kube(schema = "disabled"))]
#[kube(
    group = "cluster.x-k8s.io",
    version = "v1beta2",
    kind = "ClusterClass",
    plural = "clusterclasses"
)]
#[kube(namespaced)]
#[kube(status = "ClusterClassStatus")]
#[kube(derive = "Default")]
#[kube(derive = "PartialEq")]
pub struct ClusterClassSpec {
    /// availabilityGates specifies additional conditions to include when evaluating Cluster Available condition.
    ///
    /// NOTE: If a Cluster is using this ClusterClass, and this Cluster defines a custom list of availabilityGates,
    /// such list overrides availabilityGates defined in this field.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "availabilityGates"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub availability_gates: Option<Vec<ClusterClassAvailabilityGates>>,
    /// controlPlane is a reference to a local struct that holds the details
    /// for provisioning the Control Plane for the Cluster.
    #[serde(rename = "controlPlane")]
    pub control_plane: ClusterClassControlPlane,
    /// infrastructure is a reference to a local struct that holds the details
    /// for provisioning the infrastructure cluster for the Cluster.
    pub infrastructure: ClusterClassInfrastructure,
    /// kubernetesVersions is the list of Kubernetes versions that can be
    /// used for clusters using this ClusterClass.
    /// The list of version must be ordered from the older to the newer version, and there should be
    /// at least one version for every minor in between the first and the last version.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "kubernetesVersions"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub kubernetes_versions: Option<Vec<String>>,
    /// patches defines the patches which are applied to customize
    /// referenced templates of a ClusterClass.
    /// Note: Patches will be applied in the order of the array.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub patches: Option<Vec<ClusterClassPatches>>,
    /// upgrade defines the upgrade configuration for clusters using this ClusterClass.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub upgrade: Option<ClusterClassUpgrade>,
    /// variables defines the variables which can be configured
    /// in the Cluster topology and are then used in patches.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub variables: Option<Vec<ClusterClassVariables>>,
    /// workers describes the worker nodes for the cluster.
    /// It is a collection of node types which can be used to create
    /// the worker nodes of the cluster.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub workers: Option<ClusterClassWorkers>,
}

/// ClusterAvailabilityGate contains the type of a Cluster condition to be used as availability gate.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassAvailabilityGates {
    /// conditionType refers to a condition with matching type in the Cluster's condition list.
    /// If the conditions doesn't exist, it will be treated as unknown.
    /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as availability gates.
    #[serde(rename = "conditionType")]
    pub condition_type: String,
    /// polarity of the conditionType specified in this availabilityGate.
    /// Valid values are Positive, Negative and omitted.
    /// When omitted, the default behaviour will be Positive.
    /// A positive polarity means that the condition should report a true status under normal conditions.
    /// A negative polarity means that the condition should report a false status under normal conditions.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub polarity: Option<ClusterClassAvailabilityGatesPolarity>,
}

/// ClusterAvailabilityGate contains the type of a Cluster condition to be used as availability gate.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterClassAvailabilityGatesPolarity {
    Positive,
    Negative,
}

/// controlPlane is a reference to a local struct that holds the details
/// for provisioning the Control Plane for the Cluster.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlane {
    /// deletion contains configuration options for Machine deletion.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub deletion: Option<ClusterClassControlPlaneDeletion>,
    /// healthCheck defines a MachineHealthCheck for this ControlPlaneClass.
    /// This field is supported if and only if the ControlPlane provider template
    /// referenced above is Machine based and supports setting replicas.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "healthCheck"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub health_check: Option<ClusterClassControlPlaneHealthCheck>,
    /// machineInfrastructure defines the metadata and infrastructure information
    /// for control plane machines.
    ///
    /// This field is supported if and only if the control plane provider template
    /// referenced above is Machine based and supports setting replicas.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "machineInfrastructure"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub machine_infrastructure: Option<ClusterClassControlPlaneMachineInfrastructure>,
    /// metadata is the metadata applied to the ControlPlane and the Machines of the ControlPlane
    /// if the ControlPlaneTemplate referenced is machine based. If not, it is applied only to the
    /// ControlPlane.
    /// At runtime this metadata is merged with the corresponding metadata from the topology.
    ///
    /// This field is supported if and only if the control plane provider template
    /// referenced is Machine based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub metadata: Option<ClusterClassControlPlaneMetadata>,
    /// naming allows changing the naming pattern used when creating the control plane provider object.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub naming: Option<ClusterClassControlPlaneNaming>,
    /// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
    ///
    /// This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready
    /// computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine.
    ///
    /// NOTE: If a Cluster defines a custom list of readinessGates for the control plane,
    /// such list overrides readinessGates defined in this field.
    /// NOTE: Specific control plane provider implementations might automatically extend the list of readinessGates;
    /// e.g. the kubeadm control provider adds ReadinessGates for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "readinessGates"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub readiness_gates: Option<Vec<ClusterClassControlPlaneReadinessGates>>,
    /// templateRef contains the reference to a provider-specific control plane template.
    #[serde(rename = "templateRef")]
    pub template_ref: ClusterClassControlPlaneTemplateRef,
}

/// deletion contains configuration options for Machine deletion.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlaneDeletion {
    /// nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine
    /// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
    /// Defaults to 10 seconds.
    /// NOTE: This value can be overridden while defining a Cluster.Topology.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeDeletionTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_deletion_timeout_seconds: Option<i32>,
    /// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node.
    /// The default value is 0, meaning that the node can be drained without any time limitations.
    /// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
    /// NOTE: This value can be overridden while defining a Cluster.Topology.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeDrainTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_drain_timeout_seconds: Option<i32>,
    /// nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes
    /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
    /// NOTE: This value can be overridden while defining a Cluster.Topology.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeVolumeDetachTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_volume_detach_timeout_seconds: Option<i32>,
}

/// healthCheck defines a MachineHealthCheck for this ControlPlaneClass.
/// This field is supported if and only if the ControlPlane provider template
/// referenced above is Machine based and supports setting replicas.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlaneHealthCheck {
    /// checks are the checks that are used to evaluate if a Machine is healthy.
    ///
    /// Independent of this configuration the MachineHealthCheck controller will always
    /// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
    /// Machines with deleted Nodes as unhealthy.
    ///
    /// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
    /// is defaulted to 10 minutes and evaluated accordingly.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub checks: Option<ClusterClassControlPlaneHealthCheckChecks>,
    /// remediation configures if and how remediations are triggered if a Machine is unhealthy.
    ///
    /// If remediation or remediation.triggerIf is not set,
    /// remediation will always be triggered for unhealthy Machines.
    ///
    /// If remediation or remediation.templateRef is not set,
    /// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
    /// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub remediation: Option<ClusterClassControlPlaneHealthCheckRemediation>,
}

/// checks are the checks that are used to evaluate if a Machine is healthy.
///
/// Independent of this configuration the MachineHealthCheck controller will always
/// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
/// Machines with deleted Nodes as unhealthy.
///
/// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
/// is defaulted to 10 minutes and evaluated accordingly.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlaneHealthCheckChecks {
    /// nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck
    /// to consider a Machine unhealthy if a corresponding Node isn't associated
    /// through a `Spec.ProviderID` field.
    ///
    /// The duration set in this field is compared to the greatest of:
    /// - Cluster's infrastructure ready condition timestamp (if and when available)
    /// - Control Plane's initialized condition timestamp (if and when available)
    /// - Machine's infrastructure ready condition timestamp (if and when available)
    /// - Machine's metadata creation timestamp
    ///
    /// Defaults to 10 minutes.
    /// If you wish to disable this feature, set the value explicitly to 0.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeStartupTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_startup_timeout_seconds: Option<i32>,
    /// unhealthyMachineConditions contains a list of the machine conditions that determine
    /// whether a machine is considered unhealthy.  The conditions are combined in a
    /// logical OR, i.e. if any of the conditions is met, the machine is unhealthy.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyMachineConditions"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_machine_conditions:
        Option<Vec<ClusterClassControlPlaneHealthCheckChecksUnhealthyMachineConditions>>,
    /// unhealthyNodeConditions contains a list of conditions that determine
    /// whether a node is considered unhealthy. The conditions are combined in a
    /// logical OR, i.e. if any of the conditions is met, the node is unhealthy.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyNodeConditions"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_node_conditions:
        Option<Vec<ClusterClassControlPlaneHealthCheckChecksUnhealthyNodeConditions>>,
}

/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
/// specified as a duration.  When the named condition has been in the given
/// status for at least the timeout value, a machine is considered unhealthy.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlaneHealthCheckChecksUnhealthyMachineConditions {
    /// status of the condition, one of True, False, Unknown.
    pub status: ClusterClassControlPlaneHealthCheckChecksUnhealthyMachineConditionsStatus,
    /// timeoutSeconds is the duration that a machine must be in a given status for,
    /// after which the machine is considered unhealthy.
    /// For example, with a value of "3600", the machine must match the status
    /// for at least 1 hour before being considered unhealthy.
    #[serde(rename = "timeoutSeconds")]
    pub timeout_seconds: i32,
    /// type of Machine condition
    #[serde(rename = "type")]
    pub r#type: String,
}

/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
/// specified as a duration.  When the named condition has been in the given
/// status for at least the timeout value, a machine is considered unhealthy.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterClassControlPlaneHealthCheckChecksUnhealthyMachineConditionsStatus {
    True,
    False,
    Unknown,
}

/// UnhealthyNodeCondition represents a Node condition type and value with a timeout
/// specified as a duration.  When the named condition has been in the given
/// status for at least the timeout value, a node is considered unhealthy.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlaneHealthCheckChecksUnhealthyNodeConditions {
    /// status of the condition, one of True, False, Unknown.
    pub status: String,
    /// timeoutSeconds is the duration that a node must be in a given status for,
    /// after which the node is considered unhealthy.
    /// For example, with a value of "3600", the node must match the status
    /// for at least 1 hour before being considered unhealthy.
    #[serde(rename = "timeoutSeconds")]
    pub timeout_seconds: i32,
    /// type of Node condition
    #[serde(rename = "type")]
    pub r#type: String,
}

/// remediation configures if and how remediations are triggered if a Machine is unhealthy.
///
/// If remediation or remediation.triggerIf is not set,
/// remediation will always be triggered for unhealthy Machines.
///
/// If remediation or remediation.templateRef is not set,
/// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
/// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlaneHealthCheckRemediation {
    /// templateRef is a reference to a remediation template
    /// provided by an infrastructure provider.
    ///
    /// This field is completely optional, when filled, the MachineHealthCheck controller
    /// creates a new object from the template referenced and hands off remediation of the machine to
    /// a controller that lives outside of Cluster API.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "templateRef"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub template_ref: Option<ClusterClassControlPlaneHealthCheckRemediationTemplateRef>,
    /// triggerIf configures if remediations are triggered.
    /// If this field is not set, remediations are always triggered.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "triggerIf")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub trigger_if: Option<ClusterClassControlPlaneHealthCheckRemediationTriggerIf>,
}

/// templateRef is a reference to a remediation template
/// provided by an infrastructure provider.
///
/// This field is completely optional, when filled, the MachineHealthCheck controller
/// creates a new object from the template referenced and hands off remediation of the machine to
/// a controller that lives outside of Cluster API.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlaneHealthCheckRemediationTemplateRef {
    /// apiVersion of the remediation template.
    /// apiVersion must be fully qualified domain name followed by / and a version.
    /// NOTE: This field must be kept in sync with the APIVersion of the remediation template.
    #[serde(rename = "apiVersion")]
    pub api_version: String,
    /// kind of the remediation template.
    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
    pub kind: String,
    /// name of the remediation template.
    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
    pub name: String,
}

/// triggerIf configures if remediations are triggered.
/// If this field is not set, remediations are always triggered.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlaneHealthCheckRemediationTriggerIf {
    /// unhealthyInRange specifies that remediations are only triggered if the number of
    /// unhealthy Machines is in the configured range.
    /// Takes precedence over unhealthyLessThanOrEqualTo.
    /// Eg. "[3-5]" - This means that remediation will be allowed only when:
    /// (a) there are at least 3 unhealthy Machines (and)
    /// (b) there are at most 5 unhealthy Machines
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyInRange"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_in_range: Option<String>,
    /// unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of
    /// unhealthy Machines is less than or equal to the configured value.
    /// unhealthyInRange takes precedence if set.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyLessThanOrEqualTo"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_less_than_or_equal_to: Option<IntOrString>,
}

/// machineInfrastructure defines the metadata and infrastructure information
/// for control plane machines.
///
/// This field is supported if and only if the control plane provider template
/// referenced above is Machine based and supports setting replicas.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlaneMachineInfrastructure {
    /// templateRef is a required reference to the template for a MachineInfrastructure of a ControlPlane.
    #[serde(rename = "templateRef")]
    pub template_ref: ClusterClassControlPlaneMachineInfrastructureTemplateRef,
}

/// templateRef is a required reference to the template for a MachineInfrastructure of a ControlPlane.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlaneMachineInfrastructureTemplateRef {
    /// apiVersion of the template.
    /// apiVersion must be fully qualified domain name followed by / and a version.
    #[serde(rename = "apiVersion")]
    pub api_version: String,
    /// kind of the template.
    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
    pub kind: String,
    /// name of the template.
    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
    pub name: String,
}

/// metadata is the metadata applied to the ControlPlane and the Machines of the ControlPlane
/// if the ControlPlaneTemplate referenced is machine based. If not, it is applied only to the
/// ControlPlane.
/// At runtime this metadata is merged with the corresponding metadata from the topology.
///
/// This field is supported if and only if the control plane provider template
/// referenced is Machine based.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlaneMetadata {
    /// annotations is an unstructured key value map stored with a resource that may be
    /// set by external tools to store and retrieve arbitrary metadata. They are not
    /// queryable and should be preserved when modifying objects.
    /// More info: <http://kubernetes.io/docs/user-guide/annotations>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub annotations: Option<BTreeMap<String, String>>,
    /// labels is a map of string keys and values that can be used to organize and categorize
    /// (scope and select) objects. May match selectors of replication controllers
    /// and services.
    /// More info: <http://kubernetes.io/docs/user-guide/labels>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub labels: Option<BTreeMap<String, String>>,
}

/// naming allows changing the naming pattern used when creating the control plane provider object.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlaneNaming {
    /// template defines the template to use for generating the name of the ControlPlane object.
    /// If not defined, it will fallback to `{{ .cluster.name }}-{{ .random }}`.
    /// If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will
    /// get concatenated with a random suffix of length 5.
    /// The templating mechanism provides the following arguments:
    /// * `.cluster.name`: The name of the cluster object.
    /// * `.random`: A random alphanumeric string, without vowels, of length 5.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub template: Option<String>,
}

/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlaneReadinessGates {
    /// conditionType refers to a condition with matching type in the Machine's condition list.
    /// If the conditions doesn't exist, it will be treated as unknown.
    /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates.
    #[serde(rename = "conditionType")]
    pub condition_type: String,
    /// polarity of the conditionType specified in this readinessGate.
    /// Valid values are Positive, Negative and omitted.
    /// When omitted, the default behaviour will be Positive.
    /// A positive polarity means that the condition should report a true status under normal conditions.
    /// A negative polarity means that the condition should report a false status under normal conditions.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub polarity: Option<ClusterClassControlPlaneReadinessGatesPolarity>,
}

/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterClassControlPlaneReadinessGatesPolarity {
    Positive,
    Negative,
}

/// templateRef contains the reference to a provider-specific control plane template.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassControlPlaneTemplateRef {
    /// apiVersion of the template.
    /// apiVersion must be fully qualified domain name followed by / and a version.
    #[serde(rename = "apiVersion")]
    pub api_version: String,
    /// kind of the template.
    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
    pub kind: String,
    /// name of the template.
    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
    pub name: String,
}

/// infrastructure is a reference to a local struct that holds the details
/// for provisioning the infrastructure cluster for the Cluster.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassInfrastructure {
    /// naming allows changing the naming pattern used when creating the infrastructure cluster object.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub naming: Option<ClusterClassInfrastructureNaming>,
    /// templateRef contains the reference to a provider-specific infrastructure cluster template.
    #[serde(rename = "templateRef")]
    pub template_ref: ClusterClassInfrastructureTemplateRef,
}

/// naming allows changing the naming pattern used when creating the infrastructure cluster object.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassInfrastructureNaming {
    /// template defines the template to use for generating the name of the Infrastructure object.
    /// If not defined, it will fallback to `{{ .cluster.name }}-{{ .random }}`.
    /// If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will
    /// get concatenated with a random suffix of length 5.
    /// The templating mechanism provides the following arguments:
    /// * `.cluster.name`: The name of the cluster object.
    /// * `.random`: A random alphanumeric string, without vowels, of length 5.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub template: Option<String>,
}

/// templateRef contains the reference to a provider-specific infrastructure cluster template.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassInfrastructureTemplateRef {
    /// apiVersion of the template.
    /// apiVersion must be fully qualified domain name followed by / and a version.
    #[serde(rename = "apiVersion")]
    pub api_version: String,
    /// kind of the template.
    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
    pub kind: String,
    /// name of the template.
    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
    pub name: String,
}

/// ClusterClassPatch defines a patch which is applied to customize the referenced templates.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassPatches {
    /// definitions define inline patches.
    /// Note: Patches will be applied in the order of the array.
    /// Note: Exactly one of Definitions or External must be set.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub definitions: Option<Vec<ClusterClassPatchesDefinitions>>,
    /// description is a human-readable description of this patch.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub description: Option<String>,
    /// enabledIf is a Go template to be used to calculate if a patch should be enabled.
    /// It can reference variables defined in .spec.variables and builtin variables.
    /// The patch will be enabled if the template evaluates to `true`, otherwise it will
    /// be disabled.
    /// If EnabledIf is not set, the patch will be enabled per default.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "enabledIf")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub enabled_if: Option<String>,
    /// external defines an external patch.
    /// Note: Exactly one of Definitions or External must be set.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub external: Option<ClusterClassPatchesExternal>,
    /// name of the patch.
    pub name: String,
}

/// PatchDefinition defines a patch which is applied to customize the referenced templates.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassPatchesDefinitions {
    /// jsonPatches defines the patches which should be applied on the templates
    /// matching the selector.
    /// Note: Patches will be applied in the order of the array.
    #[serde(rename = "jsonPatches")]
    #[cfg_attr(feature = "builder", builder(default))]
    pub json_patches: Vec<ClusterClassPatchesDefinitionsJsonPatches>,
    /// selector defines on which templates the patch should be applied.
    pub selector: ClusterClassPatchesDefinitionsSelector,
}

/// JSONPatch defines a JSON patch.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassPatchesDefinitionsJsonPatches {
    /// op defines the operation of the patch.
    /// Note: Only `add`, `replace` and `remove` are supported.
    pub op: ClusterClassPatchesDefinitionsJsonPatchesOp,
    /// path defines the path of the patch.
    /// Note: Only the spec of a template can be patched, thus the path has to start with /spec/.
    /// Note: For now the only allowed array modifications are `append` and `prepend`, i.e.:
    /// * for op: `add`: only index 0 (prepend) and - (append) are allowed
    /// * for op: `replace` or `remove`: no indexes are allowed
    pub path: String,
    /// value defines the value of the patch.
    /// Note: Either Value or ValueFrom is required for add and replace
    /// operations. Only one of them is allowed to be set at the same time.
    /// Note: We have to use apiextensionsv1.JSON instead of our JSON type,
    /// because controller-tools has a hard-coded schema for apiextensionsv1.JSON
    /// which cannot be produced by another type (unset type field).
    /// Ref: <https://github.com/kubernetes-sigs/controller-tools/blob/d0e03a142d0ecdd5491593e941ee1d6b5d91dba6/pkg/crd/known_types.go#L106-L111>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub value: Option<serde_json::Value>,
    /// valueFrom defines the value of the patch.
    /// Note: Either Value or ValueFrom is required for add and replace
    /// operations. Only one of them is allowed to be set at the same time.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "valueFrom")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub value_from: Option<ClusterClassPatchesDefinitionsJsonPatchesValueFrom>,
}

/// JSONPatch defines a JSON patch.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterClassPatchesDefinitionsJsonPatchesOp {
    #[serde(rename = "add")]
    Add,
    #[serde(rename = "replace")]
    Replace,
    #[serde(rename = "remove")]
    Remove,
}

/// valueFrom defines the value of the patch.
/// Note: Either Value or ValueFrom is required for add and replace
/// operations. Only one of them is allowed to be set at the same time.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassPatchesDefinitionsJsonPatchesValueFrom {
    /// template is the Go template to be used to calculate the value.
    /// A template can reference variables defined in .spec.variables and builtin variables.
    /// Note: The template must evaluate to a valid YAML or JSON value.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub template: Option<String>,
    /// variable is the variable to be used as value.
    /// Variable can be one of the variables defined in .spec.variables or a builtin variable.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub variable: Option<String>,
}

/// selector defines on which templates the patch should be applied.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassPatchesDefinitionsSelector {
    /// apiVersion filters templates by apiVersion.
    /// apiVersion must be fully qualified domain name followed by / and a version.
    #[serde(rename = "apiVersion")]
    pub api_version: String,
    /// kind filters templates by kind.
    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
    pub kind: String,
    /// matchResources selects templates based on where they are referenced.
    #[serde(rename = "matchResources")]
    pub match_resources: ClusterClassPatchesDefinitionsSelectorMatchResources,
}

/// matchResources selects templates based on where they are referenced.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassPatchesDefinitionsSelectorMatchResources {
    /// controlPlane selects templates referenced in .spec.ControlPlane.
    /// Note: this will match the controlPlane and also the controlPlane
    /// machineInfrastructure (depending on the kind and apiVersion).
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "controlPlane"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub control_plane: Option<bool>,
    /// infrastructureCluster selects templates referenced in .spec.infrastructure.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "infrastructureCluster"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub infrastructure_cluster: Option<bool>,
    /// machineDeploymentClass selects templates referenced in specific MachineDeploymentClasses in
    /// .spec.workers.machineDeployments.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "machineDeploymentClass"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub machine_deployment_class:
        Option<ClusterClassPatchesDefinitionsSelectorMatchResourcesMachineDeploymentClass>,
    /// machinePoolClass selects templates referenced in specific MachinePoolClasses in
    /// .spec.workers.machinePools.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "machinePoolClass"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub machine_pool_class:
        Option<ClusterClassPatchesDefinitionsSelectorMatchResourcesMachinePoolClass>,
}

/// machineDeploymentClass selects templates referenced in specific MachineDeploymentClasses in
/// .spec.workers.machineDeployments.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassPatchesDefinitionsSelectorMatchResourcesMachineDeploymentClass {
    /// names selects templates by class names.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub names: Option<Vec<String>>,
}

/// machinePoolClass selects templates referenced in specific MachinePoolClasses in
/// .spec.workers.machinePools.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassPatchesDefinitionsSelectorMatchResourcesMachinePoolClass {
    /// names selects templates by class names.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub names: Option<Vec<String>>,
}

/// external defines an external patch.
/// Note: Exactly one of Definitions or External must be set.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassPatchesExternal {
    /// discoverVariablesExtension references an extension which is called to discover variables.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "discoverVariablesExtension"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub discover_variables_extension: Option<String>,
    /// generatePatchesExtension references an extension which is called to generate patches.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "generatePatchesExtension"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub generate_patches_extension: Option<String>,
    /// settings defines key value pairs to be passed to the extensions.
    /// Values defined here take precedence over the values defined in the
    /// corresponding ExtensionConfig.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub settings: Option<BTreeMap<String, String>>,
    /// validateTopologyExtension references an extension which is called to validate the topology.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "validateTopologyExtension"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub validate_topology_extension: Option<String>,
}

/// upgrade defines the upgrade configuration for clusters using this ClusterClass.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassUpgrade {
    /// external defines external runtime extensions for upgrade operations.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub external: Option<ClusterClassUpgradeExternal>,
}

/// external defines external runtime extensions for upgrade operations.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassUpgradeExternal {
    /// generateUpgradePlanExtension references an extension which is called to generate upgrade plan.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "generateUpgradePlanExtension"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub generate_upgrade_plan_extension: Option<String>,
}

/// ClusterClassVariable defines a variable which can
/// be configured in the Cluster topology and used in patches.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassVariables {
    /// deprecatedV1Beta1Metadata is the metadata of a variable.
    /// It can be used to add additional data for higher level tools to
    /// a ClusterClassVariable.
    ///
    /// Deprecated: This field is deprecated and will be removed when support for v1beta1 will be dropped. Please use XMetadata in JSONSchemaProps instead.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "deprecatedV1Beta1Metadata"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub deprecated_v1_beta1_metadata: Option<ClusterClassVariablesDeprecatedV1Beta1Metadata>,
    /// name of the variable.
    pub name: String,
    /// required specifies if the variable is required.
    /// Note: this applies to the variable as a whole and thus the
    /// top-level object defined in the schema. If nested fields are
    /// required, this will be specified inside the schema.
    pub required: bool,
    /// schema defines the schema of the variable.
    pub schema: ClusterClassVariablesSchema,
}

/// deprecatedV1Beta1Metadata is the metadata of a variable.
/// It can be used to add additional data for higher level tools to
/// a ClusterClassVariable.
///
/// Deprecated: This field is deprecated and will be removed when support for v1beta1 will be dropped. Please use XMetadata in JSONSchemaProps instead.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassVariablesDeprecatedV1Beta1Metadata {
    /// annotations is an unstructured key value map that can be used to store and
    /// retrieve arbitrary metadata.
    /// They are not queryable.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub annotations: Option<BTreeMap<String, String>>,
    /// labels is a map of string keys and values that can be used to organize and categorize
    /// (scope and select) variables.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub labels: Option<BTreeMap<String, String>>,
}

/// schema defines the schema of the variable.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassVariablesSchema {
    /// openAPIV3Schema defines the schema of a variable via OpenAPI v3
    /// schema. The schema is a subset of the schema used in
    /// Kubernetes CRDs.
    #[serde(rename = "openAPIV3Schema")]
    pub open_apiv3_schema: ClusterClassVariablesSchemaOpenApiv3Schema,
}

/// openAPIV3Schema defines the schema of a variable via OpenAPI v3
/// schema. The schema is a subset of the schema used in
/// Kubernetes CRDs.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassVariablesSchemaOpenApiv3Schema {
    /// additionalProperties specifies the schema of values in a map (keys are always strings).
    /// NOTE: Can only be set if type is object.
    /// NOTE: AdditionalProperties is mutually exclusive with Properties.
    /// NOTE: This field uses PreserveUnknownFields and Schemaless,
    /// because recursive validation is not possible.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "additionalProperties"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub additional_properties: Option<serde_json::Value>,
    /// allOf specifies that the variable must validate against all of the subschemas in the array.
    /// NOTE: This field uses PreserveUnknownFields and Schemaless,
    /// because recursive validation is not possible.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allOf")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub all_of: Option<serde_json::Value>,
    /// anyOf specifies that the variable must validate against one or more of the subschemas in the array.
    /// NOTE: This field uses PreserveUnknownFields and Schemaless,
    /// because recursive validation is not possible.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "anyOf")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub any_of: Option<serde_json::Value>,
    /// default is the default value of the variable.
    /// NOTE: Can be set for all types.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub default: Option<serde_json::Value>,
    /// description is a human-readable description of this variable.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub description: Option<String>,
    /// enum is the list of valid values of the variable.
    /// NOTE: Can be set for all types.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "enum")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub r#enum: Option<Vec<serde_json::Value>>,
    /// example is an example for this variable.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub example: Option<serde_json::Value>,
    /// exclusiveMaximum specifies if the Maximum is exclusive.
    /// NOTE: Can only be set if type is integer or number.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "exclusiveMaximum"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub exclusive_maximum: Option<bool>,
    /// exclusiveMinimum specifies if the Minimum is exclusive.
    /// NOTE: Can only be set if type is integer or number.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "exclusiveMinimum"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub exclusive_minimum: Option<bool>,
    /// format is an OpenAPI v3 format string. Unknown formats are ignored.
    /// For a list of supported formats please see: (of the k8s.io/apiextensions-apiserver version we're currently using)
    /// <https://github.com/kubernetes/apiextensions-apiserver/blob/master/pkg/apiserver/validation/formats.go>
    /// NOTE: Can only be set if type is string.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub format: Option<String>,
    /// items specifies fields of an array.
    /// NOTE: Can only be set if type is array.
    /// NOTE: This field uses PreserveUnknownFields and Schemaless,
    /// because recursive validation is not possible.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub items: Option<serde_json::Value>,
    /// maxItems is the max length of an array variable.
    /// NOTE: Can only be set if type is array.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxItems")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub max_items: Option<i64>,
    /// maxLength is the max length of a string variable.
    /// NOTE: Can only be set if type is string.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxLength")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub max_length: Option<i64>,
    /// maxProperties is the maximum amount of entries in a map or properties in an object.
    /// NOTE: Can only be set if type is object.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "maxProperties"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub max_properties: Option<i64>,
    /// maximum is the maximum of an integer or number variable.
    /// If ExclusiveMaximum is false, the variable is valid if it is lower than, or equal to, the value of Maximum.
    /// If ExclusiveMaximum is true, the variable is valid if it is strictly lower than the value of Maximum.
    /// NOTE: Can only be set if type is integer or number.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub maximum: Option<i64>,
    /// minItems is the min length of an array variable.
    /// NOTE: Can only be set if type is array.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "minItems")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub min_items: Option<i64>,
    /// minLength is the min length of a string variable.
    /// NOTE: Can only be set if type is string.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "minLength")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub min_length: Option<i64>,
    /// minProperties is the minimum amount of entries in a map or properties in an object.
    /// NOTE: Can only be set if type is object.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "minProperties"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub min_properties: Option<i64>,
    /// minimum is the minimum of an integer or number variable.
    /// If ExclusiveMinimum is false, the variable is valid if it is greater than, or equal to, the value of Minimum.
    /// If ExclusiveMinimum is true, the variable is valid if it is strictly greater than the value of Minimum.
    /// NOTE: Can only be set if type is integer or number.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub minimum: Option<i64>,
    /// not specifies that the variable must not validate against the subschema.
    /// NOTE: This field uses PreserveUnknownFields and Schemaless,
    /// because recursive validation is not possible.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub not: Option<serde_json::Value>,
    /// oneOf specifies that the variable must validate against exactly one of the subschemas in the array.
    /// NOTE: This field uses PreserveUnknownFields and Schemaless,
    /// because recursive validation is not possible.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "oneOf")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub one_of: Option<serde_json::Value>,
    /// pattern is the regex which a string variable must match.
    /// NOTE: Can only be set if type is string.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub pattern: Option<String>,
    /// properties specifies fields of an object.
    /// NOTE: Can only be set if type is object.
    /// NOTE: Properties is mutually exclusive with AdditionalProperties.
    /// NOTE: This field uses PreserveUnknownFields and Schemaless,
    /// because recursive validation is not possible.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub properties: Option<serde_json::Value>,
    /// required specifies which fields of an object are required.
    /// NOTE: Can only be set if type is object.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub required: Option<Vec<String>>,
    /// type is the type of the variable.
    /// Valid values are: object, array, string, integer, number or boolean.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub r#type: Option<ClusterClassVariablesSchemaOpenApiv3SchemaType>,
    /// uniqueItems specifies if items in an array must be unique.
    /// NOTE: Can only be set if type is array.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "uniqueItems"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unique_items: Option<bool>,
    /// x-kubernetes-int-or-string specifies that this value is
    /// either an integer or a string. If this is true, an empty
    /// type is allowed and type as child of anyOf is permitted
    /// if following one of the following patterns:
    ///
    /// 1) anyOf:
    ///    - type: integer
    ///    - type: string
    /// 2) allOf:
    ///    - anyOf:
    ///      - type: integer
    ///      - type: string
    ///    - ... zero or more
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "x-kubernetes-int-or-string"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub x_kubernetes_int_or_string: Option<bool>,
    /// x-kubernetes-preserve-unknown-fields allows setting fields in a variable object
    /// which are not defined in the variable schema. This affects fields recursively,
    /// except if nested properties or additionalProperties are specified in the schema.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "x-kubernetes-preserve-unknown-fields"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub x_kubernetes_preserve_unknown_fields: Option<bool>,
    /// x-kubernetes-validations describes a list of validation rules written in the CEL expression language.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "x-kubernetes-validations"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub x_kubernetes_validations:
        Option<Vec<ClusterClassVariablesSchemaOpenApiv3SchemaXKubernetesValidations>>,
    /// x-metadata is the metadata of a variable or a nested field within a variable.
    /// It can be used to add additional data for higher level tools.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "x-metadata"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub x_metadata: Option<ClusterClassVariablesSchemaOpenApiv3SchemaXMetadata>,
}

/// openAPIV3Schema defines the schema of a variable via OpenAPI v3
/// schema. The schema is a subset of the schema used in
/// Kubernetes CRDs.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterClassVariablesSchemaOpenApiv3SchemaType {
    #[serde(rename = "object")]
    Object,
    #[serde(rename = "array")]
    Array,
    #[serde(rename = "string")]
    String,
    #[serde(rename = "integer")]
    Integer,
    #[serde(rename = "number")]
    Number,
    #[serde(rename = "boolean")]
    Boolean,
}

/// ValidationRule describes a validation rule written in the CEL expression language.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassVariablesSchemaOpenApiv3SchemaXKubernetesValidations {
    /// fieldPath represents the field path returned when the validation fails.
    /// It must be a relative JSON path (i.e. with array notation) scoped to the location of this x-kubernetes-validations extension in the schema and refer to an existing field.
    /// e.g. when validation checks if a specific attribute `foo` under a map `testMap`, the fieldPath could be set to `.testMap.foo`
    /// If the validation checks two lists must have unique attributes, the fieldPath could be set to either of the list: e.g. `.testList`
    /// It does not support list numeric index.
    /// It supports child operation to refer to an existing field currently. Refer to [JSONPath support in Kubernetes](<https://kubernetes.io/docs/reference/kubectl/jsonpath/)> for more info.
    /// Numeric index of array is not supported.
    /// For field name which contains special characters, use `['specialName']` to refer the field name.
    /// e.g. for attribute `foo.34$` appears in a list `testList`, the fieldPath could be set to `.testList['foo.34$']`
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "fieldPath")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub field_path: Option<String>,
    /// message represents the message displayed when validation fails. The message is required if the Rule contains
    /// line breaks. The message must not contain line breaks.
    /// If unset, the message is "failed rule: {Rule}".
    /// e.g. "must be a URL with the host matching spec.host"
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub message: Option<String>,
    /// messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails.
    /// Since messageExpression is used as a failure message, it must evaluate to a string.
    /// If both message and messageExpression are present on a rule, then messageExpression will be used if validation
    /// fails. If messageExpression results in a runtime error, the validation failure message is produced
    /// as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string
    /// that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset.
    /// messageExpression has access to all the same variables as the rule; the only difference is the return type.
    /// Example:
    /// "x must be less than max ("+string(self.max)+")"
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "messageExpression"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub message_expression: Option<String>,
    /// reason provides a machine-readable validation failure reason that is returned to the caller when a request fails this validation rule.
    /// The currently supported reasons are: "FieldValueInvalid", "FieldValueForbidden", "FieldValueRequired", "FieldValueDuplicate".
    /// If not set, default to use "FieldValueInvalid".
    /// All future added reasons must be accepted by clients when reading this value and unknown reasons should be treated as FieldValueInvalid.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub reason: Option<ClusterClassVariablesSchemaOpenApiv3SchemaXKubernetesValidationsReason>,
    /// rule represents the expression which will be evaluated by CEL.
    /// ref: <https://github.com/google/cel-spec>
    /// The Rule is scoped to the location of the x-kubernetes-validations extension in the schema.
    /// The `self` variable in the CEL expression is bound to the scoped value.
    /// If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable
    /// via `self.field` and field presence can be checked via `has(self.field)`.
    /// If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map
    /// are accessible via `self[mapKey]`, map containment can be checked via `mapKey in self` and all entries of the map
    /// are accessible via CEL macros and functions such as `self.all(...)`.
    /// If the Rule is scoped to an array, the elements of the array are accessible via `self[i]` and also by macros and
    /// functions.
    /// If the Rule is scoped to a scalar, `self` is bound to the scalar value.
    /// Examples:
    /// - Rule scoped to a map of objects: {"rule": "self.components['Widget'].priority < 10"}
    /// - Rule scoped to a list of integers: {"rule": "self.values.all(value, value >= 0 && value < 100)"}
    /// - Rule scoped to a string value: {"rule": "self.startsWith('kube')"}
    ///
    /// Unknown data preserved in custom resources via x-kubernetes-preserve-unknown-fields is not accessible in CEL
    /// expressions. This includes:
    /// - Unknown field values that are preserved by object schemas with x-kubernetes-preserve-unknown-fields.
    /// - Object properties where the property schema is of an "unknown type". An "unknown type" is recursively defined as:
    ///   - A schema with no type and x-kubernetes-preserve-unknown-fields set to true
    ///   - An array where the items schema is of an "unknown type"
    ///   - An object where the additionalProperties schema is of an "unknown type"
    ///
    /// Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible.
    /// Accessible property names are escaped according to the following rules when accessed in the expression:
    /// - '__' escapes to '__underscores__'
    /// - '.' escapes to '__dot__'
    /// - '-' escapes to '__dash__'
    /// - '/' escapes to '__slash__'
    /// - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:
    /// 	  "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if",
    /// 	  "import", "let", "loop", "package", "namespace", "return".
    /// Examples:
    ///   - Rule accessing a property named "namespace": {"rule": "self.__namespace__ > 0"}
    ///   - Rule accessing a property named "x-prop": {"rule": "self.x__dash__prop > 0"}
    ///   - Rule accessing a property named "redact__d": {"rule": "self.redact__underscores__d > 0"}
    ///
    /// If `rule` makes use of the `oldSelf` variable it is implicitly a
    /// `transition rule`.
    ///
    /// By default, the `oldSelf` variable is the same type as `self`.
    ///
    /// Transition rules by default are applied only on UPDATE requests and are
    /// skipped if an old value could not be found.
    pub rule: String,
}

/// ValidationRule describes a validation rule written in the CEL expression language.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterClassVariablesSchemaOpenApiv3SchemaXKubernetesValidationsReason {
    FieldValueInvalid,
    FieldValueForbidden,
    FieldValueRequired,
    FieldValueDuplicate,
}

/// x-metadata is the metadata of a variable or a nested field within a variable.
/// It can be used to add additional data for higher level tools.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassVariablesSchemaOpenApiv3SchemaXMetadata {
    /// annotations is an unstructured key value map that can be used to store and
    /// retrieve arbitrary metadata.
    /// They are not queryable.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub annotations: Option<BTreeMap<String, String>>,
    /// labels is a map of string keys and values that can be used to organize and categorize
    /// (scope and select) variables.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub labels: Option<BTreeMap<String, String>>,
}

/// workers describes the worker nodes for the cluster.
/// It is a collection of node types which can be used to create
/// the worker nodes of the cluster.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkers {
    /// machineDeployments is a list of machine deployment classes that can be used to create
    /// a set of worker nodes.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "machineDeployments"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub machine_deployments: Option<Vec<ClusterClassWorkersMachineDeployments>>,
    /// machinePools is a list of machine pool classes that can be used to create
    /// a set of worker nodes.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "machinePools"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub machine_pools: Option<Vec<ClusterClassWorkersMachinePools>>,
}

/// MachineDeploymentClass serves as a template to define a set of worker nodes of the cluster
/// provisioned using the `ClusterClass`.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeployments {
    /// bootstrap contains the bootstrap template reference to be used
    /// for the creation of worker Machines.
    pub bootstrap: ClusterClassWorkersMachineDeploymentsBootstrap,
    /// class denotes a type of worker node present in the cluster,
    /// this name MUST be unique within a ClusterClass and can be referenced
    /// in the Cluster to create a managed MachineDeployment.
    pub class: String,
    /// deletion contains configuration options for Machine deletion.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub deletion: Option<ClusterClassWorkersMachineDeploymentsDeletion>,
    /// failureDomain is the failure domain the machines will be created in.
    /// Must match the name of a FailureDomain from the Cluster status.
    /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "failureDomain"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub failure_domain: Option<String>,
    /// healthCheck defines a MachineHealthCheck for this MachineDeploymentClass.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "healthCheck"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub health_check: Option<ClusterClassWorkersMachineDeploymentsHealthCheck>,
    /// infrastructure contains the infrastructure template reference to be used
    /// for the creation of worker Machines.
    pub infrastructure: ClusterClassWorkersMachineDeploymentsInfrastructure,
    /// metadata is the metadata applied to the MachineDeployment and the machines of the MachineDeployment.
    /// At runtime this metadata is merged with the corresponding metadata from the topology.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub metadata: Option<ClusterClassWorkersMachineDeploymentsMetadata>,
    /// minReadySeconds is the minimum number of seconds for which a newly created machine should
    /// be ready.
    /// Defaults to 0 (machine will be considered available as soon as it
    /// is ready)
    /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "minReadySeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub min_ready_seconds: Option<i32>,
    /// naming allows changing the naming pattern used when creating the MachineDeployment.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub naming: Option<ClusterClassWorkersMachineDeploymentsNaming>,
    /// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
    ///
    /// This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready
    /// computation a condition, managed by an external controllers, reporting the status of special software/hardware installed on the Machine.
    ///
    /// NOTE: If a Cluster defines a custom list of readinessGates for a MachineDeployment using this MachineDeploymentClass,
    /// such list overrides readinessGates defined in this field.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "readinessGates"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub readiness_gates: Option<Vec<ClusterClassWorkersMachineDeploymentsReadinessGates>>,
    /// rollout allows you to configure the behaviour of rolling updates to the MachineDeployment Machines.
    /// It allows you to define the strategy used during rolling replacements.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub rollout: Option<ClusterClassWorkersMachineDeploymentsRollout>,
}

/// bootstrap contains the bootstrap template reference to be used
/// for the creation of worker Machines.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsBootstrap {
    /// templateRef is a required reference to the BootstrapTemplate for a MachineDeployment.
    #[serde(rename = "templateRef")]
    pub template_ref: ClusterClassWorkersMachineDeploymentsBootstrapTemplateRef,
}

/// templateRef is a required reference to the BootstrapTemplate for a MachineDeployment.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsBootstrapTemplateRef {
    /// apiVersion of the template.
    /// apiVersion must be fully qualified domain name followed by / and a version.
    #[serde(rename = "apiVersion")]
    pub api_version: String,
    /// kind of the template.
    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
    pub kind: String,
    /// name of the template.
    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
    pub name: String,
}

/// deletion contains configuration options for Machine deletion.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsDeletion {
    /// nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine
    /// hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely.
    /// Defaults to 10 seconds.
    /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeDeletionTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_deletion_timeout_seconds: Option<i32>,
    /// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node.
    /// The default value is 0, meaning that the node can be drained without any time limitations.
    /// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
    /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeDrainTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_drain_timeout_seconds: Option<i32>,
    /// nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes
    /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
    /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeVolumeDetachTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_volume_detach_timeout_seconds: Option<i32>,
    /// order defines the order in which Machines are deleted when downscaling.
    /// Defaults to "Random".  Valid values are "Random, "Newest", "Oldest"
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub order: Option<ClusterClassWorkersMachineDeploymentsDeletionOrder>,
}

/// deletion contains configuration options for Machine deletion.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterClassWorkersMachineDeploymentsDeletionOrder {
    Random,
    Newest,
    Oldest,
}

/// healthCheck defines a MachineHealthCheck for this MachineDeploymentClass.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsHealthCheck {
    /// checks are the checks that are used to evaluate if a Machine is healthy.
    ///
    /// Independent of this configuration the MachineHealthCheck controller will always
    /// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
    /// Machines with deleted Nodes as unhealthy.
    ///
    /// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
    /// is defaulted to 10 minutes and evaluated accordingly.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub checks: Option<ClusterClassWorkersMachineDeploymentsHealthCheckChecks>,
    /// remediation configures if and how remediations are triggered if a Machine is unhealthy.
    ///
    /// If remediation or remediation.triggerIf is not set,
    /// remediation will always be triggered for unhealthy Machines.
    ///
    /// If remediation or remediation.templateRef is not set,
    /// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
    /// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub remediation: Option<ClusterClassWorkersMachineDeploymentsHealthCheckRemediation>,
}

/// checks are the checks that are used to evaluate if a Machine is healthy.
///
/// Independent of this configuration the MachineHealthCheck controller will always
/// flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and
/// Machines with deleted Nodes as unhealthy.
///
/// Furthermore, if checks.nodeStartupTimeoutSeconds is not set it
/// is defaulted to 10 minutes and evaluated accordingly.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsHealthCheckChecks {
    /// nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck
    /// to consider a Machine unhealthy if a corresponding Node isn't associated
    /// through a `Spec.ProviderID` field.
    ///
    /// The duration set in this field is compared to the greatest of:
    /// - Cluster's infrastructure ready condition timestamp (if and when available)
    /// - Control Plane's initialized condition timestamp (if and when available)
    /// - Machine's infrastructure ready condition timestamp (if and when available)
    /// - Machine's metadata creation timestamp
    ///
    /// Defaults to 10 minutes.
    /// If you wish to disable this feature, set the value explicitly to 0.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeStartupTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_startup_timeout_seconds: Option<i32>,
    /// unhealthyMachineConditions contains a list of the machine conditions that determine
    /// whether a machine is considered unhealthy.  The conditions are combined in a
    /// logical OR, i.e. if any of the conditions is met, the machine is unhealthy.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyMachineConditions"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_machine_conditions: Option<
        Vec<ClusterClassWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditions>,
    >,
    /// unhealthyNodeConditions contains a list of conditions that determine
    /// whether a node is considered unhealthy. The conditions are combined in a
    /// logical OR, i.e. if any of the conditions is met, the node is unhealthy.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyNodeConditions"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_node_conditions:
        Option<Vec<ClusterClassWorkersMachineDeploymentsHealthCheckChecksUnhealthyNodeConditions>>,
}

/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
/// specified as a duration.  When the named condition has been in the given
/// status for at least the timeout value, a machine is considered unhealthy.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditions {
    /// status of the condition, one of True, False, Unknown.
    pub status:
        ClusterClassWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditionsStatus,
    /// timeoutSeconds is the duration that a machine must be in a given status for,
    /// after which the machine is considered unhealthy.
    /// For example, with a value of "3600", the machine must match the status
    /// for at least 1 hour before being considered unhealthy.
    #[serde(rename = "timeoutSeconds")]
    pub timeout_seconds: i32,
    /// type of Machine condition
    #[serde(rename = "type")]
    pub r#type: String,
}

/// UnhealthyMachineCondition represents a Machine condition type and value with a timeout
/// specified as a duration.  When the named condition has been in the given
/// status for at least the timeout value, a machine is considered unhealthy.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterClassWorkersMachineDeploymentsHealthCheckChecksUnhealthyMachineConditionsStatus {
    True,
    False,
    Unknown,
}

/// UnhealthyNodeCondition represents a Node condition type and value with a timeout
/// specified as a duration.  When the named condition has been in the given
/// status for at least the timeout value, a node is considered unhealthy.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsHealthCheckChecksUnhealthyNodeConditions {
    /// status of the condition, one of True, False, Unknown.
    pub status: String,
    /// timeoutSeconds is the duration that a node must be in a given status for,
    /// after which the node is considered unhealthy.
    /// For example, with a value of "3600", the node must match the status
    /// for at least 1 hour before being considered unhealthy.
    #[serde(rename = "timeoutSeconds")]
    pub timeout_seconds: i32,
    /// type of Node condition
    #[serde(rename = "type")]
    pub r#type: String,
}

/// remediation configures if and how remediations are triggered if a Machine is unhealthy.
///
/// If remediation or remediation.triggerIf is not set,
/// remediation will always be triggered for unhealthy Machines.
///
/// If remediation or remediation.templateRef is not set,
/// the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via
/// the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsHealthCheckRemediation {
    /// maxInFlight determines how many in flight remediations should happen at the same time.
    ///
    /// Remediation only happens on the MachineSet with the most current revision, while
    /// older MachineSets (usually present during rollout operations) aren't allowed to remediate.
    ///
    /// Note: In general (independent of remediations), unhealthy machines are always
    /// prioritized during scale down operations over healthy ones.
    ///
    /// MaxInFlight can be set to a fixed number or a percentage.
    /// Example: when this is set to 20%, the MachineSet controller deletes at most 20% of
    /// the desired replicas.
    ///
    /// If not set, remediation is limited to all machines (bounded by replicas)
    /// under the active MachineSet's management.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "maxInFlight"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub max_in_flight: Option<IntOrString>,
    /// templateRef is a reference to a remediation template
    /// provided by an infrastructure provider.
    ///
    /// This field is completely optional, when filled, the MachineHealthCheck controller
    /// creates a new object from the template referenced and hands off remediation of the machine to
    /// a controller that lives outside of Cluster API.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "templateRef"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub template_ref:
        Option<ClusterClassWorkersMachineDeploymentsHealthCheckRemediationTemplateRef>,
    /// triggerIf configures if remediations are triggered.
    /// If this field is not set, remediations are always triggered.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "triggerIf")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub trigger_if: Option<ClusterClassWorkersMachineDeploymentsHealthCheckRemediationTriggerIf>,
}

/// templateRef is a reference to a remediation template
/// provided by an infrastructure provider.
///
/// This field is completely optional, when filled, the MachineHealthCheck controller
/// creates a new object from the template referenced and hands off remediation of the machine to
/// a controller that lives outside of Cluster API.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsHealthCheckRemediationTemplateRef {
    /// apiVersion of the remediation template.
    /// apiVersion must be fully qualified domain name followed by / and a version.
    /// NOTE: This field must be kept in sync with the APIVersion of the remediation template.
    #[serde(rename = "apiVersion")]
    pub api_version: String,
    /// kind of the remediation template.
    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
    pub kind: String,
    /// name of the remediation template.
    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
    pub name: String,
}

/// triggerIf configures if remediations are triggered.
/// If this field is not set, remediations are always triggered.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsHealthCheckRemediationTriggerIf {
    /// unhealthyInRange specifies that remediations are only triggered if the number of
    /// unhealthy Machines is in the configured range.
    /// Takes precedence over unhealthyLessThanOrEqualTo.
    /// Eg. "[3-5]" - This means that remediation will be allowed only when:
    /// (a) there are at least 3 unhealthy Machines (and)
    /// (b) there are at most 5 unhealthy Machines
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyInRange"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_in_range: Option<String>,
    /// unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of
    /// unhealthy Machines is less than or equal to the configured value.
    /// unhealthyInRange takes precedence if set.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "unhealthyLessThanOrEqualTo"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unhealthy_less_than_or_equal_to: Option<IntOrString>,
}

/// infrastructure contains the infrastructure template reference to be used
/// for the creation of worker Machines.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsInfrastructure {
    /// templateRef is a required reference to the InfrastructureTemplate for a MachineDeployment.
    #[serde(rename = "templateRef")]
    pub template_ref: ClusterClassWorkersMachineDeploymentsInfrastructureTemplateRef,
}

/// templateRef is a required reference to the InfrastructureTemplate for a MachineDeployment.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsInfrastructureTemplateRef {
    /// apiVersion of the template.
    /// apiVersion must be fully qualified domain name followed by / and a version.
    #[serde(rename = "apiVersion")]
    pub api_version: String,
    /// kind of the template.
    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
    pub kind: String,
    /// name of the template.
    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
    pub name: String,
}

/// metadata is the metadata applied to the MachineDeployment and the machines of the MachineDeployment.
/// At runtime this metadata is merged with the corresponding metadata from the topology.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsMetadata {
    /// annotations is an unstructured key value map stored with a resource that may be
    /// set by external tools to store and retrieve arbitrary metadata. They are not
    /// queryable and should be preserved when modifying objects.
    /// More info: <http://kubernetes.io/docs/user-guide/annotations>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub annotations: Option<BTreeMap<String, String>>,
    /// labels is a map of string keys and values that can be used to organize and categorize
    /// (scope and select) objects. May match selectors of replication controllers
    /// and services.
    /// More info: <http://kubernetes.io/docs/user-guide/labels>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub labels: Option<BTreeMap<String, String>>,
}

/// naming allows changing the naming pattern used when creating the MachineDeployment.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsNaming {
    /// template defines the template to use for generating the name of the MachineDeployment object.
    /// If not defined, it will fallback to `{{ .cluster.name }}-{{ .machineDeployment.topologyName }}-{{ .random }}`.
    /// If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will
    /// get concatenated with a random suffix of length 5.
    /// The templating mechanism provides the following arguments:
    /// * `.cluster.name`: The name of the cluster object.
    /// * `.random`: A random alphanumeric string, without vowels, of length 5.
    /// * `.machineDeployment.topologyName`: The name of the MachineDeployment topology (Cluster.spec.topology.workers.machineDeployments[].name).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub template: Option<String>,
}

/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsReadinessGates {
    /// conditionType refers to a condition with matching type in the Machine's condition list.
    /// If the conditions doesn't exist, it will be treated as unknown.
    /// Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates.
    #[serde(rename = "conditionType")]
    pub condition_type: String,
    /// polarity of the conditionType specified in this readinessGate.
    /// Valid values are Positive, Negative and omitted.
    /// When omitted, the default behaviour will be Positive.
    /// A positive polarity means that the condition should report a true status under normal conditions.
    /// A negative polarity means that the condition should report a false status under normal conditions.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub polarity: Option<ClusterClassWorkersMachineDeploymentsReadinessGatesPolarity>,
}

/// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterClassWorkersMachineDeploymentsReadinessGatesPolarity {
    Positive,
    Negative,
}

/// rollout allows you to configure the behaviour of rolling updates to the MachineDeployment Machines.
/// It allows you to define the strategy used during rolling replacements.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsRollout {
    /// strategy specifies how to roll out control plane Machines.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub strategy: Option<ClusterClassWorkersMachineDeploymentsRolloutStrategy>,
}

/// strategy specifies how to roll out control plane Machines.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsRolloutStrategy {
    /// rollingUpdate is the rolling update config params. Present only if
    /// type = RollingUpdate.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "rollingUpdate"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub rolling_update: Option<ClusterClassWorkersMachineDeploymentsRolloutStrategyRollingUpdate>,
    /// type of rollout. Allowed values are RollingUpdate and OnDelete.
    /// Default is RollingUpdate.
    #[serde(rename = "type")]
    pub r#type: ClusterClassWorkersMachineDeploymentsRolloutStrategyType,
}

/// rollingUpdate is the rolling update config params. Present only if
/// type = RollingUpdate.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachineDeploymentsRolloutStrategyRollingUpdate {
    /// maxSurge is the maximum number of machines that can be scheduled above the
    /// desired number of machines.
    /// Value can be an absolute number (ex: 5) or a percentage of
    /// desired machines (ex: 10%).
    /// This can not be 0 if MaxUnavailable is 0.
    /// Absolute number is calculated from percentage by rounding up.
    /// Defaults to 1.
    /// Example: when this is set to 30%, the new MachineSet can be scaled
    /// up immediately when the rolling update starts, such that the total
    /// number of old and new machines do not exceed 130% of desired
    /// machines. Once old machines have been killed, new MachineSet can
    /// be scaled up further, ensuring that total number of machines running
    /// at any time during the update is at most 130% of desired machines.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxSurge")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub max_surge: Option<IntOrString>,
    /// maxUnavailable is the maximum number of machines that can be unavailable during the update.
    /// Value can be an absolute number (ex: 5) or a percentage of desired
    /// machines (ex: 10%).
    /// Absolute number is calculated from percentage by rounding down.
    /// This can not be 0 if MaxSurge is 0.
    /// Defaults to 0.
    /// Example: when this is set to 30%, the old MachineSet can be scaled
    /// down to 70% of desired machines immediately when the rolling update
    /// starts. Once new machines are ready, old MachineSet can be scaled
    /// down further, followed by scaling up the new MachineSet, ensuring
    /// that the total number of machines available at all times
    /// during the update is at least 70% of desired machines.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "maxUnavailable"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub max_unavailable: Option<IntOrString>,
}

/// strategy specifies how to roll out control plane Machines.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterClassWorkersMachineDeploymentsRolloutStrategyType {
    RollingUpdate,
    OnDelete,
}

/// MachinePoolClass serves as a template to define a pool of worker nodes of the cluster
/// provisioned using `ClusterClass`.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachinePools {
    /// bootstrap contains the bootstrap template reference to be used
    /// for the creation of the Machines in the MachinePool.
    pub bootstrap: ClusterClassWorkersMachinePoolsBootstrap,
    /// class denotes a type of machine pool present in the cluster,
    /// this name MUST be unique within a ClusterClass and can be referenced
    /// in the Cluster to create a managed MachinePool.
    pub class: String,
    /// deletion contains configuration options for Machine deletion.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub deletion: Option<ClusterClassWorkersMachinePoolsDeletion>,
    /// failureDomains is the list of failure domains the MachinePool should be attached to.
    /// Must match a key in the FailureDomains map stored on the cluster object.
    /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "failureDomains"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub failure_domains: Option<Vec<String>>,
    /// infrastructure contains the infrastructure template reference to be used
    /// for the creation of the MachinePool.
    pub infrastructure: ClusterClassWorkersMachinePoolsInfrastructure,
    /// metadata is the metadata applied to the MachinePool.
    /// At runtime this metadata is merged with the corresponding metadata from the topology.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub metadata: Option<ClusterClassWorkersMachinePoolsMetadata>,
    /// minReadySeconds is the minimum number of seconds for which a newly created machine pool should
    /// be ready.
    /// Defaults to 0 (machine will be considered available as soon as it
    /// is ready)
    /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "minReadySeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub min_ready_seconds: Option<i32>,
    /// naming allows changing the naming pattern used when creating the MachinePool.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub naming: Option<ClusterClassWorkersMachinePoolsNaming>,
}

/// bootstrap contains the bootstrap template reference to be used
/// for the creation of the Machines in the MachinePool.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachinePoolsBootstrap {
    /// templateRef is a required reference to the BootstrapTemplate for a MachinePool.
    #[serde(rename = "templateRef")]
    pub template_ref: ClusterClassWorkersMachinePoolsBootstrapTemplateRef,
}

/// templateRef is a required reference to the BootstrapTemplate for a MachinePool.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachinePoolsBootstrapTemplateRef {
    /// apiVersion of the template.
    /// apiVersion must be fully qualified domain name followed by / and a version.
    #[serde(rename = "apiVersion")]
    pub api_version: String,
    /// kind of the template.
    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
    pub kind: String,
    /// name of the template.
    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
    pub name: String,
}

/// deletion contains configuration options for Machine deletion.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachinePoolsDeletion {
    /// nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine
    /// hosts after the Machine Pool is marked for deletion. A duration of 0 will retry deletion indefinitely.
    /// Defaults to 10 seconds.
    /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeDeletionTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_deletion_timeout_seconds: Option<i32>,
    /// nodeDrainTimeoutSeconds is the total amount of time that the controller will spend on draining a node.
    /// The default value is 0, meaning that the node can be drained without any time limitations.
    /// NOTE: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`
    /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeDrainTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_drain_timeout_seconds: Option<i32>,
    /// nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes
    /// to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.
    /// NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nodeVolumeDetachTimeoutSeconds"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub node_volume_detach_timeout_seconds: Option<i32>,
}

/// infrastructure contains the infrastructure template reference to be used
/// for the creation of the MachinePool.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachinePoolsInfrastructure {
    /// templateRef is a required reference to the InfrastructureTemplate for a MachinePool.
    #[serde(rename = "templateRef")]
    pub template_ref: ClusterClassWorkersMachinePoolsInfrastructureTemplateRef,
}

/// templateRef is a required reference to the InfrastructureTemplate for a MachinePool.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachinePoolsInfrastructureTemplateRef {
    /// apiVersion of the template.
    /// apiVersion must be fully qualified domain name followed by / and a version.
    #[serde(rename = "apiVersion")]
    pub api_version: String,
    /// kind of the template.
    /// kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.
    pub kind: String,
    /// name of the template.
    /// name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.
    pub name: String,
}

/// metadata is the metadata applied to the MachinePool.
/// At runtime this metadata is merged with the corresponding metadata from the topology.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachinePoolsMetadata {
    /// annotations is an unstructured key value map stored with a resource that may be
    /// set by external tools to store and retrieve arbitrary metadata. They are not
    /// queryable and should be preserved when modifying objects.
    /// More info: <http://kubernetes.io/docs/user-guide/annotations>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub annotations: Option<BTreeMap<String, String>>,
    /// labels is a map of string keys and values that can be used to organize and categorize
    /// (scope and select) objects. May match selectors of replication controllers
    /// and services.
    /// More info: <http://kubernetes.io/docs/user-guide/labels>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub labels: Option<BTreeMap<String, String>>,
}

/// naming allows changing the naming pattern used when creating the MachinePool.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassWorkersMachinePoolsNaming {
    /// template defines the template to use for generating the name of the MachinePool object.
    /// If not defined, it will fallback to `{{ .cluster.name }}-{{ .machinePool.topologyName }}-{{ .random }}`.
    /// If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will
    /// get concatenated with a random suffix of length 5.
    /// The templating mechanism provides the following arguments:
    /// * `.cluster.name`: The name of the cluster object.
    /// * `.random`: A random alphanumeric string, without vowels, of length 5.
    /// * `.machinePool.topologyName`: The name of the MachinePool topology (Cluster.spec.topology.workers.machinePools[].name).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub template: Option<String>,
}

/// status is the observed state of ClusterClass.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassStatus {
    /// conditions represents the observations of a ClusterClass's current state.
    /// Known condition types are VariablesReady, RefVersionsUpToDate, Paused.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub conditions: Option<Vec<Condition>>,
    /// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub deprecated: Option<ClusterClassStatusDeprecated>,
    /// observedGeneration is the latest generation observed by the controller.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "observedGeneration"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub observed_generation: Option<i64>,
    /// variables is a list of ClusterClassStatusVariable that are defined for the ClusterClass.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub variables: Option<Vec<ClusterClassStatusVariables>>,
}

/// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassStatusDeprecated {
    /// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub v1beta1: Option<ClusterClassStatusDeprecatedV1beta1>,
}

/// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassStatusDeprecatedV1beta1 {
    /// conditions defines current observed state of the ClusterClass.
    ///
    /// Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see <https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md> for more details.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub conditions: Option<Vec<Condition>>,
}

/// ClusterClassStatusVariable defines a variable which appears in the status of a ClusterClass.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassStatusVariables {
    /// definitions is a list of definitions for a variable.
    #[cfg_attr(feature = "builder", builder(default))]
    pub definitions: Vec<ClusterClassStatusVariablesDefinitions>,
    /// definitionsConflict specifies whether or not there are conflicting definitions for a single variable name.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "definitionsConflict"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub definitions_conflict: Option<bool>,
    /// name is the name of the variable.
    pub name: String,
}

/// ClusterClassStatusVariableDefinition defines a variable which appears in the status of a ClusterClass.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassStatusVariablesDefinitions {
    /// deprecatedV1Beta1Metadata is the metadata of a variable.
    /// It can be used to add additional data for higher level tools to
    /// a ClusterClassVariable.
    ///
    /// Deprecated: This field is deprecated and will be removed when support for v1beta1 will be dropped. Please use XMetadata in JSONSchemaProps instead.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "deprecatedV1Beta1Metadata"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub deprecated_v1_beta1_metadata:
        Option<ClusterClassStatusVariablesDefinitionsDeprecatedV1Beta1Metadata>,
    /// from specifies the origin of the variable definition.
    /// This will be `inline` for variables defined in the ClusterClass or the name of a patch defined in the ClusterClass
    /// for variables discovered from a DiscoverVariables runtime extensions.
    pub from: String,
    /// required specifies if the variable is required.
    /// Note: this applies to the variable as a whole and thus the
    /// top-level object defined in the schema. If nested fields are
    /// required, this will be specified inside the schema.
    pub required: bool,
    /// schema defines the schema of the variable.
    pub schema: ClusterClassStatusVariablesDefinitionsSchema,
}

/// deprecatedV1Beta1Metadata is the metadata of a variable.
/// It can be used to add additional data for higher level tools to
/// a ClusterClassVariable.
///
/// Deprecated: This field is deprecated and will be removed when support for v1beta1 will be dropped. Please use XMetadata in JSONSchemaProps instead.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassStatusVariablesDefinitionsDeprecatedV1Beta1Metadata {
    /// annotations is an unstructured key value map that can be used to store and
    /// retrieve arbitrary metadata.
    /// They are not queryable.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub annotations: Option<BTreeMap<String, String>>,
    /// labels is a map of string keys and values that can be used to organize and categorize
    /// (scope and select) variables.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub labels: Option<BTreeMap<String, String>>,
}

/// schema defines the schema of the variable.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassStatusVariablesDefinitionsSchema {
    /// openAPIV3Schema defines the schema of a variable via OpenAPI v3
    /// schema. The schema is a subset of the schema used in
    /// Kubernetes CRDs.
    #[serde(rename = "openAPIV3Schema")]
    pub open_apiv3_schema: ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3Schema,
}

/// openAPIV3Schema defines the schema of a variable via OpenAPI v3
/// schema. The schema is a subset of the schema used in
/// Kubernetes CRDs.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3Schema {
    /// additionalProperties specifies the schema of values in a map (keys are always strings).
    /// NOTE: Can only be set if type is object.
    /// NOTE: AdditionalProperties is mutually exclusive with Properties.
    /// NOTE: This field uses PreserveUnknownFields and Schemaless,
    /// because recursive validation is not possible.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "additionalProperties"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub additional_properties: Option<serde_json::Value>,
    /// allOf specifies that the variable must validate against all of the subschemas in the array.
    /// NOTE: This field uses PreserveUnknownFields and Schemaless,
    /// because recursive validation is not possible.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "allOf")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub all_of: Option<serde_json::Value>,
    /// anyOf specifies that the variable must validate against one or more of the subschemas in the array.
    /// NOTE: This field uses PreserveUnknownFields and Schemaless,
    /// because recursive validation is not possible.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "anyOf")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub any_of: Option<serde_json::Value>,
    /// default is the default value of the variable.
    /// NOTE: Can be set for all types.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub default: Option<serde_json::Value>,
    /// description is a human-readable description of this variable.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub description: Option<String>,
    /// enum is the list of valid values of the variable.
    /// NOTE: Can be set for all types.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "enum")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub r#enum: Option<Vec<serde_json::Value>>,
    /// example is an example for this variable.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub example: Option<serde_json::Value>,
    /// exclusiveMaximum specifies if the Maximum is exclusive.
    /// NOTE: Can only be set if type is integer or number.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "exclusiveMaximum"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub exclusive_maximum: Option<bool>,
    /// exclusiveMinimum specifies if the Minimum is exclusive.
    /// NOTE: Can only be set if type is integer or number.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "exclusiveMinimum"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub exclusive_minimum: Option<bool>,
    /// format is an OpenAPI v3 format string. Unknown formats are ignored.
    /// For a list of supported formats please see: (of the k8s.io/apiextensions-apiserver version we're currently using)
    /// <https://github.com/kubernetes/apiextensions-apiserver/blob/master/pkg/apiserver/validation/formats.go>
    /// NOTE: Can only be set if type is string.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub format: Option<String>,
    /// items specifies fields of an array.
    /// NOTE: Can only be set if type is array.
    /// NOTE: This field uses PreserveUnknownFields and Schemaless,
    /// because recursive validation is not possible.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub items: Option<serde_json::Value>,
    /// maxItems is the max length of an array variable.
    /// NOTE: Can only be set if type is array.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxItems")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub max_items: Option<i64>,
    /// maxLength is the max length of a string variable.
    /// NOTE: Can only be set if type is string.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "maxLength")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub max_length: Option<i64>,
    /// maxProperties is the maximum amount of entries in a map or properties in an object.
    /// NOTE: Can only be set if type is object.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "maxProperties"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub max_properties: Option<i64>,
    /// maximum is the maximum of an integer or number variable.
    /// If ExclusiveMaximum is false, the variable is valid if it is lower than, or equal to, the value of Maximum.
    /// If ExclusiveMaximum is true, the variable is valid if it is strictly lower than the value of Maximum.
    /// NOTE: Can only be set if type is integer or number.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub maximum: Option<i64>,
    /// minItems is the min length of an array variable.
    /// NOTE: Can only be set if type is array.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "minItems")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub min_items: Option<i64>,
    /// minLength is the min length of a string variable.
    /// NOTE: Can only be set if type is string.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "minLength")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub min_length: Option<i64>,
    /// minProperties is the minimum amount of entries in a map or properties in an object.
    /// NOTE: Can only be set if type is object.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "minProperties"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub min_properties: Option<i64>,
    /// minimum is the minimum of an integer or number variable.
    /// If ExclusiveMinimum is false, the variable is valid if it is greater than, or equal to, the value of Minimum.
    /// If ExclusiveMinimum is true, the variable is valid if it is strictly greater than the value of Minimum.
    /// NOTE: Can only be set if type is integer or number.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub minimum: Option<i64>,
    /// not specifies that the variable must not validate against the subschema.
    /// NOTE: This field uses PreserveUnknownFields and Schemaless,
    /// because recursive validation is not possible.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub not: Option<serde_json::Value>,
    /// oneOf specifies that the variable must validate against exactly one of the subschemas in the array.
    /// NOTE: This field uses PreserveUnknownFields and Schemaless,
    /// because recursive validation is not possible.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "oneOf")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub one_of: Option<serde_json::Value>,
    /// pattern is the regex which a string variable must match.
    /// NOTE: Can only be set if type is string.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub pattern: Option<String>,
    /// properties specifies fields of an object.
    /// NOTE: Can only be set if type is object.
    /// NOTE: Properties is mutually exclusive with AdditionalProperties.
    /// NOTE: This field uses PreserveUnknownFields and Schemaless,
    /// because recursive validation is not possible.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub properties: Option<serde_json::Value>,
    /// required specifies which fields of an object are required.
    /// NOTE: Can only be set if type is object.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub required: Option<Vec<String>>,
    /// type is the type of the variable.
    /// Valid values are: object, array, string, integer, number or boolean.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub r#type: Option<ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaType>,
    /// uniqueItems specifies if items in an array must be unique.
    /// NOTE: Can only be set if type is array.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "uniqueItems"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub unique_items: Option<bool>,
    /// x-kubernetes-int-or-string specifies that this value is
    /// either an integer or a string. If this is true, an empty
    /// type is allowed and type as child of anyOf is permitted
    /// if following one of the following patterns:
    ///
    /// 1) anyOf:
    ///    - type: integer
    ///    - type: string
    /// 2) allOf:
    ///    - anyOf:
    ///      - type: integer
    ///      - type: string
    ///    - ... zero or more
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "x-kubernetes-int-or-string"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub x_kubernetes_int_or_string: Option<bool>,
    /// x-kubernetes-preserve-unknown-fields allows setting fields in a variable object
    /// which are not defined in the variable schema. This affects fields recursively,
    /// except if nested properties or additionalProperties are specified in the schema.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "x-kubernetes-preserve-unknown-fields"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub x_kubernetes_preserve_unknown_fields: Option<bool>,
    /// x-kubernetes-validations describes a list of validation rules written in the CEL expression language.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "x-kubernetes-validations"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub x_kubernetes_validations: Option<
        Vec<ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaXKubernetesValidations>,
    >,
    /// x-metadata is the metadata of a variable or a nested field within a variable.
    /// It can be used to add additional data for higher level tools.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "x-metadata"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub x_metadata: Option<ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaXMetadata>,
}

/// openAPIV3Schema defines the schema of a variable via OpenAPI v3
/// schema. The schema is a subset of the schema used in
/// Kubernetes CRDs.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaType {
    #[serde(rename = "object")]
    Object,
    #[serde(rename = "array")]
    Array,
    #[serde(rename = "string")]
    String,
    #[serde(rename = "integer")]
    Integer,
    #[serde(rename = "number")]
    Number,
    #[serde(rename = "boolean")]
    Boolean,
}

/// ValidationRule describes a validation rule written in the CEL expression language.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaXKubernetesValidations {
    /// fieldPath represents the field path returned when the validation fails.
    /// It must be a relative JSON path (i.e. with array notation) scoped to the location of this x-kubernetes-validations extension in the schema and refer to an existing field.
    /// e.g. when validation checks if a specific attribute `foo` under a map `testMap`, the fieldPath could be set to `.testMap.foo`
    /// If the validation checks two lists must have unique attributes, the fieldPath could be set to either of the list: e.g. `.testList`
    /// It does not support list numeric index.
    /// It supports child operation to refer to an existing field currently. Refer to [JSONPath support in Kubernetes](<https://kubernetes.io/docs/reference/kubectl/jsonpath/)> for more info.
    /// Numeric index of array is not supported.
    /// For field name which contains special characters, use `['specialName']` to refer the field name.
    /// e.g. for attribute `foo.34$` appears in a list `testList`, the fieldPath could be set to `.testList['foo.34$']`
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "fieldPath")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub field_path: Option<String>,
    /// message represents the message displayed when validation fails. The message is required if the Rule contains
    /// line breaks. The message must not contain line breaks.
    /// If unset, the message is "failed rule: {Rule}".
    /// e.g. "must be a URL with the host matching spec.host"
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub message: Option<String>,
    /// messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails.
    /// Since messageExpression is used as a failure message, it must evaluate to a string.
    /// If both message and messageExpression are present on a rule, then messageExpression will be used if validation
    /// fails. If messageExpression results in a runtime error, the validation failure message is produced
    /// as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string
    /// that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset.
    /// messageExpression has access to all the same variables as the rule; the only difference is the return type.
    /// Example:
    /// "x must be less than max ("+string(self.max)+")"
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "messageExpression"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub message_expression: Option<String>,
    /// reason provides a machine-readable validation failure reason that is returned to the caller when a request fails this validation rule.
    /// The currently supported reasons are: "FieldValueInvalid", "FieldValueForbidden", "FieldValueRequired", "FieldValueDuplicate".
    /// If not set, default to use "FieldValueInvalid".
    /// All future added reasons must be accepted by clients when reading this value and unknown reasons should be treated as FieldValueInvalid.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub reason: Option<
        ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaXKubernetesValidationsReason,
    >,
    /// rule represents the expression which will be evaluated by CEL.
    /// ref: <https://github.com/google/cel-spec>
    /// The Rule is scoped to the location of the x-kubernetes-validations extension in the schema.
    /// The `self` variable in the CEL expression is bound to the scoped value.
    /// If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable
    /// via `self.field` and field presence can be checked via `has(self.field)`.
    /// If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map
    /// are accessible via `self[mapKey]`, map containment can be checked via `mapKey in self` and all entries of the map
    /// are accessible via CEL macros and functions such as `self.all(...)`.
    /// If the Rule is scoped to an array, the elements of the array are accessible via `self[i]` and also by macros and
    /// functions.
    /// If the Rule is scoped to a scalar, `self` is bound to the scalar value.
    /// Examples:
    /// - Rule scoped to a map of objects: {"rule": "self.components['Widget'].priority < 10"}
    /// - Rule scoped to a list of integers: {"rule": "self.values.all(value, value >= 0 && value < 100)"}
    /// - Rule scoped to a string value: {"rule": "self.startsWith('kube')"}
    ///
    /// Unknown data preserved in custom resources via x-kubernetes-preserve-unknown-fields is not accessible in CEL
    /// expressions. This includes:
    /// - Unknown field values that are preserved by object schemas with x-kubernetes-preserve-unknown-fields.
    /// - Object properties where the property schema is of an "unknown type". An "unknown type" is recursively defined as:
    ///   - A schema with no type and x-kubernetes-preserve-unknown-fields set to true
    ///   - An array where the items schema is of an "unknown type"
    ///   - An object where the additionalProperties schema is of an "unknown type"
    ///
    /// Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible.
    /// Accessible property names are escaped according to the following rules when accessed in the expression:
    /// - '__' escapes to '__underscores__'
    /// - '.' escapes to '__dot__'
    /// - '-' escapes to '__dash__'
    /// - '/' escapes to '__slash__'
    /// - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:
    /// 	  "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if",
    /// 	  "import", "let", "loop", "package", "namespace", "return".
    /// Examples:
    ///   - Rule accessing a property named "namespace": {"rule": "self.__namespace__ > 0"}
    ///   - Rule accessing a property named "x-prop": {"rule": "self.x__dash__prop > 0"}
    ///   - Rule accessing a property named "redact__d": {"rule": "self.redact__underscores__d > 0"}
    ///
    /// If `rule` makes use of the `oldSelf` variable it is implicitly a
    /// `transition rule`.
    ///
    /// By default, the `oldSelf` variable is the same type as `self`.
    ///
    /// Transition rules by default are applied only on UPDATE requests and are
    /// skipped if an old value could not be found.
    pub rule: String,
}

/// ValidationRule describes a validation rule written in the CEL expression language.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaXKubernetesValidationsReason {
    FieldValueInvalid,
    FieldValueForbidden,
    FieldValueRequired,
    FieldValueDuplicate,
}

/// x-metadata is the metadata of a variable or a nested field within a variable.
/// It can be used to add additional data for higher level tools.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct ClusterClassStatusVariablesDefinitionsSchemaOpenApiv3SchemaXMetadata {
    /// annotations is an unstructured key value map that can be used to store and
    /// retrieve arbitrary metadata.
    /// They are not queryable.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub annotations: Option<BTreeMap<String, String>>,
    /// labels is a map of string keys and values that can be used to organize and categorize
    /// (scope and select) variables.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub labels: Option<BTreeMap<String, String>>,
}