@leaflow/sdk 0.53.0 → 0.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -82,7 +82,10 @@ export interface paths {
82
82
  path?: never;
83
83
  cookie?: never;
84
84
  };
85
- /** List disk types on sale */
85
+ /**
86
+ * List disk types on sale
87
+ * @description Only disk types currently on sale are listed. A withdrawn one disappears from here and can no longer be bought, while the disks already on it keep working and can still be resized.
88
+ */
86
89
  get: operations["list-disk-types"];
87
90
  put?: never;
88
91
  post?: never;
@@ -102,6 +105,8 @@ export interface paths {
102
105
  /**
103
106
  * List images on sale
104
107
  * @description An image whose `min_ram_mb` exceeds the memory of the selected instance type cannot boot. Filter the options accordingly.
108
+ *
109
+ * Only images currently on sale are listed. An image the platform withdraws disappears from here and can no longer install new instances, while the instances already running it keep running and can still be rebuilt onto it.
105
110
  */
106
111
  get: operations["list-images"];
107
112
  put?: never;
@@ -119,7 +124,10 @@ export interface paths {
119
124
  path?: never;
120
125
  cookie?: never;
121
126
  };
122
- /** List instance types on sale */
127
+ /**
128
+ * List instance types on sale
129
+ * @description Only instance types currently on sale are listed. A withdrawn one disappears from here and can no longer be ordered, while the instances already running it keep running.
130
+ */
123
131
  get: operations["list-instance-types"];
124
132
  put?: never;
125
133
  post?: never;
@@ -182,6 +190,8 @@ export interface paths {
182
190
  /**
183
191
  * Create a disk
184
192
  * @description The disk is created in the availability zone of the selected disk type, and an instance must reside in the same zone to attach it. Choosing the disk type therefore determines the zone.
193
+ *
194
+ * A disk type that has been withdrawn is rejected with `DISK_TYPE_RETIRED`, even though its identifier still resolves. Withdrawn types stop appearing in the disk type listing; disks already bought on one keep working and can still be resized.
185
195
  */
186
196
  post: operations["create-disk"];
187
197
  delete?: never;
@@ -370,6 +380,8 @@ export interface paths {
370
380
  *
371
381
  * Exactly one source must be given: `image_id` for a platform image, `private_image_id` for a private image, or `boot_disk_id` to boot a disk you already have. Supplying more than one, or none, is rejected.
372
382
  *
383
+ * A platform image that has been withdrawn is rejected with `IMAGE_RETIRED`, and an instance type that has been withdrawn with `INSTANCE_TYPE_RETIRED` — in both cases the identifier still resolves. Withdrawn entries stop appearing in their listing, so an identifier held in a script, a template or an earlier order is the way this is usually hit: reread the listing and pick another. Instances already running either are unaffected, and one on a withdrawn image can still be rebuilt onto it.
384
+ *
373
385
  * `boot_disk_id` recovers an instance that can no longer be repaired from the inside. Snapshot its disk, restore that snapshot into a new disk, attach the new disk to another instance and repair it there, then create an instance from it. That disk is not deleted when the instance is released; it is detached and returned to you.
374
386
  *
375
387
  * Instances are created in the availability zone of the instance type. Disks to be attached later must reside in the same zone.
@@ -605,6 +617,8 @@ export interface paths {
605
617
  /**
606
618
  * Rebuild an instance
607
619
  * @description **All data on the system disk is erased and cannot be recovered.** Attached data disks are unaffected.
620
+ *
621
+ * The image this instance already runs is accepted even after the platform has withdrawn it, since rebuilding is the only way back into an instance broken from the inside. Any *other* withdrawn image is rejected with `IMAGE_RETIRED`, which is a change of image and therefore a new order.
608
622
  */
609
623
  post: operations["rebuild-instance"];
610
624
  delete?: never;
@@ -1310,7 +1324,7 @@ export interface components {
1310
1324
  RestoreBackupRequestBody: {
1311
1325
  /**
1312
1326
  * Format: uuid
1313
- * @description May differ from the availability zone of the source disk, but must be in the same region
1327
+ * @description May differ from the availability zone of the source disk, but must be in the same region. It has to be on sale — restoring creates a new disk, so a withdrawn type is rejected here as well
1314
1328
  */
1315
1329
  disk_type_id: string;
1316
1330
  name: string;
@@ -1340,6 +1354,17 @@ export interface components {
1340
1354
  size_gb: number;
1341
1355
  /** @enum {string} */
1342
1356
  status: "provisioning" | "available" | "attaching" | "in_use" | "detaching" | "resizing" | "reverting" | "restoring" | "releasing" | "deleting" | "error";
1357
+ /**
1358
+ * @description How this disk is paid for. `postpaid` is billed by the hour for as long as it exists;
1359
+ * `prepaid` was bought outright for a term.
1360
+ *
1361
+ * **Not the term.** How long it was bought for belongs to the order, not to the disk:
1362
+ * renewing can change it, and a machine bought for a year and then renewed for a month is
1363
+ * still a prepaid machine. Ask billing for the term and the expiry — they live there, and
1364
+ * they are the only two values a renewal moves.
1365
+ * @enum {string}
1366
+ */
1367
+ charge_type: "postpaid" | "prepaid";
1343
1368
  };
1344
1369
  DiskTypeResource: {
1345
1370
  availability_zone_code: string;
@@ -1357,6 +1382,48 @@ export interface components {
1357
1382
  /** Format: int64 */
1358
1383
  step_gb: number;
1359
1384
  throughput_display: string;
1385
+ /**
1386
+ * @description Whether any capacity is left in this type's pool.
1387
+ *
1388
+ * The same shape as on an instance type, but it answers less here: a disk is sold by the
1389
+ * GiB, so "not sold out" does not mean the size being asked for fits. `remaining` is the
1390
+ * field that decides that, and this one only says whether the pool is empty outright.
1391
+ *
1392
+ * It reflects a limit set by operations, not what the storage backend physically has —
1393
+ * raising the limit does not create capacity, and a type that is not sold out can still fail
1394
+ * to create if the backend is full.
1395
+ *
1396
+ * Advisory: it is read when the list is built, and capacity can be taken between that read
1397
+ * and the order. The order is what actually refuses.
1398
+ */
1399
+ sold_out: boolean;
1400
+ /**
1401
+ * Format: int64
1402
+ * @description How much capacity is left, **in GiB**. Absent when this type is not limited at all.
1403
+ *
1404
+ * Unlike an instance type, where this is a count of machines, here it is an amount of
1405
+ * storage — and it is the number that bounds the size a customer may ask for. A picker that
1406
+ * offers sizes above it produces orders that are refused after the customer has chosen
1407
+ * everything else.
1408
+ *
1409
+ * Absent is not zero and not "unknown": a type with no limit simply has no number to show.
1410
+ * Reporting it as a number would need a sentinel, and any sentinel eventually gets compared
1411
+ * against a real size.
1412
+ */
1413
+ remaining?: number;
1414
+ /**
1415
+ * @description What buying this type outright costs, per term. Empty means this type is only sold by the
1416
+ * hour.
1417
+ *
1418
+ * **The amount is per GiB for the whole term**, not the price of one disk: a disk's size is
1419
+ * chosen by the customer, so the total is this figure times the size. That differs from an
1420
+ * instance type, where the same field is the price of one machine — the unit follows what
1421
+ * the product is sold by, and the order is priced the same way.
1422
+ *
1423
+ * Advisory, like `sold_out`: it is read when the list is built. The order is what fixes the
1424
+ * price, and it refuses rather than falling back to hourly if the term is not sold.
1425
+ */
1426
+ prepaid_prices?: components["schemas"]["PrepaidPrice"][];
1360
1427
  };
1361
1428
  DiskTypeListResponseBody: {
1362
1429
  items: components["schemas"]["DiskTypeResource"][] | null;
@@ -1467,7 +1534,34 @@ export interface components {
1467
1534
  items: components["schemas"]["DiskResource"][] | null;
1468
1535
  };
1469
1536
  CreateDiskRequestBody: {
1470
- /** Format: uuid */
1537
+ /**
1538
+ * @description A promotion code to apply to this order. Case and surrounding whitespace do not matter.
1539
+ *
1540
+ * An unusable code is rejected outright rather than quietly ignored: somebody who typed a
1541
+ * code is buying at the discounted price, and letting it through silently means they pay
1542
+ * full price expecting the discount, with nothing anywhere saying so.
1543
+ *
1544
+ * The discount applies to the lines the campaign covers, not the whole order — typically
1545
+ * the instance type and memory, not the system disk, the address, or traffic. Preview it
1546
+ * first at `POST /account/v1/billing-accounts/{accountKey}/promotion-codes/preview` to
1547
+ * show the customer what will actually be charged.
1548
+ *
1549
+ * Metered orders reject any code: there is no amount to discount at this point.
1550
+ */
1551
+ promotion_code?: string;
1552
+ /**
1553
+ * @description "This is the same click". Generate one when the dialog opens — not when it is submitted —
1554
+ * and send the same one on every retry of that action.
1555
+ *
1556
+ * Optional, and what happens without it is worth knowing: two identical requests inside the
1557
+ * same minute are treated as one, because there is nothing else to tell a double-click apart
1558
+ * from a deliberate second order. Sending your own key removes that guess entirely.
1559
+ */
1560
+ idempotency_key?: string;
1561
+ /**
1562
+ * Format: uuid
1563
+ * @description A disk type currently on sale. A withdrawn one is rejected even though its identifier still resolves
1564
+ */
1471
1565
  disk_type_id: string;
1472
1566
  name: string;
1473
1567
  /** Format: int64 */
@@ -1545,6 +1639,18 @@ export interface components {
1545
1639
  AllocateFloatingIPRequestBody: {
1546
1640
  /** @description The address to allocate. Allocated by the platform when omitted */
1547
1641
  address?: string;
1642
+ /**
1643
+ * Format: int64
1644
+ * @description The bandwidth ceiling of this address, in Mbit/s, applied to both directions.
1645
+ *
1646
+ * Required, and there is no "unlimited": an address with no ceiling runs at line rate and is
1647
+ * charged nothing for the traffic, while the address itself bills normally — so the invoice
1648
+ * looks correct and nothing anywhere reports it.
1649
+ *
1650
+ * It is billed separately from the address, per Mbit/s-hour, and appears as its own line on
1651
+ * the order. Changing it later goes through the bandwidth endpoint.
1652
+ */
1653
+ bandwidth_mbps: number;
1548
1654
  /** Format: uuid */
1549
1655
  private_network_id: string;
1550
1656
  };
@@ -1628,11 +1734,100 @@ export interface components {
1628
1734
  suspended_at: string | null;
1629
1735
  /** Format: date-time */
1630
1736
  updated_at: string;
1737
+ /**
1738
+ * @description How this instance is paid for. `postpaid` is billed by the hour for as long as it exists;
1739
+ * `prepaid` was bought outright for a term.
1740
+ *
1741
+ * **Not the term.** How long it was bought for belongs to the order, not to the instance:
1742
+ * renewing can change it, and a machine bought for a year and then renewed for a month is
1743
+ * still a prepaid machine. Ask billing for the term and the expiry — they live there, and
1744
+ * they are the only two values a renewal moves.
1745
+ * @enum {string}
1746
+ */
1747
+ charge_type: "postpaid" | "prepaid";
1748
+ /**
1749
+ * @description The order this instance was bought under, in billing's own identifiers. Empty when the
1750
+ * deployment has no billing wired in.
1751
+ *
1752
+ * Kept so the question can be answered later. "Why was I charged for this" is asked days
1753
+ * after the fact, and an order id handed back only in the launch response is one the
1754
+ * person who needs it never had.
1755
+ */
1756
+ billing_order_id: string;
1631
1757
  };
1632
1758
  InstanceListResponseBody: {
1633
1759
  items: components["schemas"]["InstanceResource"][] | null;
1634
1760
  };
1635
1761
  LaunchInstanceRequestBody: {
1762
+ /**
1763
+ * @description A promotion code to apply to this order. Case and surrounding whitespace do not matter.
1764
+ *
1765
+ * An unusable code is rejected outright rather than quietly ignored: somebody who typed a
1766
+ * code is buying at the discounted price, and letting it through silently means they pay
1767
+ * full price expecting the discount, with nothing anywhere saying so.
1768
+ *
1769
+ * The discount applies to the lines the campaign covers, not the whole order — typically
1770
+ * the instance type and memory, not the system disk, the address, or traffic. Preview it
1771
+ * first at `POST /account/v1/billing-accounts/{accountKey}/promotion-codes/preview` to
1772
+ * show the customer what will actually be charged.
1773
+ *
1774
+ * Metered orders reject any code: there is no amount to discount at this point.
1775
+ */
1776
+ promotion_code?: string;
1777
+ /**
1778
+ * @description "This is the same click". Generate one when the dialog opens — not when it is submitted —
1779
+ * and send the same one on every retry of that action.
1780
+ *
1781
+ * Optional, and what happens without it is worth knowing: two identical requests inside the
1782
+ * same minute are treated as one, because there is nothing else to tell a double-click apart
1783
+ * from a deliberate second order. Sending your own key removes that guess entirely.
1784
+ */
1785
+ idempotency_key?: string;
1786
+ /**
1787
+ * Format: uuid
1788
+ * @description Bind a floating IP you already hold, instead of allocating a new one. It must be idle and in
1789
+ * the same region.
1790
+ *
1791
+ * Mutually exclusive with `bandwidth_mbps`: an address you already hold has its own bandwidth
1792
+ * ceiling, set when it was allocated, and changing it is a separate operation.
1793
+ *
1794
+ * Like `bandwidth_mbps`, this happens **inside the creation**: if binding fails, no instance is
1795
+ * created. Binding afterwards is still possible from the instance page, but then it is two
1796
+ * operations and a failure in between leaves an instance you cannot reach.
1797
+ *
1798
+ * Only one instance can be created when it is used — one address binds to one interface.
1799
+ */
1800
+ floating_ip_id?: string;
1801
+ /**
1802
+ * Format: int64
1803
+ * @description Give this instance a public address with this much bandwidth, in Mbit/s. Omitted or 0 means
1804
+ * no public address.
1805
+ *
1806
+ * Mutually exclusive with `floating_ip_id`, which binds one you already hold.
1807
+ *
1808
+ * The bandwidth is what says whether an address is wanted, rather than a separate flag,
1809
+ * because an address with no ceiling would run at line rate and be charged nothing for the
1810
+ * traffic — while the address itself bills normally and the invoice looks correct.
1811
+ *
1812
+ * The address and its bandwidth are two lines on the same order as the instance and its
1813
+ * system disk — one purchase with one total — and everything is created together or not at
1814
+ * all: if any step fails, the address goes back to the pool and no instance is created.
1815
+ * Asking for an address separately afterwards is still possible, but then they are separate
1816
+ * purchases, and a failure in between leaves an instance you cannot reach.
1817
+ *
1818
+ * Both lines are always billed by the hour, even when the instance is bought outright for a
1819
+ * term: a public IPv4 is a scarce resource the platform keeps holding for as long as you have
1820
+ * it, so it is not something that can be paid for once.
1821
+ *
1822
+ * Which address you get is not a choice here. Use the floating IP endpoints to claim a
1823
+ * particular address and bind it, which is what getting a known address back after a
1824
+ * migration needs.
1825
+ *
1826
+ * Rejected together with `port_id` when that interface already has a floating IP: an
1827
+ * interface carries one IPv4, and one IPv4 takes one floating IP. Attach another interface to
1828
+ * hold a second address.
1829
+ */
1830
+ bandwidth_mbps?: number;
1636
1831
  /**
1637
1832
  * Format: int64
1638
1833
  * @description Number of instances to create; 1 when omitted. Names are numbered automatically for several
@@ -1647,10 +1842,13 @@ export interface components {
1647
1842
  boot_disk_id?: string;
1648
1843
  /**
1649
1844
  * Format: uuid
1650
- * @description A platform image. Exactly one of this, `private_image_id` and `boot_disk_id`
1845
+ * @description A platform image, and it must be one currently on sale. Exactly one of this, `private_image_id` and `boot_disk_id`
1651
1846
  */
1652
1847
  image_id?: string;
1653
- /** Format: uuid */
1848
+ /**
1849
+ * Format: uuid
1850
+ * @description An instance type currently on sale. A withdrawn one is rejected even though its identifier still resolves
1851
+ */
1654
1852
  instance_type_id: string;
1655
1853
  /** @description The account the disk lets you log in as. Required with `boot_disk_id`, and rejected without it since an image states its own */
1656
1854
  login_username?: string;
@@ -1692,9 +1890,13 @@ export interface components {
1692
1890
  * refused — it is never quietly sold by the hour instead, because the customer who asked for
1693
1891
  * a year would find out only from the bill.
1694
1892
  *
1695
- * The system disk is bought for the same term: it is the same purchase, and one order cannot
1696
- * be half outright and half hourly. A term is therefore refused together with `boot_disk_id`,
1697
- * where the disk already exists and is already billed its own way.
1893
+ * The system disk is bought for the same term, because it is the same purchase: an instance
1894
+ * bought for a year whose disk is billed hourly is a bill nobody would predict from what they
1895
+ * clicked. A term is therefore refused together with `boot_disk_id`, where the disk already
1896
+ * exists and is already billed its own way.
1897
+ *
1898
+ * A public address asked for with `assign_public_ip` stays hourly regardless — it cannot be
1899
+ * bought outright — so one order can carry both.
1698
1900
  *
1699
1901
  * When the term runs out the instance is stopped, not deleted, and starts again once it is
1700
1902
  * renewed. Renewal lives in the billing console, across every product, because what a
@@ -1715,6 +1917,23 @@ export interface components {
1715
1917
  subnet_id?: string;
1716
1918
  };
1717
1919
  LaunchInstanceResponseBody: {
1920
+ /**
1921
+ * @description The orders these instances were bought under, in the same order as `instances`.
1922
+ *
1923
+ * **One per instance, not one per request.** A batch of three places three orders, because
1924
+ * each machine is ordered as it is created — stopping halfway leaves the machines already
1925
+ * made, and they each have to be paid for. A caller showing "your order" for a batch has to
1926
+ * show all of them.
1927
+ *
1928
+ * Empty when the deployment has no billing wired in, and on the `checkout_url` branch where
1929
+ * nothing was created yet.
1930
+ *
1931
+ * Given so the caller can point at the transaction. Creating a resource takes money — by
1932
+ * the hour from that moment for a metered one, in full from the balance for a prepaid one —
1933
+ * and until now the only thing handed back was the resource itself. Somebody asking "why
1934
+ * was I charged" had nothing to open.
1935
+ */
1936
+ order_ids?: string[] | null;
1718
1937
  /** @description Non-empty when only some of the instances were created, stating why the sequence stopped */
1719
1938
  failure: string | null;
1720
1939
  /** @description Returned in request order; an array even for a single instance */
@@ -1792,7 +2011,7 @@ export interface components {
1792
2011
  generate_password?: boolean;
1793
2012
  /**
1794
2013
  * Format: uuid
1795
- * @description A platform image. Exactly one of this and `private_image_id`
2014
+ * @description A platform image, which must be on sale unless it is the one this instance already runs. Exactly one of this and `private_image_id`
1796
2015
  */
1797
2016
  image_id?: string;
1798
2017
  password?: string;
@@ -444,11 +444,6 @@ export interface components {
444
444
  /** Format: uuid */
445
445
  id: string;
446
446
  name: string;
447
- /**
448
- * Format: date-time
449
- * @description 欠费的起始时间
450
- */
451
- overdue_at: string | null;
452
447
  /** @enum {string} */
453
448
  status: "ACTIVE" | "SUSPENDED" | "BANNED" | "DELETING" | "DELETED";
454
449
  /** @description 给人看的,不参与任何查询 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.53.0",
3
+ "version": "0.54.0",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {