api-swift / Sources / IrdAPI / Generated / VPS.swift
8,462 words
   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
// Generated by scripts/gen-api.py from spec/openapi.json — do not edit.

import Foundation

// MARK: - Types

/// Used by GET /vps/tiers.
public struct Tier: Codable, Sendable, Hashable, Identifiable {
    public var id: String
    public var displayName: String
    public var vcpus: Int
    public var memoryMb: Int
    public var diskGb: Int
    public var perHour: String?

    public init(id: String, displayName: String, vcpus: Int, memoryMb: Int, diskGb: Int, perHour: String? = nil) {
        self.id = id
        self.displayName = displayName
        self.vcpus = vcpus
        self.memoryMb = memoryMb
        self.diskGb = diskGb
        self.perHour = perHour
    }

    enum CodingKeys: String, CodingKey {
        case id
        case displayName = "display_name"
        case vcpus
        case memoryMb = "memory_mb"
        case diskGb = "disk_gb"
        case perHour = "per_hour"
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(id, forKey: .id)
        try container.encode(displayName, forKey: .displayName)
        try container.encode(vcpus, forKey: .vcpus)
        try container.encode(memoryMb, forKey: .memoryMb)
        try container.encode(diskGb, forKey: .diskGb)
        try container.encode(perHour, forKey: .perHour)
    }
}

/// Used by GET /vps/tiers.
public struct ListTiersResponse: Codable, Sendable, Hashable {
    public var tiers: [Tier]

    public init(tiers: [Tier]) {
        self.tiers = tiers
    }

    enum CodingKeys: String, CodingKey {
        case tiers
    }
}

/// Used by GET /vps/system-images.
public struct SystemImage: Codable, Sendable, Hashable, Identifiable {
    public var id: String
    public var displayName: String

    public init(id: String, displayName: String) {
        self.id = id
        self.displayName = displayName
    }

    enum CodingKeys: String, CodingKey {
        case id
        case displayName = "display_name"
    }
}

/// Used by GET /vps/system-images.
public struct ListSystemImagesResponse: Codable, Sendable, Hashable {
    public var systemImages: [SystemImage]

    public init(systemImages: [SystemImage]) {
        self.systemImages = systemImages
    }

    enum CodingKeys: String, CodingKey {
        case systemImages = "system_images"
    }
}

/// Shared by 2 operations.
public struct SshKey: Codable, Sendable, Hashable, Identifiable {
    public var id: String
    public var name: String
    public var fingerprint: String
    public var createdAt: String

    public init(id: String, name: String, fingerprint: String, createdAt: String) {
        self.id = id
        self.name = name
        self.fingerprint = fingerprint
        self.createdAt = createdAt
    }

    enum CodingKeys: String, CodingKey {
        case id
        case name
        case fingerprint
        case createdAt = "created_at"
    }
}

/// Used by GET /vps/ssh-keys.
public struct ListSshKeysResponse: Codable, Sendable, Hashable {
    public var sshKeys: [SshKey]

    public init(sshKeys: [SshKey]) {
        self.sshKeys = sshKeys
    }

    enum CodingKeys: String, CodingKey {
        case sshKeys = "ssh_keys"
    }
}

/// Used by POST /vps/ssh-keys.
public struct AddSshKeyBody: Codable, Sendable, Hashable {
    public var name: String
    public var publicKey: String

    public init(name: String, publicKey: String) {
        self.name = name
        self.publicKey = publicKey
    }

    enum CodingKeys: String, CodingKey {
        case name
        case publicKey = "public_key"
    }
}

/// Used by POST /vps/ssh-keys.
public struct AddSshKeyResponse: Codable, Sendable, Hashable {
    public var sshKey: SshKey

    public init(sshKey: SshKey) {
        self.sshKey = sshKey
    }

    enum CodingKeys: String, CodingKey {
        case sshKey = "ssh_key"
    }
}

/// Used by GET /vps/availability.
public struct AvailabilityResponse: Codable, Sendable, Hashable {
    public var availability: [String: Bool]
    public var maxWaitHours: Int

    public init(availability: [String: Bool], maxWaitHours: Int) {
        self.availability = availability
        self.maxWaitHours = maxWaitHours
    }

    enum CodingKeys: String, CodingKey {
        case availability
        case maxWaitHours = "max_wait_hours"
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum InstanceState: RawRepresentable, Codable, Sendable, Hashable {
    case pending
    case provisioning
    case running
    case stopped
    case deleting
    case deleted
    case failed
    case queued
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [InstanceState] = [.pending, .provisioning, .running, .stopped, .deleting, .deleted, .failed, .queued]

    public init(rawValue: String) {
        switch rawValue {
        case "pending": self = .pending
        case "provisioning": self = .provisioning
        case "running": self = .running
        case "stopped": self = .stopped
        case "deleting": self = .deleting
        case "deleted": self = .deleted
        case "failed": self = .failed
        case "queued": self = .queued
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .pending: return "pending"
        case .provisioning: return "provisioning"
        case .running: return "running"
        case .stopped: return "stopped"
        case .deleting: return "deleting"
        case .deleted: return "deleted"
        case .failed: return "failed"
        case .queued: return "queued"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Shared by 14 operations.
public struct Instance: Codable, Sendable, Hashable, Identifiable {
    public var id: String
    public var name: String
    public var tierId: String
    public var imageRef: String
    public var state: InstanceState
    public var ipv4: String?
    public var ipv6: String?
    /// Reverse DNS pointers set through the API, keyed by IP; an IP absent here carries the provider default PTR
    public var rdns: [String: String]
    /// Cumulative provider traffic counters in bytes (outgoing_bytes/ingoing_bytes/included_bytes + sampled_at), refreshed hourly; null until first sampled. Raw counters: they reset at the provider's billing-period rollover and on server rebuild, so deltas computed across a reset come out negative
    public var traffic: [String: JSONValue]?
    /// Abstract location number; a volume only attaches to servers with the same location
    public var location: Int?
    public var subscriptionId: String?
    public var lastError: String?
    /// Only on queued instances (GET /vps/instances/{id}): whether the outcome email is on
    public var queueNotify: Bool?
    /// Only on queued instances: how many hours the create keeps retrying before giving up
    public var queueWaitHours: Int?
    /// Present (true) on a server another account shared with this one through a vps grant (anchored to a granted domain): manageable here, billed per the share's payer setting (the owner by default)
    public var delegated: Bool?
    public var createdAt: String
    public var updatedAt: String

    public init(id: String, name: String, tierId: String, imageRef: String, state: InstanceState, ipv4: String? = nil, ipv6: String? = nil, rdns: [String: String], traffic: [String: JSONValue]? = nil, location: Int? = nil, subscriptionId: String? = nil, lastError: String? = nil, queueNotify: Bool? = nil, queueWaitHours: Int? = nil, delegated: Bool? = nil, createdAt: String, updatedAt: String) {
        self.id = id
        self.name = name
        self.tierId = tierId
        self.imageRef = imageRef
        self.state = state
        self.ipv4 = ipv4
        self.ipv6 = ipv6
        self.rdns = rdns
        self.traffic = traffic
        self.location = location
        self.subscriptionId = subscriptionId
        self.lastError = lastError
        self.queueNotify = queueNotify
        self.queueWaitHours = queueWaitHours
        self.delegated = delegated
        self.createdAt = createdAt
        self.updatedAt = updatedAt
    }

    enum CodingKeys: String, CodingKey {
        case id
        case name
        case tierId = "tier_id"
        case imageRef = "image_ref"
        case state
        case ipv4
        case ipv6
        case rdns
        case traffic
        case location
        case subscriptionId = "subscription_id"
        case lastError = "last_error"
        case queueNotify = "queue_notify"
        case queueWaitHours = "queue_wait_hours"
        case delegated
        case createdAt = "created_at"
        case updatedAt = "updated_at"
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(id, forKey: .id)
        try container.encode(name, forKey: .name)
        try container.encode(tierId, forKey: .tierId)
        try container.encode(imageRef, forKey: .imageRef)
        try container.encode(state, forKey: .state)
        try container.encode(ipv4, forKey: .ipv4)
        try container.encode(ipv6, forKey: .ipv6)
        try container.encode(rdns, forKey: .rdns)
        try container.encode(traffic, forKey: .traffic)
        try container.encode(location, forKey: .location)
        try container.encode(subscriptionId, forKey: .subscriptionId)
        try container.encode(lastError, forKey: .lastError)
        try container.encodeIfPresent(queueNotify, forKey: .queueNotify)
        try container.encodeIfPresent(queueWaitHours, forKey: .queueWaitHours)
        try container.encodeIfPresent(delegated, forKey: .delegated)
        try container.encode(createdAt, forKey: .createdAt)
        try container.encode(updatedAt, forKey: .updatedAt)
    }
}

/// Used by GET /vps/instances.
public struct ListInstancesResponse: Codable, Sendable, Hashable {
    public var instances: [Instance]

    public init(instances: [Instance]) {
        self.instances = instances
    }

    enum CodingKeys: String, CodingKey {
        case instances
    }
}

/// Used by POST /vps/instances.
public struct CreateInstanceBody: Codable, Sendable, Hashable {
    public var tierId: String
    public var name: String
    public var sshKeyIds: [String]
    public var imageRef: String?
    public var volumeId: String?
    public var queueIfUnavailable: Bool?
    public var notifyOnOutcome: Bool?
    public var zone: String?
    public var subdomain: String?
    public var totpCode: String?

    public init(tierId: String, name: String, sshKeyIds: [String], imageRef: String? = nil, volumeId: String? = nil, queueIfUnavailable: Bool? = nil, notifyOnOutcome: Bool? = nil, zone: String? = nil, subdomain: String? = nil, totpCode: String? = nil) {
        self.tierId = tierId
        self.name = name
        self.sshKeyIds = sshKeyIds
        self.imageRef = imageRef
        self.volumeId = volumeId
        self.queueIfUnavailable = queueIfUnavailable
        self.notifyOnOutcome = notifyOnOutcome
        self.zone = zone
        self.subdomain = subdomain
        self.totpCode = totpCode
    }

    enum CodingKeys: String, CodingKey {
        case tierId = "tier_id"
        case name
        case sshKeyIds = "ssh_key_ids"
        case imageRef = "image_ref"
        case volumeId = "volume_id"
        case queueIfUnavailable = "queue_if_unavailable"
        case notifyOnOutcome = "notify_on_outcome"
        case zone
        case subdomain
        case totpCode = "totp_code"
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum VPSActionType: RawRepresentable, Codable, Sendable, Hashable {
    case create
    case delete
    case createImage
    case deleteImage
    case createVolume
    case deleteVolume
    case restart
    case reset
    case shutdown
    case powerOff
    case powerOn
    case changeRdns
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [VPSActionType] = [.create, .delete, .createImage, .deleteImage, .createVolume, .deleteVolume, .restart, .reset, .shutdown, .powerOff, .powerOn, .changeRdns]

    public init(rawValue: String) {
        switch rawValue {
        case "create": self = .create
        case "delete": self = .delete
        case "create-image": self = .createImage
        case "delete-image": self = .deleteImage
        case "create-volume": self = .createVolume
        case "delete-volume": self = .deleteVolume
        case "restart": self = .restart
        case "reset": self = .reset
        case "shutdown": self = .shutdown
        case "power-off": self = .powerOff
        case "power-on": self = .powerOn
        case "change-rdns": self = .changeRdns
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .create: return "create"
        case .delete: return "delete"
        case .createImage: return "create-image"
        case .deleteImage: return "delete-image"
        case .createVolume: return "create-volume"
        case .deleteVolume: return "delete-volume"
        case .restart: return "restart"
        case .reset: return "reset"
        case .shutdown: return "shutdown"
        case .powerOff: return "power-off"
        case .powerOn: return "power-on"
        case .changeRdns: return "change-rdns"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum VPSActionState: RawRepresentable, Codable, Sendable, Hashable {
    case pendingCharge
    case queued
    case claimed
    case submitted
    case reconciling
    case succeeded
    case failed
    case cancelled
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [VPSActionState] = [.pendingCharge, .queued, .claimed, .submitted, .reconciling, .succeeded, .failed, .cancelled]

    public init(rawValue: String) {
        switch rawValue {
        case "pending-charge": self = .pendingCharge
        case "queued": self = .queued
        case "claimed": self = .claimed
        case "submitted": self = .submitted
        case "reconciling": self = .reconciling
        case "succeeded": self = .succeeded
        case "failed": self = .failed
        case "cancelled": self = .cancelled
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .pendingCharge: return "pending-charge"
        case .queued: return "queued"
        case .claimed: return "claimed"
        case .submitted: return "submitted"
        case .reconciling: return "reconciling"
        case .succeeded: return "succeeded"
        case .failed: return "failed"
        case .cancelled: return "cancelled"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Shared by 17 operations.
public struct VPSAction: Codable, Sendable, Hashable, Identifiable {
    public var id: String
    public var type: VPSActionType
    public var state: VPSActionState
    public var instanceId: String?
    public var error: String?
    public var result: [String: JSONValue]?
    public var createdAt: String
    public var finishedAt: String?

    public init(id: String, type: VPSActionType, state: VPSActionState, instanceId: String? = nil, error: String? = nil, result: [String: JSONValue]? = nil, createdAt: String, finishedAt: String? = nil) {
        self.id = id
        self.type = type
        self.state = state
        self.instanceId = instanceId
        self.error = error
        self.result = result
        self.createdAt = createdAt
        self.finishedAt = finishedAt
    }

    enum CodingKeys: String, CodingKey {
        case id
        case type
        case state
        case instanceId = "instance_id"
        case error
        case result
        case createdAt = "created_at"
        case finishedAt = "finished_at"
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(id, forKey: .id)
        try container.encode(type, forKey: .type)
        try container.encode(state, forKey: .state)
        try container.encode(instanceId, forKey: .instanceId)
        try container.encode(error, forKey: .error)
        try container.encode(result, forKey: .result)
        try container.encode(createdAt, forKey: .createdAt)
        try container.encode(finishedAt, forKey: .finishedAt)
    }
}

/// Shared by 9 operations.
public struct InstanceActionResponse: Codable, Sendable, Hashable {
    public var instance: Instance
    public var action: VPSAction

    public init(instance: Instance, action: VPSAction) {
        self.instance = instance
        self.action = action
    }

    enum CodingKeys: String, CodingKey {
        case instance
        case action
    }
}

/// Used by GET /vps/apps.
public struct VPSApp: Codable, Sendable, Hashable, Identifiable {
    /// The catalog app id, e.g. `ird_gitlab`
    public var id: String
    public var displayName: String
    public var description: String?
    public var minMemoryMb: Int
    public var minDiskGb: Int
    /// The golden image version new deployments boot
    public var imageVersion: String?
    /// Tier ids meeting the app's memory/disk/architecture minimums
    public var eligibleTierIds: [String]

    public init(id: String, displayName: String, description: String? = nil, minMemoryMb: Int, minDiskGb: Int, imageVersion: String? = nil, eligibleTierIds: [String]) {
        self.id = id
        self.displayName = displayName
        self.description = description
        self.minMemoryMb = minMemoryMb
        self.minDiskGb = minDiskGb
        self.imageVersion = imageVersion
        self.eligibleTierIds = eligibleTierIds
    }

    enum CodingKeys: String, CodingKey {
        case id
        case displayName = "display_name"
        case description
        case minMemoryMb = "min_memory_mb"
        case minDiskGb = "min_disk_gb"
        case imageVersion = "image_version"
        case eligibleTierIds = "eligible_tier_ids"
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(id, forKey: .id)
        try container.encode(displayName, forKey: .displayName)
        try container.encode(description, forKey: .description)
        try container.encode(minMemoryMb, forKey: .minMemoryMb)
        try container.encode(minDiskGb, forKey: .minDiskGb)
        try container.encode(imageVersion, forKey: .imageVersion)
        try container.encode(eligibleTierIds, forKey: .eligibleTierIds)
    }
}

/// Used by GET /vps/apps.
public struct AppCatalogResponse: Codable, Sendable, Hashable {
    public var apps: [VPSApp]

    public init(apps: [VPSApp]) {
        self.apps = apps
    }

    enum CodingKeys: String, CodingKey {
        case apps
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum AppDeploymentState: RawRepresentable, Codable, Sendable, Hashable {
    case provisioning
    case active
    case failed
    case deleted
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [AppDeploymentState] = [.provisioning, .active, .failed, .deleted]

    public init(rawValue: String) {
        switch rawValue {
        case "provisioning": self = .provisioning
        case "active": self = .active
        case "failed": self = .failed
        case "deleted": self = .deleted
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .provisioning: return "provisioning"
        case .active: return "active"
        case .failed: return "failed"
        case .deleted: return "deleted"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum DnsConnectionState: RawRepresentable, Codable, Sendable, Hashable {
    case pending
    case ok
    case error
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [DnsConnectionState] = [.pending, .ok, .error]

    public init(rawValue: String) {
        switch rawValue {
        case "pending": self = .pending
        case "ok": self = .ok
        case "error": self = .error
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .pending: return "pending"
        case .ok: return "ok"
        case .error: return "error"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Shared by 3 operations.
public struct AppDeployment: Codable, Sendable, Hashable, Identifiable {
    public var id: String
    public var appId: String
    public var hostname: String
    /// The app's address; usable once `dns_state` is `ok` and the app finishes first boot
    public var url: String
    public var state: AppDeploymentState
    public var instanceId: String
    /// The backing server's compute state (see GET /vps/instances)
    public var instanceState: String?
    public var ipv4: String?
    /// The managed DNS record: `pending` while propagating, `ok` once the hostname resolves to the server, `error` with `dns_error` explaining
    public var dnsState: DnsConnectionState
    public var dnsError: String?
    public var lastError: String?
    /// True while the one-time root-password reveal (POST /vps/apps/deployments/{id}/reveal-password) is still unused
    public var passwordAvailable: Bool
    public var createdAt: String

    public init(id: String, appId: String, hostname: String, url: String, state: AppDeploymentState, instanceId: String, instanceState: String? = nil, ipv4: String? = nil, dnsState: DnsConnectionState, dnsError: String? = nil, lastError: String? = nil, passwordAvailable: Bool, createdAt: String) {
        self.id = id
        self.appId = appId
        self.hostname = hostname
        self.url = url
        self.state = state
        self.instanceId = instanceId
        self.instanceState = instanceState
        self.ipv4 = ipv4
        self.dnsState = dnsState
        self.dnsError = dnsError
        self.lastError = lastError
        self.passwordAvailable = passwordAvailable
        self.createdAt = createdAt
    }

    enum CodingKeys: String, CodingKey {
        case id
        case appId = "app_id"
        case hostname
        case url
        case state
        case instanceId = "instance_id"
        case instanceState = "instance_state"
        case ipv4
        case dnsState = "dns_state"
        case dnsError = "dns_error"
        case lastError = "last_error"
        case passwordAvailable = "password_available"
        case createdAt = "created_at"
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(id, forKey: .id)
        try container.encode(appId, forKey: .appId)
        try container.encode(hostname, forKey: .hostname)
        try container.encode(url, forKey: .url)
        try container.encode(state, forKey: .state)
        try container.encode(instanceId, forKey: .instanceId)
        try container.encode(instanceState, forKey: .instanceState)
        try container.encode(ipv4, forKey: .ipv4)
        try container.encode(dnsState, forKey: .dnsState)
        try container.encode(dnsError, forKey: .dnsError)
        try container.encode(lastError, forKey: .lastError)
        try container.encode(passwordAvailable, forKey: .passwordAvailable)
        try container.encode(createdAt, forKey: .createdAt)
    }
}

/// Used by GET /vps/apps/deployments.
public struct ListAppDeploymentsResponse: Codable, Sendable, Hashable {
    public var deployments: [AppDeployment]

    public init(deployments: [AppDeployment]) {
        self.deployments = deployments
    }

    enum CodingKeys: String, CodingKey {
        case deployments
    }
}

/// Used by POST /vps/apps/deployments.
public struct DeployAppBody: Codable, Sendable, Hashable {
    /// A catalog id from GET /vps/apps
    public var appId: String
    /// A domain you own and DNS-host with ird, e.g. `exemplu.ro`
    public var zone: String
    /// The label the app deploys at, e.g. `git` → `git.exemplu.ro`
    public var subdomain: String
    /// One of the app's `eligible_tier_ids`
    public var tierId: String
    public var sshKeyIds: [String]
    /// Display name for the backing server; defaults to the hostname
    public var name: String?
    /// When the tier has no capacity, queue the deploy instead of failing: the returned instance is `queued`, nothing is charged, and the platform retries until capacity frees or the wait bound (`queue_wait_hours`) passes
    public var queueIfUnavailable: Bool?
    /// Email when a queued deploy finally provisions or fails
    public var notifyOnOutcome: Bool?
    /// Authenticator step-up when the zone's domain is protected as sensitive
    public var totpCode: String?

    public init(appId: String, zone: String, subdomain: String, tierId: String, sshKeyIds: [String], name: String? = nil, queueIfUnavailable: Bool? = nil, notifyOnOutcome: Bool? = nil, totpCode: String? = nil) {
        self.appId = appId
        self.zone = zone
        self.subdomain = subdomain
        self.tierId = tierId
        self.sshKeyIds = sshKeyIds
        self.name = name
        self.queueIfUnavailable = queueIfUnavailable
        self.notifyOnOutcome = notifyOnOutcome
        self.totpCode = totpCode
    }

    enum CodingKeys: String, CodingKey {
        case appId = "app_id"
        case zone
        case subdomain
        case tierId = "tier_id"
        case sshKeyIds = "ssh_key_ids"
        case name
        case queueIfUnavailable = "queue_if_unavailable"
        case notifyOnOutcome = "notify_on_outcome"
        case totpCode = "totp_code"
    }
}

/// Used by POST /vps/apps/deployments.
public struct DeployAppResponse: Codable, Sendable, Hashable {
    public var deployment: AppDeployment
    public var instance: Instance
    public var action: VPSAction
    /// The app's root password — shown here and, until used, via the one-time reveal endpoint; rotate it after first login
    public var rootPassword: String

    public init(deployment: AppDeployment, instance: Instance, action: VPSAction, rootPassword: String) {
        self.deployment = deployment
        self.instance = instance
        self.action = action
        self.rootPassword = rootPassword
    }

    enum CodingKeys: String, CodingKey {
        case deployment
        case instance
        case action
        case rootPassword = "root_password"
    }
}

/// Used by GET /vps/apps/deployments/{id}.
public struct GetAppDeploymentResponse: Codable, Sendable, Hashable {
    public var deployment: AppDeployment
    public var instance: Instance?

    public init(deployment: AppDeployment, instance: Instance? = nil) {
        self.deployment = deployment
        self.instance = instance
    }

    enum CodingKeys: String, CodingKey {
        case deployment
        case instance
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(deployment, forKey: .deployment)
        try container.encode(instance, forKey: .instance)
    }
}

/// Used by POST /vps/apps/deployments/{id}/reveal-password.
public struct RevealAppPasswordResponse: Codable, Sendable, Hashable {
    public var rootPassword: String

    public init(rootPassword: String) {
        self.rootPassword = rootPassword
    }

    enum CodingKeys: String, CodingKey {
        case rootPassword = "root_password"
    }
}

/// Used by GET /vps/instances/{id}.
public struct GetInstanceResponse: Codable, Sendable, Hashable {
    public var instance: Instance

    public init(instance: Instance) {
        self.instance = instance
    }

    enum CodingKeys: String, CodingKey {
        case instance
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum MetricsSource: RawRepresentable, Codable, Sendable, Hashable {
    case live
    case stored
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [MetricsSource] = [.live, .stored]

    public init(rawValue: String) {
        switch rawValue {
        case "live": self = .live
        case "stored": self = .stored
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .live: return "live"
        case .stored: return "stored"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum MetricSeriesName: RawRepresentable, Codable, Sendable, Hashable {
    case cpu
    case diskIopsRead
    case diskIopsWrite
    case diskBandwidthRead
    case diskBandwidthWrite
    case netPpsIn
    case netPpsOut
    case netBandwidthIn
    case netBandwidthOut
    case trafficOut
    case trafficIn
    case trafficIncluded
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [MetricSeriesName] = [.cpu, .diskIopsRead, .diskIopsWrite, .diskBandwidthRead, .diskBandwidthWrite, .netPpsIn, .netPpsOut, .netBandwidthIn, .netBandwidthOut, .trafficOut, .trafficIn, .trafficIncluded]

    public init(rawValue: String) {
        switch rawValue {
        case "cpu": self = .cpu
        case "disk-iops-read": self = .diskIopsRead
        case "disk-iops-write": self = .diskIopsWrite
        case "disk-bandwidth-read": self = .diskBandwidthRead
        case "disk-bandwidth-write": self = .diskBandwidthWrite
        case "net-pps-in": self = .netPpsIn
        case "net-pps-out": self = .netPpsOut
        case "net-bandwidth-in": self = .netBandwidthIn
        case "net-bandwidth-out": self = .netBandwidthOut
        case "traffic-out": self = .trafficOut
        case "traffic-in": self = .trafficIn
        case "traffic-included": self = .trafficIncluded
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .cpu: return "cpu"
        case .diskIopsRead: return "disk-iops-read"
        case .diskIopsWrite: return "disk-iops-write"
        case .diskBandwidthRead: return "disk-bandwidth-read"
        case .diskBandwidthWrite: return "disk-bandwidth-write"
        case .netPpsIn: return "net-pps-in"
        case .netPpsOut: return "net-pps-out"
        case .netBandwidthIn: return "net-bandwidth-in"
        case .netBandwidthOut: return "net-bandwidth-out"
        case .trafficOut: return "traffic-out"
        case .trafficIn: return "traffic-in"
        case .trafficIncluded: return "traffic-included"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum MetricSeriesUnit: RawRepresentable, Codable, Sendable, Hashable {
    case percent
    case iops
    case bytesPerSecond
    case pps
    case bytes
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [MetricSeriesUnit] = [.percent, .iops, .bytesPerSecond, .pps, .bytes]

    public init(rawValue: String) {
        switch rawValue {
        case "percent": self = .percent
        case "iops": self = .iops
        case "bytes/s": self = .bytesPerSecond
        case "pps": self = .pps
        case "bytes": self = .bytes
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .percent: return "percent"
        case .iops: return "iops"
        case .bytesPerSecond: return "bytes/s"
        case .pps: return "pps"
        case .bytes: return "bytes"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// A fixed-arity JSON array.
public struct MetricPoint: Codable, Sendable, Hashable {
    public var timestamp: Int
    public var value: Double

    public init(timestamp: Int, value: Double) {
        self.timestamp = timestamp
        self.value = value
    }

    public init(from decoder: any Decoder) throws {
        var container = try decoder.unkeyedContainer()
        timestamp = try container.decode(Int.self)
        value = try container.decode(Double.self)
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.unkeyedContainer()
        try container.encode(timestamp)
        try container.encode(value)
    }
}

/// Used by GET /vps/instances/{id}/metrics.
public struct MetricSeries: Codable, Sendable, Hashable {
    public var name: MetricSeriesName
    public var unit: MetricSeriesUnit
    /// [unix-timestamp, value] pairs, oldest first; empty when nothing was recorded in the window
    public var points: [MetricPoint]

    public init(name: MetricSeriesName, unit: MetricSeriesUnit, points: [MetricPoint]) {
        self.name = name
        self.unit = unit
        self.points = points
    }

    enum CodingKeys: String, CodingKey {
        case name
        case unit
        case points
    }
}

/// Used by GET /vps/instances/{id}/metrics.
public struct GetMetricsResponse: Codable, Sendable, Hashable {
    public var instanceId: String
    public var source: MetricsSource
    public var start: String
    public var end: String
    public var step: Int
    public var series: [MetricSeries]

    public init(instanceId: String, source: MetricsSource, start: String, end: String, step: Int, series: [MetricSeries]) {
        self.instanceId = instanceId
        self.source = source
        self.start = start
        self.end = end
        self.step = step
        self.series = series
    }

    enum CodingKeys: String, CodingKey {
        case instanceId = "instance_id"
        case source
        case start
        case end
        case step
        case series
    }
}

/// Used by POST /vps/instances/{id}/queue-notify.
public struct SetQueueNotifyBody: Codable, Sendable, Hashable {
    public var enabled: Bool

    public init(enabled: Bool) {
        self.enabled = enabled
    }

    enum CodingKeys: String, CodingKey {
        case enabled
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum VPSImageState: RawRepresentable, Codable, Sendable, Hashable {
    case pending
    case available
    case deleting
    case deleted
    case failed
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [VPSImageState] = [.pending, .available, .deleting, .deleted, .failed]

    public init(rawValue: String) {
        switch rawValue {
        case "pending": self = .pending
        case "available": self = .available
        case "deleting": self = .deleting
        case "deleted": self = .deleted
        case "failed": self = .failed
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .pending: return "pending"
        case .available: return "available"
        case .deleting: return "deleting"
        case .deleted: return "deleted"
        case .failed: return "failed"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Shared by 3 operations.
public struct VPSImage: Codable, Sendable, Hashable, Identifiable {
    public var id: String
    public var name: String
    public var state: VPSImageState
    public var sizeGb: String?
    public var instanceId: String?
    public var subscriptionId: String?
    public var createRef: String
    public var createdAt: String

    public init(id: String, name: String, state: VPSImageState, sizeGb: String? = nil, instanceId: String? = nil, subscriptionId: String? = nil, createRef: String, createdAt: String) {
        self.id = id
        self.name = name
        self.state = state
        self.sizeGb = sizeGb
        self.instanceId = instanceId
        self.subscriptionId = subscriptionId
        self.createRef = createRef
        self.createdAt = createdAt
    }

    enum CodingKeys: String, CodingKey {
        case id
        case name
        case state
        case sizeGb = "size_gb"
        case instanceId = "instance_id"
        case subscriptionId = "subscription_id"
        case createRef = "create_ref"
        case createdAt = "created_at"
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(id, forKey: .id)
        try container.encode(name, forKey: .name)
        try container.encode(state, forKey: .state)
        try container.encode(sizeGb, forKey: .sizeGb)
        try container.encode(instanceId, forKey: .instanceId)
        try container.encode(subscriptionId, forKey: .subscriptionId)
        try container.encode(createRef, forKey: .createRef)
        try container.encode(createdAt, forKey: .createdAt)
    }
}

/// Shared by 2 operations.
public struct ImageActionResponse: Codable, Sendable, Hashable {
    public var image: VPSImage
    public var action: VPSAction

    public init(image: VPSImage, action: VPSAction) {
        self.image = image
        self.action = action
    }

    enum CodingKeys: String, CodingKey {
        case image
        case action
    }
}

/// Used by PUT /vps/instances/{id}/rdns.
public struct SetRdnsBody: Codable, Sendable, Hashable {
    public var ip: String
    public var hostname: String?

    public init(ip: String, hostname: String? = nil) {
        self.ip = ip
        self.hostname = hostname
    }

    enum CodingKeys: String, CodingKey {
        case ip
        case hostname
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(ip, forKey: .ip)
        try container.encode(hostname, forKey: .hostname)
    }
}

/// Shared by 3 operations.
public struct DomainConnection: Codable, Sendable, Hashable, Identifiable {
    public var id: String
    public var instanceId: String?
    public var hostname: String
    public var zoneOrigin: String
    public var rdns: Bool
    public var dnsState: DnsConnectionState
    public var dnsError: String?
    public var createdAt: String

    public init(id: String, instanceId: String? = nil, hostname: String, zoneOrigin: String, rdns: Bool, dnsState: DnsConnectionState, dnsError: String? = nil, createdAt: String) {
        self.id = id
        self.instanceId = instanceId
        self.hostname = hostname
        self.zoneOrigin = zoneOrigin
        self.rdns = rdns
        self.dnsState = dnsState
        self.dnsError = dnsError
        self.createdAt = createdAt
    }

    enum CodingKeys: String, CodingKey {
        case id
        case instanceId = "instance_id"
        case hostname
        case zoneOrigin = "zone_origin"
        case rdns
        case dnsState = "dns_state"
        case dnsError = "dns_error"
        case createdAt = "created_at"
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(id, forKey: .id)
        try container.encode(instanceId, forKey: .instanceId)
        try container.encode(hostname, forKey: .hostname)
        try container.encode(zoneOrigin, forKey: .zoneOrigin)
        try container.encode(rdns, forKey: .rdns)
        try container.encode(dnsState, forKey: .dnsState)
        try container.encode(dnsError, forKey: .dnsError)
        try container.encode(createdAt, forKey: .createdAt)
    }
}

/// Used by GET /vps/instances/{id}/domains.
public struct ListInstanceDomainsResponse: Codable, Sendable, Hashable {
    public var connections: [DomainConnection]

    public init(connections: [DomainConnection]) {
        self.connections = connections
    }

    enum CodingKeys: String, CodingKey {
        case connections
    }
}

/// Used by POST /vps/instances/{id}/domains.
public struct ConnectDomainBody: Codable, Sendable, Hashable {
    public var zone: String
    public var subdomain: String
    public var setRdns: Bool?
    public var totpCode: String?

    public init(zone: String, subdomain: String, setRdns: Bool? = nil, totpCode: String? = nil) {
        self.zone = zone
        self.subdomain = subdomain
        self.setRdns = setRdns
        self.totpCode = totpCode
    }

    enum CodingKeys: String, CodingKey {
        case zone
        case subdomain
        case setRdns = "set_rdns"
        case totpCode = "totp_code"
    }
}

/// Used by POST /vps/instances/{id}/domains.
public struct ConnectDomainResponse: Codable, Sendable, Hashable {
    public var connection: DomainConnection
    public var instance: Instance
    public var action: VPSAction?

    public init(connection: DomainConnection, instance: Instance, action: VPSAction? = nil) {
        self.connection = connection
        self.instance = instance
        self.action = action
    }

    enum CodingKeys: String, CodingKey {
        case connection
        case instance
        case action
    }
}

/// Used by DELETE /vps/instances/{id}/domains/{connection-id}.
public struct DisconnectDomainResponse: Codable, Sendable, Hashable {
    public var connection: DomainConnection
    public var action: VPSAction?

    public init(connection: DomainConnection, action: VPSAction? = nil) {
        self.connection = connection
        self.action = action
    }

    enum CodingKeys: String, CodingKey {
        case connection
        case action
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum VolumeState: RawRepresentable, Codable, Sendable, Hashable {
    case pending
    case available
    case attached
    case deleting
    case deleted
    case failed
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [VolumeState] = [.pending, .available, .attached, .deleting, .deleted, .failed]

    public init(rawValue: String) {
        switch rawValue {
        case "pending": self = .pending
        case "available": self = .available
        case "attached": self = .attached
        case "deleting": self = .deleting
        case "deleted": self = .deleted
        case "failed": self = .failed
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .pending: return "pending"
        case .available: return "available"
        case .attached: return "attached"
        case .deleting: return "deleting"
        case .deleted: return "deleted"
        case .failed: return "failed"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Shared by 3 operations.
public struct Volume: Codable, Sendable, Hashable, Identifiable {
    public var id: String
    public var name: String
    public var sizeGb: Int
    public var state: VolumeState
    /// Abstract location number; a volume only attaches to servers with the same location
    public var location: Int?
    public var instanceId: String?
    public var subscriptionId: String?
    public var lastError: String?
    public var createdAt: String

    public init(id: String, name: String, sizeGb: Int, state: VolumeState, location: Int? = nil, instanceId: String? = nil, subscriptionId: String? = nil, lastError: String? = nil, createdAt: String) {
        self.id = id
        self.name = name
        self.sizeGb = sizeGb
        self.state = state
        self.location = location
        self.instanceId = instanceId
        self.subscriptionId = subscriptionId
        self.lastError = lastError
        self.createdAt = createdAt
    }

    enum CodingKeys: String, CodingKey {
        case id
        case name
        case sizeGb = "size_gb"
        case state
        case location
        case instanceId = "instance_id"
        case subscriptionId = "subscription_id"
        case lastError = "last_error"
        case createdAt = "created_at"
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(id, forKey: .id)
        try container.encode(name, forKey: .name)
        try container.encode(sizeGb, forKey: .sizeGb)
        try container.encode(state, forKey: .state)
        try container.encode(location, forKey: .location)
        try container.encode(instanceId, forKey: .instanceId)
        try container.encode(subscriptionId, forKey: .subscriptionId)
        try container.encode(lastError, forKey: .lastError)
        try container.encode(createdAt, forKey: .createdAt)
    }
}

/// Used by GET /vps/volumes.
public struct ListVolumesResponse: Codable, Sendable, Hashable {
    public var volumes: [Volume]

    public init(volumes: [Volume]) {
        self.volumes = volumes
    }

    enum CodingKeys: String, CodingKey {
        case volumes
    }
}

/// Used by POST /vps/volumes.
public struct CreateVolumeBody: Codable, Sendable, Hashable {
    public var name: String
    public var sizeGb: Int

    public init(name: String, sizeGb: Int) {
        self.name = name
        self.sizeGb = sizeGb
    }

    enum CodingKeys: String, CodingKey {
        case name
        case sizeGb = "size_gb"
    }
}

/// Shared by 2 operations.
public struct VolumeActionResponse: Codable, Sendable, Hashable {
    public var volume: Volume
    public var action: VPSAction

    public init(volume: Volume, action: VPSAction) {
        self.volume = volume
        self.action = action
    }

    enum CodingKeys: String, CodingKey {
        case volume
        case action
    }
}

/// Used by GET /vps/images.
public struct ListImagesResponse: Codable, Sendable, Hashable {
    public var images: [VPSImage]

    public init(images: [VPSImage]) {
        self.images = images
    }

    enum CodingKeys: String, CodingKey {
        case images
    }
}

/// Used by GET /vps/actions/{id}.
public struct GetActionResponse: Codable, Sendable, Hashable {
    public var action: VPSAction

    public init(action: VPSAction) {
        self.action = action
    }

    enum CodingKeys: String, CodingKey {
        case action
    }
}

/// Values this build does not know decode as `.unrecognized`.
public enum ActivityEntryOrigin: RawRepresentable, Codable, Sendable, Hashable {
    case customer
    case grace
    case admin
    /// A value the server sent that this version of the package does not list.
    case unrecognized(String)

    /// Every value the spec listed when this file was generated.
    public static let known: [ActivityEntryOrigin] = [.customer, .grace, .admin]

    public init(rawValue: String) {
        switch rawValue {
        case "customer": self = .customer
        case "grace": self = .grace
        case "admin": self = .admin
        default: self = .unrecognized(rawValue)
        }
    }

    public var rawValue: String {
        switch self {
        case .customer: return "customer"
        case .grace: return "grace"
        case .admin: return "admin"
        case .unrecognized(let raw): return raw
        }
    }

    public init(from decoder: any Decoder) throws {
        self.init(rawValue: try decoder.singleValueContainer().decode(String.self))
    }

    public func encode(to encoder: any Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(rawValue)
    }
}

/// Used by GET /vps/activity.
public struct ActivityEntry: Codable, Sendable, Hashable, Identifiable {
    public var id: String
    public var type: VPSActionType
    public var state: VPSActionState
    public var origin: ActivityEntryOrigin
    public var instanceId: String?
    public var resourceName: String?
    public var error: String?
    public var createdAt: String
    public var finishedAt: String?

    public init(id: String, type: VPSActionType, state: VPSActionState, origin: ActivityEntryOrigin, instanceId: String? = nil, resourceName: String? = nil, error: String? = nil, createdAt: String, finishedAt: String? = nil) {
        self.id = id
        self.type = type
        self.state = state
        self.origin = origin
        self.instanceId = instanceId
        self.resourceName = resourceName
        self.error = error
        self.createdAt = createdAt
        self.finishedAt = finishedAt
    }

    enum CodingKeys: String, CodingKey {
        case id
        case type
        case state
        case origin
        case instanceId = "instance_id"
        case resourceName = "resource_name"
        case error
        case createdAt = "created_at"
        case finishedAt = "finished_at"
    }

    /// Explicit so required-but-nullable fields encode as `null` rather than vanishing.
    public func encode(to encoder: any Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(id, forKey: .id)
        try container.encode(type, forKey: .type)
        try container.encode(state, forKey: .state)
        try container.encode(origin, forKey: .origin)
        try container.encode(instanceId, forKey: .instanceId)
        try container.encode(resourceName, forKey: .resourceName)
        try container.encode(error, forKey: .error)
        try container.encode(createdAt, forKey: .createdAt)
        try container.encode(finishedAt, forKey: .finishedAt)
    }
}

/// Used by GET /vps/activity.
public struct ListActivityResponse: Codable, Sendable, Hashable {
    public var activity: [ActivityEntry]

    public init(activity: [ActivityEntry]) {
        self.activity = activity
    }

    enum CodingKeys: String, CodingKey {
        case activity
    }
}

/// Query parameters of `getMetrics`; unset fields are omitted.
public struct GetMetricsQuery: Sendable, Hashable {
    public var type: String?
    public var start: String?
    public var end: String?
    public var step: String?

    public init(type: String? = nil, start: String? = nil, end: String? = nil, step: String? = nil) {
        self.type = type
        self.start = start
        self.end = end
        self.step = step
    }

    /// The items in spec order.
    public var queryItems: [QueryItem] {
        var items: [QueryItem] = []
        if let value = type { items.append(QueryItem("type", value)) }
        if let value = start { items.append(QueryItem("start", value)) }
        if let value = end { items.append(QueryItem("end", value)) }
        if let value = step { items.append(QueryItem("step", value)) }
        return items
    }
}

/// Query parameters of `listActivity`; unset fields are omitted.
public struct ListActivityQuery: Sendable, Hashable {
    public var instanceId: String?

    public init(instanceId: String? = nil) {
        self.instanceId = instanceId
    }

    /// The items in spec order.
    public var queryItems: [QueryItem] {
        var items: [QueryItem] = []
        if let value = instanceId { items.append(QueryItem("instance_id", value)) }
        return items
    }
}

// MARK: - Operations

extension IrdOperation {
    public static let vps_listTiers = IrdOperation(method: .get, pathTemplate: "/vps/tiers", module: "vps", name: "listTiers", security: .keyOrJwt)
    public static let vps_listSystemImages = IrdOperation(method: .get, pathTemplate: "/vps/system-images", module: "vps", name: "listSystemImages", security: .keyOrJwt)
    public static let vps_listSshKeys = IrdOperation(method: .get, pathTemplate: "/vps/ssh-keys", module: "vps", name: "listSshKeys", security: .keyOrJwt)
    public static let vps_addSshKey = IrdOperation(method: .post, pathTemplate: "/vps/ssh-keys", module: "vps", name: "addSshKey", security: .keyOrJwt)
    public static let vps_deleteSshKey = IrdOperation(method: .delete, pathTemplate: "/vps/ssh-keys/{id}", module: "vps", name: "deleteSshKey", security: .keyOrJwt)
    public static let vps_availability = IrdOperation(method: .get, pathTemplate: "/vps/availability", module: "vps", name: "availability", security: .keyOrJwt)
    public static let vps_listInstances = IrdOperation(method: .get, pathTemplate: "/vps/instances", module: "vps", name: "listInstances", security: .keyOrJwt)
    public static let vps_createInstance = IrdOperation(method: .post, pathTemplate: "/vps/instances", module: "vps", name: "createInstance", security: .keyOrJwt)
    public static let vps_appCatalog = IrdOperation(method: .get, pathTemplate: "/vps/apps", module: "vps", name: "appCatalog", security: .keyOrJwt)
    public static let vps_listAppDeployments = IrdOperation(method: .get, pathTemplate: "/vps/apps/deployments", module: "vps", name: "listAppDeployments", security: .keyOrJwt)
    public static let vps_deployApp = IrdOperation(method: .post, pathTemplate: "/vps/apps/deployments", module: "vps", name: "deployApp", security: .keyOrJwt)
    public static let vps_getAppDeployment = IrdOperation(method: .get, pathTemplate: "/vps/apps/deployments/{id}", module: "vps", name: "getAppDeployment", security: .keyOrJwt)
    public static let vps_revealAppPassword = IrdOperation(method: .post, pathTemplate: "/vps/apps/deployments/{id}/reveal-password", module: "vps", name: "revealAppPassword", security: .keyOrJwt)
    public static let vps_getInstance = IrdOperation(method: .get, pathTemplate: "/vps/instances/{id}", module: "vps", name: "getInstance", security: .keyOrJwt)
    public static let vps_destroyInstance = IrdOperation(method: .delete, pathTemplate: "/vps/instances/{id}", module: "vps", name: "destroyInstance", security: .keyOrJwt)
    public static let vps_getMetrics = IrdOperation(method: .get, pathTemplate: "/vps/instances/{id}/metrics", module: "vps", name: "getMetrics", security: .keyOrJwt)
    public static let vps_setQueueNotify = IrdOperation(method: .post, pathTemplate: "/vps/instances/{id}/queue-notify", module: "vps", name: "setQueueNotify", security: .keyOrJwt)
    public static let vps_createSnapshot = IrdOperation(method: .post, pathTemplate: "/vps/instances/{id}/images", module: "vps", name: "createSnapshot", security: .keyOrJwt)
    public static let vps_restart = IrdOperation(method: .post, pathTemplate: "/vps/instances/{id}/restart", module: "vps", name: "restart", security: .keyOrJwt)
    public static let vps_reset = IrdOperation(method: .post, pathTemplate: "/vps/instances/{id}/reset", module: "vps", name: "reset", security: .keyOrJwt)
    public static let vps_shutdown = IrdOperation(method: .post, pathTemplate: "/vps/instances/{id}/shutdown", module: "vps", name: "shutdown", security: .keyOrJwt)
    public static let vps_powerOff = IrdOperation(method: .post, pathTemplate: "/vps/instances/{id}/power-off", module: "vps", name: "powerOff", security: .keyOrJwt)
    public static let vps_powerOn = IrdOperation(method: .post, pathTemplate: "/vps/instances/{id}/power-on", module: "vps", name: "powerOn", security: .keyOrJwt)
    public static let vps_setRdns = IrdOperation(method: .put, pathTemplate: "/vps/instances/{id}/rdns", module: "vps", name: "setRdns", security: .keyOrJwt)
    public static let vps_listInstanceDomains = IrdOperation(method: .get, pathTemplate: "/vps/instances/{id}/domains", module: "vps", name: "listInstanceDomains", security: .keyOrJwt)
    public static let vps_connectDomain = IrdOperation(method: .post, pathTemplate: "/vps/instances/{id}/domains", module: "vps", name: "connectDomain", security: .keyOrJwt)
    public static let vps_disconnectDomain = IrdOperation(method: .delete, pathTemplate: "/vps/instances/{id}/domains/{connection-id}", module: "vps", name: "disconnectDomain", security: .keyOrJwt)
    public static let vps_listVolumes = IrdOperation(method: .get, pathTemplate: "/vps/volumes", module: "vps", name: "listVolumes", security: .keyOrJwt)
    public static let vps_createVolume = IrdOperation(method: .post, pathTemplate: "/vps/volumes", module: "vps", name: "createVolume", security: .keyOrJwt)
    public static let vps_deleteVolume = IrdOperation(method: .delete, pathTemplate: "/vps/volumes/{id}", module: "vps", name: "deleteVolume", security: .keyOrJwt)
    public static let vps_listImages = IrdOperation(method: .get, pathTemplate: "/vps/images", module: "vps", name: "listImages", security: .keyOrJwt)
    public static let vps_deleteImage = IrdOperation(method: .delete, pathTemplate: "/vps/images/{id}", module: "vps", name: "deleteImage", security: .keyOrJwt)
    public static let vps_getAction = IrdOperation(method: .get, pathTemplate: "/vps/actions/{id}", module: "vps", name: "getAction", security: .keyOrJwt)
    public static let vps_listActivity = IrdOperation(method: .get, pathTemplate: "/vps/activity", module: "vps", name: "listActivity", security: .keyOrJwt)

    static let vpsOperations: [IrdOperation] = [.vps_listTiers, .vps_listSystemImages, .vps_listSshKeys, .vps_addSshKey, .vps_deleteSshKey, .vps_availability, .vps_listInstances, .vps_createInstance, .vps_appCatalog, .vps_listAppDeployments, .vps_deployApp, .vps_getAppDeployment, .vps_revealAppPassword, .vps_getInstance, .vps_destroyInstance, .vps_getMetrics, .vps_setQueueNotify, .vps_createSnapshot, .vps_restart, .vps_reset, .vps_shutdown, .vps_powerOff, .vps_powerOn, .vps_setRdns, .vps_listInstanceDomains, .vps_connectDomain, .vps_disconnectDomain, .vps_listVolumes, .vps_createVolume, .vps_deleteVolume, .vps_listImages, .vps_deleteImage, .vps_getAction, .vps_listActivity]
}

/// The `vps` operations (34).
public struct VPSAPI: Sendable {
    let client: IrdClient

    /// VPS tiers
    /// The purchasable server tiers with their hourly credit price (`per_hour`, from the active price book — see GET /credits/prices, contract `recurring.vps-hourly`; null means the tier cannot be ordered right now).
    /// `GET /vps/tiers` — 200
    public func listTiers() async throws -> ListTiersResponse {
        try await client.request(.vps_listTiers)
    }

    /// Bootable system images
    /// The allowlisted operating-system images.
    /// `GET /vps/system-images` — 200
    public func listSystemImages() async throws -> ListSystemImagesResponse {
        try await client.request(.vps_listSystemImages)
    }

    /// List SSH keys
    /// Your registered SSH public keys (public material only — the key body is never returned, just name and MD5 fingerprint). Charged `vps.reads` per request.
    /// `GET /vps/ssh-keys` — 200
    public func listSshKeys() async throws -> ListSshKeysResponse {
        try await client.request(.vps_listSshKeys)
    }

    /// Add an SSH key
    /// Registers an OpenSSH public key (`ssh-ed25519`, `ssh-rsa`, `ecdsa-sha2-*`, or FIDO `sk-*` types) for use at server create. Free.
    /// `POST /vps/ssh-keys` — 201
    public func addSshKey(body: AddSshKeyBody) async throws -> AddSshKeyResponse {
        try await client.request(.vps_addSshKey, body: body)
    }

    /// Delete an SSH key
    /// Removes the key from your account. Existing servers keep the keys they were created with.
    /// `DELETE /vps/ssh-keys/{id}` — 204
    public func deleteSshKey(id: String) async throws {
        try await client.requestNoContent(.vps_deleteSshKey, params: ["id": id])
    }

    /// Tier availability
    /// Whether a create would find capacity right now, per active tier id: our platform capacity gate AND the provider's per-type location availability.
    /// `GET /vps/availability` — 200
    public func availability() async throws -> AvailabilityResponse {
        try await client.request(.vps_availability)
    }

    /// List your servers
    /// Every VPS instance on the account, including deleted ones (history is kept). Charged `vps.reads` per request.
    /// `GET /vps/instances` — 200
    public func listInstances() async throws -> ListInstancesResponse {
        try await client.request(.vps_listInstances)
    }

    /// Create a server
    /// Enqueues a VPS create and answers 202 with the pending instance plus the action to poll (GET /vps/actions/{id}); IPs appear on the instance when it reaches `running`.
    /// `POST /vps/instances` — 202
    public func createInstance(body: CreateInstanceBody) async throws -> InstanceActionResponse {
        try await client.request(.vps_createInstance, body: body)
    }

    /// One-click app catalog
    /// The apps available for one-click deployment onto a dedicated VPS, each with the golden image version new deployments boot and the tier ids meeting its minimums. Charged `vps.reads` per request.
    /// `GET /vps/apps` — 200
    public func appCatalog() async throws -> AppCatalogResponse {
        try await client.request(.vps_appCatalog)
    }

    /// List your app deployments
    /// Every one-click app deployment on the account (deleted ones excluded), joined with the backing server's compute state. Charged `vps.reads` per request.
    /// `GET /vps/apps/deployments` — 200
    public func listAppDeployments() async throws -> ListAppDeploymentsResponse {
        try await client.request(.vps_listAppDeployments)
    }

    /// Deploy an app
    /// One-click app deploy: creates a dedicated VPS from the app's prepared image, points `subdomain`.`zone` at it (an A record in your ird-hosted DNS zone, managed for you and healed if it drifts), and boots the app via cloud-init.
    /// `POST /vps/apps/deployments` — 202
    public func deployApp(body: DeployAppBody) async throws -> DeployAppResponse {
        try await client.request(.vps_deployApp, body: body)
    }

    /// Get an app deployment
    /// The deployment with its backing instance. Destroying the app = destroying the instance (DELETE /vps/instances/{id}) — the managed DNS record is removed with it. Charged `vps.reads` per request.
    /// `GET /vps/apps/deployments/{id}` — 200
    public func getAppDeployment(id: String) async throws -> GetAppDeploymentResponse {
        try await client.request(.vps_getAppDeployment, params: ["id": id])
    }

    /// Reveal an app deployment's root password (once)
    /// The one-time second chance at the root password the deploy response showed — for deploys that queued for capacity and finished after you left.
    /// `POST /vps/apps/deployments/{id}/reveal-password` — 200
    public func revealAppPassword(id: String) async throws -> RevealAppPasswordResponse {
        try await client.request(.vps_revealAppPassword, params: ["id": id])
    }

    /// Get a server
    /// `GET /vps/instances/{id}` — 200
    public func getInstance(id: String) async throws -> GetInstanceResponse {
        try await client.request(.vps_getInstance, params: ["id": id])
    }

    /// Destroy a server
    /// Enqueues the delete and stops the hourly billing once it completes; attached volumes are released (and keep billing) rather than deleted.
    /// `DELETE /vps/instances/{id}` — 202
    public func destroyInstance(id: String) async throws -> InstanceActionResponse {
        try await client.request(.vps_destroyInstance, params: ["id": id])
    }

    /// Server usage metrics
    /// Usage time series for a server.
    /// `GET /vps/instances/{id}/metrics` — 200
    public func getMetrics(id: String, query: GetMetricsQuery = GetMetricsQuery()) async throws -> GetMetricsResponse {
        try await client.request(.vps_getMetrics, params: ["id": id], query: query.queryItems)
    }

    /// Toggle the queued-create outcome email
    /// Turns the outcome email of a queued create on or off: when enabled, you are emailed when the queued server finally provisions or gives up. Only valid while the instance is `queued`. Free.
    /// `POST /vps/instances/{id}/queue-notify` — 200
    public func setQueueNotify(id: String, body: SetQueueNotifyBody) async throws -> InstanceActionResponse {
        try await client.request(.vps_setQueueNotify, params: ["id": id], body: body)
    }

    /// Snapshot a server
    /// Enqueues a snapshot of a running or stopped server.
    /// `POST /vps/instances/{id}/images` — 202
    public func createSnapshot(id: String, body: NameBody) async throws -> ImageActionResponse {
        try await client.request(.vps_createSnapshot, params: ["id": id], body: body)
    }

    /// Restart a server (graceful)
    /// Enqueues a graceful ACPI reboot of a running server.
    /// `POST /vps/instances/{id}/restart` — 202
    public func restart(id: String) async throws -> InstanceActionResponse {
        try await client.request(.vps_restart, params: ["id": id])
    }

    /// Force reset a server (hard)
    /// Enqueues a hard power cycle — like pressing the reset button: the OS gets no warning and unsaved data is lost.
    /// `POST /vps/instances/{id}/reset` — 202
    public func reset(id: String) async throws -> InstanceActionResponse {
        try await client.request(.vps_reset, params: ["id": id])
    }

    /// Shut down a server (graceful)
    /// Enqueues a graceful ACPI shutdown.
    /// `POST /vps/instances/{id}/shutdown` — 202
    public func shutdown(id: String) async throws -> InstanceActionResponse {
        try await client.request(.vps_shutdown, params: ["id": id])
    }

    /// Force power off a server (hard)
    /// Enqueues an immediate power cut — like pulling the plug: unsaved data is lost.
    /// `POST /vps/instances/{id}/power-off` — 202
    public func powerOff(id: String) async throws -> InstanceActionResponse {
        try await client.request(.vps_powerOff, params: ["id": id])
    }

    /// Power on a stopped server
    /// Enqueues power-on for a `stopped` server; it boots with its IPs, disk, and mounted volumes intact and returns to `running`. Charged the `vps.power` per-request price (0 at launch).
    /// `POST /vps/instances/{id}/power-on` — 202
    public func powerOn(id: String) async throws -> InstanceActionResponse {
        try await client.request(.vps_powerOn, params: ["id": id])
    }

    /// Set a server's reverse DNS (PTR)
    /// Enqueues a reverse DNS pointer change for one of the server's IPs: `ip` must be the server's IPv4 address or any address inside its IPv6 /64.
    /// `PUT /vps/instances/{id}/rdns` — 202
    public func setRdns(id: String, body: SetRdnsBody) async throws -> InstanceActionResponse {
        try await client.request(.vps_setRdns, params: ["id": id], body: body)
    }

    /// List a server's connected domains
    /// The domains connected to this server: each maintains managed A/AAAA records in your ird-hosted zone pointing the hostname at the server, and at most one (`rdns: true`) also drives the server's reverse DNS pointer — the forward-confirmed pair (FCrDNS) mail providers check.
    /// `GET /vps/instances/{id}/domains` — 200
    public func listInstanceDomains(id: String) async throws -> ListInstanceDomainsResponse {
        try await client.request(.vps_listInstanceDomains, params: ["id": id])
    }

    /// Connect a domain to a server
    /// Points a subdomain of one of your ird-hosted zones at this server: A (and AAAA when the server has IPv6) records are written into your zone immediately, and — unless `set_rdns` is false — the server's reverse DNS pointer is set to the same…
    /// `POST /vps/instances/{id}/domains` — 202
    public func connectDomain(id: String, body: ConnectDomainBody) async throws -> ConnectDomainResponse {
        try await client.request(.vps_connectDomain, params: ["id": id], body: body)
    }

    /// Disconnect a domain from a server
    /// Releases the connection: the managed A/AAAA records are removed from your zone (only if every value still targets this server — hand-made records survive), and when this connection was driving the server's reverse DNS pointer, a reset to th…
    /// `DELETE /vps/instances/{id}/domains/{connection-id}` — 200
    public func disconnectDomain(id: String, connectionId: String) async throws -> DisconnectDomainResponse {
        try await client.request(.vps_disconnectDomain, params: ["id": id, "connection-id": connectionId])
    }

    /// List your volumes
    /// Every block-storage volume on the account, including deleted ones. Charged `vps.reads` per request.
    /// `GET /vps/volumes` — 200
    public func listVolumes() async throws -> ListVolumesResponse {
        try await client.request(.vps_listVolumes)
    }

    /// Create a volume
    /// Enqueues a block-storage volume create (10–10240 GB by default).
    /// `POST /vps/volumes` — 202
    public func createVolume(body: CreateVolumeBody) async throws -> VolumeActionResponse {
        try await client.request(.vps_createVolume, body: body)
    }

    /// Delete a volume
    /// Enqueues the delete for an unattached volume and stops its hourly billing once it completes; the data is gone permanently. Attached volumes cannot be deleted — destroy their server first. Idempotent while a delete is open.
    /// `DELETE /vps/volumes/{id}` — 202
    public func deleteVolume(id: String) async throws -> VolumeActionResponse {
        try await client.request(.vps_deleteVolume, params: ["id": id])
    }

    /// List your snapshots
    /// Every snapshot on the account, including deleted ones. `create_ref` is the `image_ref` value that boots a new server from the snapshot. Charged `vps.reads` per request.
    /// `GET /vps/images` — 200
    public func listImages() async throws -> ListImagesResponse {
        try await client.request(.vps_listImages)
    }

    /// Delete a snapshot
    /// Enqueues the delete and stops the snapshot's hourly billing once it completes.
    /// `DELETE /vps/images/{id}` — 202
    public func deleteImage(id: String) async throws -> ImageActionResponse {
        try await client.request(.vps_deleteImage, params: ["id": id])
    }

    /// Poll a VPS action
    /// Terminal states: `succeeded`, `failed` (a prepaid first-hour charge is refunded), `cancelled`. Everything else means the provider is still being worked — keep polling. Charged `vps.reads` per request.
    /// `GET /vps/actions/{id}` — 200
    public func getAction(id: String) async throws -> GetActionResponse {
        try await client.request(.vps_getAction, params: ["id": id])
    }

    /// Infrastructure activity timeline
    /// The account's most recent VPS actions (up to 100), newest first, with the affected resource's name and who initiated each: `customer` (you), `grace` (automatic destroy after the billing grace window lapsed), or `admin`.
    /// `GET /vps/activity` — 200
    public func listActivity(query: ListActivityQuery = ListActivityQuery()) async throws -> ListActivityResponse {
        try await client.request(.vps_listActivity, query: query.queryItems)
    }
}

extension IrdClient {
    public var vps: VPSAPI { VPSAPI(client: self) }
}

static mirror of HEAD · about · clone: git clone https://ird.cod-sursa.ro/api-swift.git