@distilled.cloud/fly-io 1.0.0-rc.12 → 1.0.0-rc.13

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.
@@ -19,6 +19,20 @@ import * as Retry from "../retry.ts";
19
19
 
20
20
  export type { FlyIoOpError, FlyIoOpContext };
21
21
 
22
+ export class MachineReplacing
23
+ extends /*@__PURE__*/ T.applyErrorMatchers(
24
+ /*@__PURE__*/ S.TaggedError<MachineReplacing>()("MachineReplacing", {
25
+ message: S.String,
26
+ }),
27
+ [
28
+ {
29
+ status: 412,
30
+ message:
31
+ "failed_precondition: machine getting replaced, refusing to start",
32
+ },
33
+ ],
34
+ ) {}
35
+
22
36
  export class MachineStartFromCreatedState
23
37
  extends /*@__PURE__*/ T.applyErrorMatchers(
24
38
  /*@__PURE__*/ S.TaggedError<MachineStartFromCreatedState>()(
@@ -50,6 +64,29 @@ export class MachineWaitTimeout
50
64
  ],
51
65
  ) {}
52
66
 
67
+ export class NetworkNotFound
68
+ extends /*@__PURE__*/ T.applyErrorMatchers(
69
+ /*@__PURE__*/ S.TaggedError<NetworkNotFound>()("NetworkNotFound", {
70
+ message: S.String,
71
+ }),
72
+ [{ status: 400, message: { includes: "network not found" } }],
73
+ ) {}
74
+
75
+ export class VolumeAttached
76
+ extends /*@__PURE__*/ T.applyErrorMatchers(
77
+ /*@__PURE__*/ S.TaggedError<VolumeAttached>()("VolumeAttached", {
78
+ message: S.String,
79
+ }),
80
+ [
81
+ {
82
+ message: {
83
+ includes:
84
+ "failed_precondition: volume is currently bound to machine:",
85
+ },
86
+ },
87
+ ],
88
+ ) {}
89
+
53
90
  export interface AuthenticateTokenRequest {
54
91
  header?: string;
55
92
  }
@@ -510,11 +547,13 @@ export interface CordonMachineRequest {
510
547
  app_name: string;
511
548
  /** Machine ID */
512
549
  machine_id: string;
550
+ lease_nonce?: string;
513
551
  }
514
552
  export const CordonMachineRequest = /*@__PURE__*/ S.suspend(() =>
515
553
  S.Struct({
516
554
  app_name: S.String.pipe(T.Label()),
517
555
  machine_id: S.String.pipe(T.Label()),
556
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
518
557
  }).pipe(
519
558
  T.Http({
520
559
  method: "POST",
@@ -535,6 +574,8 @@ export const CordonMachineResponse = /*@__PURE__*/ S.suspend(() =>
535
574
 
536
575
  export interface CreateAppRequest {
537
576
  enable_subdomains?: boolean;
577
+ /** When set, makes a retry of this exact request safe: a second create with the same key and the same name (or no name) returns the app the first request created, instead of erroring on a false name conflict or creating a duplicate. A second create with the same key but a *different* name is rejected outright; it won't silently hand back the first app. */
578
+ idempotency_key?: string;
538
579
  name?: string;
539
580
  network?: string;
540
581
  org_slug?: string;
@@ -542,6 +583,7 @@ export interface CreateAppRequest {
542
583
  export const CreateAppRequest = /*@__PURE__*/ S.suspend(() =>
543
584
  S.Struct({
544
585
  enable_subdomains: S.optional(S.Boolean),
586
+ idempotency_key: S.optional(S.String),
545
587
  name: S.optional(S.String),
546
588
  network: S.optional(S.String),
547
589
  org_slug: S.optional(S.String),
@@ -550,9 +592,15 @@ export const CreateAppRequest = /*@__PURE__*/ S.suspend(() =>
550
592
  identifier: "CreateAppRequest",
551
593
  }) as any as S.Schema<CreateAppRequest>;
552
594
 
553
- export interface CreateAppResponse {}
595
+ export interface CreateAppResponse {
596
+ created_at?: number;
597
+ id?: string;
598
+ }
554
599
  export const CreateAppResponse = /*@__PURE__*/ S.suspend(() =>
555
- S.Struct({}),
600
+ S.Struct({
601
+ created_at: S.optional(S.Number),
602
+ id: S.optional(S.String),
603
+ }),
556
604
  ).annotate({
557
605
  identifier: "CreateAppResponse",
558
606
  }) as any as S.Schema<CreateAppResponse>;
@@ -722,12 +770,28 @@ export const IPPair = /*@__PURE__*/ S.suspend(() =>
722
770
  }),
723
771
  ).annotate({ identifier: "IPPair" }) as any as S.Schema<IPPair>;
724
772
 
773
+ /** The 6PN network a Flycast (private_v6) address belongs to. Null for all other IP types. */
774
+ export interface IPAssignmentNetwork {
775
+ /** Network name; empty for the organization's default network. */
776
+ name?: string;
777
+ org_slug?: string;
778
+ }
779
+ export const IPAssignmentNetwork = /*@__PURE__*/ S.suspend(() =>
780
+ S.Struct({
781
+ name: S.optional(S.String),
782
+ org_slug: S.optional(S.String),
783
+ }),
784
+ ).annotate({
785
+ identifier: "IPAssignmentNetwork",
786
+ }) as any as S.Schema<IPAssignmentNetwork>;
787
+
725
788
  export interface AssignIPResponse {
726
789
  created_at?: string;
727
790
  egress?: boolean;
728
791
  ip?: string;
729
792
  /** ip_pair is returned when "egress-pair" IP type is requested; in this case, ip is null. */
730
793
  ip_pair?: IPPair;
794
+ network?: IPAssignmentNetwork | null;
731
795
  region?: string;
732
796
  service_name?: string;
733
797
  shared?: boolean;
@@ -738,6 +802,7 @@ export const AssignIPResponse = /*@__PURE__*/ S.suspend(() =>
738
802
  egress: S.optional(S.Boolean),
739
803
  ip: S.optional(S.String),
740
804
  ip_pair: S.optional(IPPair),
805
+ network: S.optional(S.NullOr(IPAssignmentNetwork)),
741
806
  region: S.optional(S.String),
742
807
  service_name: S.optional(S.String),
743
808
  shared: S.optional(S.Boolean),
@@ -1070,26 +1135,19 @@ export const FlyContainerConfigHealthchecksList = /*@__PURE__*/ S.Array(
1070
1135
  FlyContainerHealthcheck,
1071
1136
  ) as any as S.Schema<FlyContainerConfigHealthchecksList>;
1072
1137
 
1073
- /** * no - Never try to restart a Machine automatically when its main process exits, whether that’s on purpose or on a crash. * always - Always restart a Machine automatically and never let it enter a stopped state, even when the main process exits cleanly. * on-failure - Try up to MaxRetries times to automatically restart the Machine if it exits with a non-zero exit code. Default when no explicit policy is set, and for Machines with schedules. * spot-price - Starts the Machine only when there is capacity and the spot price is less than or equal to the bid price. */
1074
- export type FlyMachineRestartPolicy =
1075
- | "no"
1076
- | "always"
1077
- | "on-failure"
1078
- | "spot-price";
1138
+ /** * no - Never try to restart a Machine automatically when its main process exits, whether that’s on purpose or on a crash. * always - Always restart a Machine automatically and never let it enter a stopped state, even when the main process exits cleanly. * on-failure - Try up to MaxRetries times to automatically restart the Machine if it exits with a non-zero exit code. Default when no explicit policy is set, and for Machines with schedules. */
1139
+ export type FlyMachineRestartPolicy = "no" | "always" | "on-failure";
1079
1140
  export const FlyMachineRestartPolicy = S.String;
1080
1141
 
1081
1142
  /** The Machine restart policy defines whether and how flyd restarts a Machine after its main process exits. See https://fly.io/docs/machines/guides-examples/machine-restart-policy/. */
1082
1143
  export interface FlyMachineRestart {
1083
- /** GPU bid price for spot Machines. */
1084
- gpu_bid_price?: number;
1085
1144
  /** When policy is on-failure, the maximum number of times to attempt to restart the Machine before letting it stop. */
1086
1145
  max_retries?: number;
1087
- /** * no - Never try to restart a Machine automatically when its main process exits, whether that’s on purpose or on a crash. * always - Always restart a Machine automatically and never let it enter a stopped state, even when the main process exits cleanly. * on-failure - Try up to MaxRetries times to automatically restart the Machine if it exits with a non-zero exit code. Default when no explicit policy is set, and for Machines with schedules. * spot-price - Starts the Machine only when there is capacity and the spot price is less than or equal to the bid price. */
1146
+ /** * no - Never try to restart a Machine automatically when its main process exits, whether that’s on purpose or on a crash. * always - Always restart a Machine automatically and never let it enter a stopped state, even when the main process exits cleanly. * on-failure - Try up to MaxRetries times to automatically restart the Machine if it exits with a non-zero exit code. Default when no explicit policy is set, and for Machines with schedules. */
1088
1147
  policy?: FlyMachineRestartPolicy | (string & {});
1089
1148
  }
1090
1149
  export const FlyMachineRestart = /*@__PURE__*/ S.suspend(() =>
1091
1150
  S.Struct({
1092
- gpu_bid_price: S.optional(S.Number),
1093
1151
  max_retries: S.optional(S.Number),
1094
1152
  policy: S.optional(FlyMachineRestartPolicy),
1095
1153
  }),
@@ -1161,7 +1219,7 @@ export interface FlyContainerConfig {
1161
1219
  image?: string;
1162
1220
  /** Name is used to identify the container in the machine. */
1163
1221
  name?: string;
1164
- /** Restart is used to define the restart policy for the container. NOTE: spot-price is not supported for containers. */
1222
+ /** Restart is used to define the restart policy for the container. */
1165
1223
  restart?: FlyMachineRestart;
1166
1224
  /** Secrets can be provided at the process level to explicitly indicate which secrets should be used for the process. If not provided, the secrets provided at the machine level will be used. */
1167
1225
  secrets?: FlyContainerConfigSecretsList;
@@ -1283,6 +1341,11 @@ export const FlyMachineGuestKernelArgsList = /*@__PURE__*/ S.Array(
1283
1341
  export type FlyMachineGuestPersistRootfs = "never" | "always" | "restart";
1284
1342
  export const FlyMachineGuestPersistRootfs = S.String;
1285
1343
 
1344
+ export type FlyMachineGuestRequiredHostFeaturesList = Array<string>;
1345
+ export const FlyMachineGuestRequiredHostFeaturesList = /*@__PURE__*/ S.Array(
1346
+ S.String,
1347
+ ) as any as S.Schema<FlyMachineGuestRequiredHostFeaturesList>;
1348
+
1286
1349
  export interface FlyMachineGuest {
1287
1350
  cpu_kind?: string;
1288
1351
  cpus?: number;
@@ -1294,6 +1357,7 @@ export interface FlyMachineGuest {
1294
1357
  memory_mb?: number;
1295
1358
  /** Deprecated: use MachineConfig.Rootfs instead */
1296
1359
  persist_rootfs?: FlyMachineGuestPersistRootfs | (string & {});
1360
+ required_host_features?: FlyMachineGuestRequiredHostFeaturesList;
1297
1361
  }
1298
1362
  export const FlyMachineGuest = /*@__PURE__*/ S.suspend(() =>
1299
1363
  S.Struct({
@@ -1306,6 +1370,7 @@ export const FlyMachineGuest = /*@__PURE__*/ S.suspend(() =>
1306
1370
  max_memory_mb: S.optional(S.Number),
1307
1371
  memory_mb: S.optional(S.Number),
1308
1372
  persist_rootfs: S.optional(FlyMachineGuestPersistRootfs),
1373
+ required_host_features: S.optional(FlyMachineGuestRequiredHostFeaturesList),
1309
1374
  }),
1310
1375
  ).annotate({
1311
1376
  identifier: "FlyMachineGuest",
@@ -1373,8 +1438,12 @@ export const FlyMachineMetrics = /*@__PURE__*/ S.suspend(() =>
1373
1438
 
1374
1439
  export interface FlyMachineMount {
1375
1440
  add_size_gb?: number;
1441
+ /** AddSizePercent grows by a percentage of the current size, rounded up to GiB. It is mutually exclusive with AddSizeGb. */
1442
+ add_size_percent?: number;
1376
1443
  encrypted?: boolean;
1377
1444
  extend_threshold_percent?: number;
1445
+ /** MinAddSizeGb is the minimum proportional growth in GiB (default 1). */
1446
+ min_add_size_gb?: number;
1378
1447
  name?: string;
1379
1448
  path?: string;
1380
1449
  size_gb?: number;
@@ -1384,8 +1453,10 @@ export interface FlyMachineMount {
1384
1453
  export const FlyMachineMount = /*@__PURE__*/ S.suspend(() =>
1385
1454
  S.Struct({
1386
1455
  add_size_gb: S.optional(S.Number),
1456
+ add_size_percent: S.optional(S.Number),
1387
1457
  encrypted: S.optional(S.Boolean),
1388
1458
  extend_threshold_percent: S.optional(S.Number),
1459
+ min_add_size_gb: S.optional(S.Number),
1389
1460
  name: S.optional(S.String),
1390
1461
  path: S.optional(S.String),
1391
1462
  size_gb: S.optional(S.Number),
@@ -1484,8 +1555,16 @@ export const FlyMachineRootfs = /*@__PURE__*/ S.suspend(() =>
1484
1555
  }) as any as S.Schema<FlyMachineRootfs>;
1485
1556
 
1486
1557
  /** Accepts a string (new format) or a boolean (old format). For backward compatibility with older clients, the API continues to use booleans for "off" and "stop" in responses. * "off" or false - Do not autostop the Machine. * "stop" or true - Automatically stop the Machine. * "suspend" - Automatically suspend the Machine, falling back to a full stop if this is not possible. */
1487
- export type FlyMachineServiceAutostop = "off" | "stop" | "suspend";
1488
- export const FlyMachineServiceAutostop = S.String;
1558
+ export type FlyMachineServiceAutostopMode = "off" | "stop" | "suspend";
1559
+ export const FlyMachineServiceAutostopMode = S.String;
1560
+
1561
+ /** Accepts off, stop, or suspend. For backward compatibility, responses encode off as false and stop as true. */
1562
+ export type FlyMachineServiceAutostop =
1563
+ | FlyMachineServiceAutostopMode
1564
+ | (string & {})
1565
+ | boolean;
1566
+ export const FlyMachineServiceAutostop: S.Codec<FlyMachineServiceAutostop> =
1567
+ /*@__PURE__*/ S.Union([FlyMachineServiceAutostopMode, S.Boolean]);
1489
1568
 
1490
1569
  export type FlyMachineServiceCheckHeadersList = Array<FlyMachineHTTPHeader>;
1491
1570
  export const FlyMachineServiceCheckHeadersList = /*@__PURE__*/ S.Array(
@@ -1692,7 +1771,7 @@ export const FlyMachineServicePortsList = /*@__PURE__*/ S.Array(
1692
1771
  export interface FlyMachineService {
1693
1772
  autostart?: boolean;
1694
1773
  /** Accepts a string (new format) or a boolean (old format). For backward compatibility with older clients, the API continues to use booleans for "off" and "stop" in responses. * "off" or false - Do not autostop the Machine. * "stop" or true - Automatically stop the Machine. * "suspend" - Automatically suspend the Machine, falling back to a full stop if this is not possible. */
1695
- autostop?: FlyMachineServiceAutostop | (string & {});
1774
+ autostop?: FlyMachineServiceAutostop;
1696
1775
  /** An optional list of service checks */
1697
1776
  checks?: FlyMachineServiceChecksList;
1698
1777
  concurrency?: FlyMachineServiceConcurrency;
@@ -1903,6 +1982,11 @@ export const MachineEventsList = /*@__PURE__*/ S.Array(
1903
1982
  MachineEvent,
1904
1983
  ) as any as S.Schema<MachineEventsList>;
1905
1984
 
1985
+ export type MachineHostFeaturesList = Array<string>;
1986
+ export const MachineHostFeaturesList = /*@__PURE__*/ S.Array(
1987
+ S.String,
1988
+ ) as any as S.Schema<MachineHostFeaturesList>;
1989
+
1906
1990
  export type MachineHostStatus = "ok" | "unknown" | "unreachable";
1907
1991
  export const MachineHostStatus = S.String;
1908
1992
 
@@ -1948,11 +2032,12 @@ export interface Machine {
1948
2032
  cordoned?: boolean;
1949
2033
  created_at?: string;
1950
2034
  events?: MachineEventsList;
2035
+ host_features?: MachineHostFeaturesList;
1951
2036
  host_status?: MachineHostStatus;
1952
2037
  id?: string;
1953
2038
  image_ref?: ImageRef;
1954
2039
  incomplete_config?: FlyMachineConfig;
1955
- /** InstanceID is unique for each version of the machine */
2040
+ /** InstanceID is the same value as `version`. Deprecated: use `version`. */
1956
2041
  instance_id?: string;
1957
2042
  lease?: StrippedLease;
1958
2043
  name?: string;
@@ -1963,6 +2048,8 @@ export interface Machine {
1963
2048
  region?: string;
1964
2049
  state?: string;
1965
2050
  updated_at?: string;
2051
+ /** Version is unique for each version of the machine. Pass it as `current_version` when updating the Machine to reject the update if the Machine has changed since this version. */
2052
+ version?: string;
1966
2053
  }
1967
2054
  export const Machine = /*@__PURE__*/ S.suspend(() =>
1968
2055
  S.Struct({
@@ -1971,6 +2058,7 @@ export const Machine = /*@__PURE__*/ S.suspend(() =>
1971
2058
  cordoned: S.optional(S.Boolean),
1972
2059
  created_at: S.optional(S.String),
1973
2060
  events: S.optional(MachineEventsList),
2061
+ host_features: S.optional(MachineHostFeaturesList),
1974
2062
  host_status: S.optional(MachineHostStatus),
1975
2063
  id: S.optional(S.String),
1976
2064
  image_ref: S.optional(ImageRef),
@@ -1983,6 +2071,7 @@ export const Machine = /*@__PURE__*/ S.suspend(() =>
1983
2071
  region: S.optional(S.String),
1984
2072
  state: S.optional(S.String),
1985
2073
  updated_at: S.optional(S.String),
2074
+ version: S.optional(S.String),
1986
2075
  }),
1987
2076
  ).annotate({ identifier: "Machine" }) as any as S.Schema<Machine>;
1988
2077
 
@@ -1994,13 +2083,16 @@ export interface CreateMachineLeaseRequest {
1994
2083
  description?: string;
1995
2084
  /** seconds lease will be valid */
1996
2085
  ttl?: number;
2086
+ /** Existing lease nonce when refreshing; omit to acquire a new lease. Keep the nonce private. */
2087
+ lease_nonce?: string;
1997
2088
  }
1998
2089
  export const CreateMachineLeaseRequest = /*@__PURE__*/ S.suspend(() =>
1999
2090
  S.Struct({
2000
2091
  app_name: S.String.pipe(T.Label()),
2001
2092
  machine_id: S.String.pipe(T.Label()),
2002
2093
  description: S.optional(S.String),
2003
- ttl: S.optional(S.Number),
2094
+ ttl: S.optional(S.Number.pipe(T.Query())),
2095
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
2004
2096
  }).pipe(
2005
2097
  T.Http({
2006
2098
  method: "POST",
@@ -2034,11 +2126,22 @@ export const Lease = /*@__PURE__*/ S.suspend(() =>
2034
2126
  }),
2035
2127
  ).annotate({ identifier: "Lease" }) as any as S.Schema<Lease>;
2036
2128
 
2129
+ export interface MachineLease {
2130
+ status?: string;
2131
+ data?: Lease;
2132
+ }
2133
+ export const MachineLease = /*@__PURE__*/ S.suspend(() =>
2134
+ S.Struct({
2135
+ status: S.optional(S.String),
2136
+ data: S.optional(Lease),
2137
+ }),
2138
+ ).annotate({ identifier: "MachineLease" }) as any as S.Schema<MachineLease>;
2139
+
2037
2140
  /** Postgres major version. */
2038
2141
  export type CreatePostgresRequestPgMajorVersion = "16" | "17";
2039
2142
  export const CreatePostgresRequestPgMajorVersion = S.String;
2040
2143
 
2041
- /** Plan slug selecting CPU, memory, and disk sizing. */
2144
+ /** Plan slug selecting CPU, memory, and disk sizing. Matched case-insensitively. */
2042
2145
  export type CreatePostgresRequestPlan =
2043
2146
  | "basic"
2044
2147
  | "starter"
@@ -2056,11 +2159,11 @@ export interface CreatePostgresRequest {
2056
2159
  disk_size_gb?: number;
2057
2160
  /** Name for the cluster. A name is generated when omitted. */
2058
2161
  name?: string;
2059
- /** Slug of the organization that will own the cluster. */
2162
+ /** Slug of the organization that will own the cluster, or "personal" for the caller's personal organization. */
2060
2163
  org_slug: string;
2061
2164
  /** Postgres major version. */
2062
2165
  pg_major_version?: CreatePostgresRequestPgMajorVersion | (string & {});
2063
- /** Plan slug selecting CPU, memory, and disk sizing. */
2166
+ /** Plan slug selecting CPU, memory, and disk sizing. Matched case-insensitively. */
2064
2167
  plan: CreatePostgresRequestPlan | (string & {});
2065
2168
  /** Connection pooler mode. */
2066
2169
  pool_mode?: CreatePostgresRequestPoolMode | (string & {});
@@ -2195,7 +2298,7 @@ export interface PostgresCluster {
2195
2298
  cpus?: number;
2196
2299
  /** RFC 3339 creation timestamp. */
2197
2300
  created_at?: string;
2198
- /** Disk size in gigabytes. */
2301
+ /** Disk size in gigabytes, for one replica. */
2199
2302
  disk_size_gb?: number;
2200
2303
  /** Connection endpoints. Populated once the cluster is ready. */
2201
2304
  endpoints?: PostgresClusterEndpoints;
@@ -2218,6 +2321,10 @@ export interface PostgresCluster {
2218
2321
  replicas?: number;
2219
2322
  /** Current lifecycle status. */
2220
2323
  status?: PostgresClusterStatus;
2324
+ /** Storage provisioned, summed across the cluster's volumes and measured hourly. Null until first measured. */
2325
+ storage_provisioned_bytes?: number | null;
2326
+ /** Storage used, summed across the cluster's volumes and measured hourly. Null until first measured. */
2327
+ storage_used_bytes?: number | null;
2221
2328
  }
2222
2329
  export const PostgresCluster = /*@__PURE__*/ S.suspend(() =>
2223
2330
  S.Struct({
@@ -2237,6 +2344,8 @@ export const PostgresCluster = /*@__PURE__*/ S.suspend(() =>
2237
2344
  region: S.optional(S.String),
2238
2345
  replicas: S.optional(S.Number),
2239
2346
  status: S.optional(PostgresClusterStatus),
2347
+ storage_provisioned_bytes: S.optional(S.NullOr(S.Number)),
2348
+ storage_used_bytes: S.optional(S.NullOr(S.Number)),
2240
2349
  }),
2241
2350
  ).annotate({
2242
2351
  identifier: "PostgresCluster",
@@ -2338,7 +2447,7 @@ export const CreatePostgresBackupResponse = /*@__PURE__*/ S.suspend(() =>
2338
2447
  export interface CreatePostgresDatabaseRequest {
2339
2448
  /** Managed Postgres Cluster ID */
2340
2449
  postgres_cluster_id: string;
2341
- /** Name of the database to create. */
2450
+ /** Name of the database to create. Must start and end with an alphanumeric character and may contain hyphens and underscores, up to 63 characters. */
2342
2451
  name: string;
2343
2452
  }
2344
2453
  export const CreatePostgresDatabaseRequest = /*@__PURE__*/ S.suspend(() =>
@@ -2391,7 +2500,7 @@ export interface CreatePostgresUserRequest {
2391
2500
  postgres_cluster_id: string;
2392
2501
  /** Role to grant the user. */
2393
2502
  role: CreatePostgresUserRequestRole | (string & {});
2394
- /** Name for the new user. */
2503
+ /** Name for the new user. Must start and end with a lowercase alphanumeric character and may contain hyphens and underscores, up to 63 characters. */
2395
2504
  username: string;
2396
2505
  }
2397
2506
  export const CreatePostgresUserRequest = /*@__PURE__*/ S.suspend(() =>
@@ -2528,9 +2637,19 @@ export const CreateVolumeRequest = /*@__PURE__*/ S.suspend(() =>
2528
2637
  identifier: "CreateVolumeRequest",
2529
2638
  }) as any as S.Schema<CreateVolumeRequest>;
2530
2639
 
2640
+ export type VolumeHostFeaturesList = Array<string>;
2641
+ export const VolumeHostFeaturesList = /*@__PURE__*/ S.Array(
2642
+ S.String,
2643
+ ) as any as S.Schema<VolumeHostFeaturesList>;
2644
+
2531
2645
  export type VolumeHostStatus = "ok" | "unknown" | "unreachable";
2532
2646
  export const VolumeHostStatus = S.String;
2533
2647
 
2648
+ export type VolumeRequiredHostFeaturesList = Array<string>;
2649
+ export const VolumeRequiredHostFeaturesList = /*@__PURE__*/ S.Array(
2650
+ S.String,
2651
+ ) as any as S.Schema<VolumeRequiredHostFeaturesList>;
2652
+
2534
2653
  export type VolumeType = "local" | "cache";
2535
2654
  export const VolumeType = S.String;
2536
2655
 
@@ -2547,10 +2666,12 @@ export interface Volume {
2547
2666
  created_at?: string;
2548
2667
  encrypted?: boolean;
2549
2668
  fstype?: string;
2669
+ host_features?: VolumeHostFeaturesList;
2550
2670
  host_status?: VolumeHostStatus;
2551
2671
  id?: string;
2552
2672
  name?: string;
2553
2673
  region?: string;
2674
+ required_host_features?: VolumeRequiredHostFeaturesList;
2554
2675
  size_gb?: number;
2555
2676
  snapshot_retention?: number;
2556
2677
  state?: string;
@@ -2571,10 +2692,12 @@ export const Volume = /*@__PURE__*/ S.suspend(() =>
2571
2692
  created_at: S.optional(S.String),
2572
2693
  encrypted: S.optional(S.Boolean),
2573
2694
  fstype: S.optional(S.String),
2695
+ host_features: S.optional(VolumeHostFeaturesList),
2574
2696
  host_status: S.optional(VolumeHostStatus),
2575
2697
  id: S.optional(S.String),
2576
2698
  name: S.optional(S.String),
2577
2699
  region: S.optional(S.String),
2700
+ required_host_features: S.optional(VolumeRequiredHostFeaturesList),
2578
2701
  size_gb: S.optional(S.Number),
2579
2702
  snapshot_retention: S.optional(S.Number),
2580
2703
  state: S.optional(S.String),
@@ -2821,12 +2944,14 @@ export interface DeleteMachineRequest {
2821
2944
  machine_id: string;
2822
2945
  /** Force kill the machine if it's running */
2823
2946
  force?: boolean;
2947
+ lease_nonce?: string;
2824
2948
  }
2825
2949
  export const DeleteMachineRequest = /*@__PURE__*/ S.suspend(() =>
2826
2950
  S.Struct({
2827
2951
  app_name: S.String.pipe(T.Label()),
2828
2952
  machine_id: S.String.pipe(T.Label()),
2829
2953
  force: S.optional(S.Boolean.pipe(T.Query())),
2954
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
2830
2955
  }).pipe(
2831
2956
  T.Http({
2832
2957
  method: "DELETE",
@@ -3477,6 +3602,8 @@ export interface GetMachineRequest {
3477
3602
  app_name: string;
3478
3603
  /** Machine ID */
3479
3604
  machine_id: string;
3605
+ /** 26-character Machine version ID; returns that version of the Machine instead of the current one */
3606
+ version?: string;
3480
3607
  /** Include machine lease */
3481
3608
  include_leases?: boolean;
3482
3609
  }
@@ -3484,6 +3611,7 @@ export const GetMachineRequest = /*@__PURE__*/ S.suspend(() =>
3484
3611
  S.Struct({
3485
3612
  app_name: S.String.pipe(T.Label()),
3486
3613
  machine_id: S.String.pipe(T.Label()),
3614
+ version: S.optional(S.String.pipe(T.Query())),
3487
3615
  include_leases: S.optional(S.Boolean.pipe(T.Query())),
3488
3616
  }).pipe(
3489
3617
  T.Http({
@@ -3970,6 +4098,7 @@ export interface IPAssignment {
3970
4098
  created_at?: string;
3971
4099
  egress?: boolean;
3972
4100
  ip?: string;
4101
+ network?: IPAssignmentNetwork | null;
3973
4102
  region?: string;
3974
4103
  service_name?: string;
3975
4104
  shared?: boolean;
@@ -3980,6 +4109,7 @@ export const IPAssignment = /*@__PURE__*/ S.suspend(() =>
3980
4109
  created_at: S.optional(S.String),
3981
4110
  egress: S.optional(S.Boolean),
3982
4111
  ip: S.optional(S.String),
4112
+ network: S.optional(S.NullOr(IPAssignmentNetwork)),
3983
4113
  region: S.optional(S.String),
3984
4114
  service_name: S.optional(S.String),
3985
4115
  shared: S.optional(S.Boolean),
@@ -4165,6 +4295,10 @@ export interface ListMachinesRequest {
4165
4295
  summary?: boolean;
4166
4296
  /** Filter by a machine metadata key and exact value. Replace {key} with the metadata key, for example metadata.foo=bar. Specify multiple metadata filters to require all matches. */
4167
4297
  metadata__key_?: string;
4298
+ /** Value of the fly-next-cursor response header from the previous page. Requires limit. */
4299
+ cursor?: string;
4300
+ /** The number of machines to fetch (must be between 1 and 1000). Providing a limit enables pagination. This limit is advisory; responses may be shorter, or even empty, even when more machines remain. */
4301
+ limit?: number;
4168
4302
  }
4169
4303
  export const ListMachinesRequest = /*@__PURE__*/ S.suspend(() =>
4170
4304
  S.Struct({
@@ -4175,6 +4309,8 @@ export const ListMachinesRequest = /*@__PURE__*/ S.suspend(() =>
4175
4309
  state: S.optional(S.String.pipe(T.Query())),
4176
4310
  summary: S.optional(S.Boolean.pipe(T.Query())),
4177
4311
  metadata__key_: S.optional(S.String.pipe(T.Query("metadata.{key}"))),
4312
+ cursor: S.optional(S.String.pipe(T.Query())),
4313
+ limit: S.optional(S.Number.pipe(T.Query())),
4178
4314
  }).pipe(
4179
4315
  T.Http({ method: "GET", uri: "/v1/apps/{app_name}/machines", code: 200 }),
4180
4316
  ),
@@ -4353,7 +4489,7 @@ export const ListMachineVersionsResponse = /*@__PURE__*/ S.suspend(() =>
4353
4489
  }) as any as S.Schema<ListMachineVersionsResponse>;
4354
4490
 
4355
4491
  export interface ListPostgresRequest {
4356
- /** Fly Organization Slug */
4492
+ /** Fly Organization Slug, or 'personal' for the caller's personal organization */
4357
4493
  org_slug: string;
4358
4494
  /** Include deleted clusters */
4359
4495
  include_deleted?: boolean;
@@ -4560,20 +4696,21 @@ export const ListPostgresExtensionsRequest = /*@__PURE__*/ S.suspend(() =>
4560
4696
  identifier: "ListPostgresExtensionsRequest",
4561
4697
  }) as any as S.Schema<ListPostgresExtensionsRequest>;
4562
4698
 
4563
- export interface PostgresInstalledExtension {
4699
+ /** Installation details, or null when the extension is not installed. */
4700
+ export interface PostgresExtensionInstalled {
4564
4701
  /** Schema the extension is installed into. */
4565
4702
  schema?: string;
4566
4703
  /** Installed version. */
4567
4704
  version?: string;
4568
4705
  }
4569
- export const PostgresInstalledExtension = /*@__PURE__*/ S.suspend(() =>
4706
+ export const PostgresExtensionInstalled = /*@__PURE__*/ S.suspend(() =>
4570
4707
  S.Struct({
4571
4708
  schema: S.optional(S.String),
4572
4709
  version: S.optional(S.String),
4573
4710
  }),
4574
4711
  ).annotate({
4575
- identifier: "PostgresInstalledExtension",
4576
- }) as any as S.Schema<PostgresInstalledExtension>;
4712
+ identifier: "PostgresExtensionInstalled",
4713
+ }) as any as S.Schema<PostgresExtensionInstalled>;
4577
4714
 
4578
4715
  export interface PostgresExtension {
4579
4716
  /** Default version installed when enabled. */
@@ -4581,7 +4718,7 @@ export interface PostgresExtension {
4581
4718
  /** Human-readable description. */
4582
4719
  description?: string;
4583
4720
  /** Installation details, or null when the extension is not installed. */
4584
- installed?: PostgresInstalledExtension;
4721
+ installed?: PostgresExtensionInstalled | null;
4585
4722
  /** Extension name. */
4586
4723
  name?: string;
4587
4724
  /** Whether this is a system extension that cannot be disabled. */
@@ -4591,7 +4728,7 @@ export const PostgresExtension = /*@__PURE__*/ S.suspend(() =>
4591
4728
  S.Struct({
4592
4729
  default_version: S.optional(S.String),
4593
4730
  description: S.optional(S.String),
4594
- installed: S.optional(PostgresInstalledExtension),
4731
+ installed: S.optional(S.NullOr(PostgresExtensionInstalled)),
4595
4732
  name: S.optional(S.String),
4596
4733
  system: S.optional(S.Boolean),
4597
4734
  }),
@@ -4835,9 +4972,19 @@ export const ListVolumesOrgRequest = /*@__PURE__*/ S.suspend(() =>
4835
4972
  identifier: "ListVolumesOrgRequest",
4836
4973
  }) as any as S.Schema<ListVolumesOrgRequest>;
4837
4974
 
4975
+ export type OrgVolumeHostFeaturesList = Array<string>;
4976
+ export const OrgVolumeHostFeaturesList = /*@__PURE__*/ S.Array(
4977
+ S.String,
4978
+ ) as any as S.Schema<OrgVolumeHostFeaturesList>;
4979
+
4838
4980
  export type OrgVolumeHostStatus = "ok" | "unknown" | "unreachable";
4839
4981
  export const OrgVolumeHostStatus = S.String;
4840
4982
 
4983
+ export type OrgVolumeRequiredHostFeaturesList = Array<string>;
4984
+ export const OrgVolumeRequiredHostFeaturesList = /*@__PURE__*/ S.Array(
4985
+ S.String,
4986
+ ) as any as S.Schema<OrgVolumeRequiredHostFeaturesList>;
4987
+
4841
4988
  export type OrgVolumeType = "local" | "cache";
4842
4989
  export const OrgVolumeType = S.String;
4843
4990
 
@@ -4855,10 +5002,12 @@ export interface OrgVolume {
4855
5002
  created_at?: string;
4856
5003
  encrypted?: boolean;
4857
5004
  fstype?: string;
5005
+ host_features?: OrgVolumeHostFeaturesList;
4858
5006
  host_status?: OrgVolumeHostStatus;
4859
5007
  id?: string;
4860
5008
  name?: string;
4861
5009
  region?: string;
5010
+ required_host_features?: OrgVolumeRequiredHostFeaturesList;
4862
5011
  size_gb?: number;
4863
5012
  snapshot_retention?: number;
4864
5013
  state?: string;
@@ -4881,10 +5030,12 @@ export const OrgVolume = /*@__PURE__*/ S.suspend(() =>
4881
5030
  created_at: S.optional(S.String),
4882
5031
  encrypted: S.optional(S.Boolean),
4883
5032
  fstype: S.optional(S.String),
5033
+ host_features: S.optional(OrgVolumeHostFeaturesList),
4884
5034
  host_status: S.optional(OrgVolumeHostStatus),
4885
5035
  id: S.optional(S.String),
4886
5036
  name: S.optional(S.String),
4887
5037
  region: S.optional(S.String),
5038
+ required_host_features: S.optional(OrgVolumeRequiredHostFeaturesList),
4888
5039
  size_gb: S.optional(S.Number),
4889
5040
  snapshot_retention: S.optional(S.Number),
4890
5041
  state: S.optional(S.String),
@@ -4921,11 +5072,14 @@ export interface MachinesReleaseLeaseRequest {
4921
5072
  app_name: string;
4922
5073
  /** Machine ID */
4923
5074
  machine_id: string;
5075
+ /** Nonce of the lease to release. Keep the nonce private. */
5076
+ lease_nonce: string;
4924
5077
  }
4925
5078
  export const MachinesReleaseLeaseRequest = /*@__PURE__*/ S.suspend(() =>
4926
5079
  S.Struct({
4927
5080
  app_name: S.String.pipe(T.Label()),
4928
5081
  machine_id: S.String.pipe(T.Label()),
5082
+ lease_nonce: S.String.pipe(T.Header("fly-machine-lease-nonce")),
4929
5083
  }).pipe(
4930
5084
  T.Http({
4931
5085
  method: "DELETE",
@@ -4986,6 +5140,156 @@ export const PatchMachineMetadataResponse = /*@__PURE__*/ S.suspend(() =>
4986
5140
  identifier: "PatchMachineMetadataResponse",
4987
5141
  }) as any as S.Schema<PatchMachineMetadataResponse>;
4988
5142
 
5143
+ export interface PostgresQueriesActiveRequest {
5144
+ /** Managed Postgres Cluster ID */
5145
+ postgres_cluster_id: string;
5146
+ /** Database to inspect (must not be empty or whitespace-only) */
5147
+ database: string;
5148
+ }
5149
+ export const PostgresQueriesActiveRequest = /*@__PURE__*/ S.suspend(() =>
5150
+ S.Struct({
5151
+ postgres_cluster_id: S.String.pipe(T.Label()),
5152
+ database: S.String.pipe(T.Query()),
5153
+ }).pipe(
5154
+ T.Http({
5155
+ method: "GET",
5156
+ uri: "/v1/postgres/{postgres_cluster_id}/queries/active",
5157
+ code: 200,
5158
+ }),
5159
+ ),
5160
+ ).annotate({
5161
+ identifier: "PostgresQueriesActiveRequest",
5162
+ }) as any as S.Schema<PostgresQueriesActiveRequest>;
5163
+
5164
+ export interface PostgresActiveQuery {
5165
+ /** Application connected to the backend. */
5166
+ application_name?: string;
5167
+ /** Client address. */
5168
+ client?: string;
5169
+ /** Database name. */
5170
+ database?: string;
5171
+ /** Query duration in seconds. */
5172
+ duration_seconds?: number;
5173
+ /** Process ID of the backend running the query. */
5174
+ pid?: number;
5175
+ /** Full query text. */
5176
+ query?: string;
5177
+ /** Current backend state. */
5178
+ state?: string;
5179
+ /** Time spent in the current state, in seconds. */
5180
+ state_duration_seconds?: number;
5181
+ /** User running the query. */
5182
+ user?: string;
5183
+ /** Event the backend is waiting for. */
5184
+ wait_event?: string;
5185
+ /** Type of event the backend is waiting for. */
5186
+ wait_event_type?: string;
5187
+ }
5188
+ export const PostgresActiveQuery = /*@__PURE__*/ S.suspend(() =>
5189
+ S.Struct({
5190
+ application_name: S.optional(S.String),
5191
+ client: S.optional(S.String),
5192
+ database: S.optional(S.String),
5193
+ duration_seconds: S.optional(S.Number),
5194
+ pid: S.optional(S.Number),
5195
+ query: S.optional(S.String),
5196
+ state: S.optional(S.String),
5197
+ state_duration_seconds: S.optional(S.Number),
5198
+ user: S.optional(S.String),
5199
+ wait_event: S.optional(S.String),
5200
+ wait_event_type: S.optional(S.String),
5201
+ }),
5202
+ ).annotate({
5203
+ identifier: "PostgresActiveQuery",
5204
+ }) as any as S.Schema<PostgresActiveQuery>;
5205
+
5206
+ export type ListPostgresActiveQueriesResponseDataList =
5207
+ Array<PostgresActiveQuery>;
5208
+ export const ListPostgresActiveQueriesResponseDataList = /*@__PURE__*/ S.Array(
5209
+ PostgresActiveQuery,
5210
+ ) as any as S.Schema<ListPostgresActiveQueriesResponseDataList>;
5211
+
5212
+ export interface ListPostgresActiveQueriesResponse {
5213
+ data?: ListPostgresActiveQueriesResponseDataList;
5214
+ }
5215
+ export const ListPostgresActiveQueriesResponse = /*@__PURE__*/ S.suspend(() =>
5216
+ S.Struct({
5217
+ data: S.optional(ListPostgresActiveQueriesResponseDataList),
5218
+ }),
5219
+ ).annotate({
5220
+ identifier: "ListPostgresActiveQueriesResponse",
5221
+ }) as any as S.Schema<ListPostgresActiveQueriesResponse>;
5222
+
5223
+ export interface PostgresQueriesSlowRequest {
5224
+ /** Managed Postgres Cluster ID */
5225
+ postgres_cluster_id: string;
5226
+ /** Metrics lookback in seconds */
5227
+ range?: number;
5228
+ }
5229
+ export const PostgresQueriesSlowRequest = /*@__PURE__*/ S.suspend(() =>
5230
+ S.Struct({
5231
+ postgres_cluster_id: S.String.pipe(T.Label()),
5232
+ range: S.optional(S.Number.pipe(T.Query())),
5233
+ }).pipe(
5234
+ T.Http({
5235
+ method: "GET",
5236
+ uri: "/v1/postgres/{postgres_cluster_id}/queries/slow",
5237
+ code: 200,
5238
+ }),
5239
+ ),
5240
+ ).annotate({
5241
+ identifier: "PostgresQueriesSlowRequest",
5242
+ }) as any as S.Schema<PostgresQueriesSlowRequest>;
5243
+
5244
+ export interface PostgresSlowQuery {
5245
+ /** Cumulative number of executions. */
5246
+ calls?: number;
5247
+ /** Database name. */
5248
+ database?: string;
5249
+ /** Maximum execution time in seconds. */
5250
+ max_exec_time_seconds?: number;
5251
+ /** Mean execution time in seconds. */
5252
+ mean_exec_time_seconds?: number;
5253
+ /** Full query pattern. */
5254
+ query?: string;
5255
+ /** Query identifier. */
5256
+ query_id?: string;
5257
+ /** Cumulative total execution time in seconds. */
5258
+ total_exec_time_seconds?: number;
5259
+ /** User running the query. */
5260
+ user?: string;
5261
+ }
5262
+ export const PostgresSlowQuery = /*@__PURE__*/ S.suspend(() =>
5263
+ S.Struct({
5264
+ calls: S.optional(S.Number),
5265
+ database: S.optional(S.String),
5266
+ max_exec_time_seconds: S.optional(S.Number),
5267
+ mean_exec_time_seconds: S.optional(S.Number),
5268
+ query: S.optional(S.String),
5269
+ query_id: S.optional(S.String),
5270
+ total_exec_time_seconds: S.optional(S.Number),
5271
+ user: S.optional(S.String),
5272
+ }),
5273
+ ).annotate({
5274
+ identifier: "PostgresSlowQuery",
5275
+ }) as any as S.Schema<PostgresSlowQuery>;
5276
+
5277
+ export type ListPostgresSlowQueriesResponseDataList = Array<PostgresSlowQuery>;
5278
+ export const ListPostgresSlowQueriesResponseDataList = /*@__PURE__*/ S.Array(
5279
+ PostgresSlowQuery,
5280
+ ) as any as S.Schema<ListPostgresSlowQueriesResponseDataList>;
5281
+
5282
+ export interface ListPostgresSlowQueriesResponse {
5283
+ data?: ListPostgresSlowQueriesResponseDataList;
5284
+ }
5285
+ export const ListPostgresSlowQueriesResponse = /*@__PURE__*/ S.suspend(() =>
5286
+ S.Struct({
5287
+ data: S.optional(ListPostgresSlowQueriesResponseDataList),
5288
+ }),
5289
+ ).annotate({
5290
+ identifier: "ListPostgresSlowQueriesResponse",
5291
+ }) as any as S.Schema<ListPostgresSlowQueriesResponse>;
5292
+
4989
5293
  export interface PostgresUsersCredentialsRequest {
4990
5294
  /** Managed Postgres Cluster ID */
4991
5295
  postgres_cluster_id: string;
@@ -5122,6 +5426,7 @@ export interface RestartMachineRequest {
5122
5426
  timeout?: string;
5123
5427
  /** Unix signal name */
5124
5428
  signal?: RestartMachineRequestSignal | (string & {});
5429
+ lease_nonce?: string;
5125
5430
  }
5126
5431
  export const RestartMachineRequest = /*@__PURE__*/ S.suspend(() =>
5127
5432
  S.Struct({
@@ -5129,6 +5434,7 @@ export const RestartMachineRequest = /*@__PURE__*/ S.suspend(() =>
5129
5434
  machine_id: S.String.pipe(T.Label()),
5130
5435
  timeout: S.optional(S.String.pipe(T.Query())),
5131
5436
  signal: S.optional(RestartMachineRequestSignal.pipe(T.Query())),
5437
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
5132
5438
  }).pipe(
5133
5439
  T.Http({
5134
5440
  method: "POST",
@@ -5351,11 +5657,13 @@ export interface StartMachineRequest {
5351
5657
  app_name: string;
5352
5658
  /** Machine ID */
5353
5659
  machine_id: string;
5660
+ lease_nonce?: string;
5354
5661
  }
5355
5662
  export const StartMachineRequest = /*@__PURE__*/ S.suspend(() =>
5356
5663
  S.Struct({
5357
5664
  app_name: S.String.pipe(T.Label()),
5358
5665
  machine_id: S.String.pipe(T.Label()),
5666
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
5359
5667
  }).pipe(
5360
5668
  T.Http({
5361
5669
  method: "POST",
@@ -5391,6 +5699,7 @@ export interface StopMachineRequest {
5391
5699
  machine_id: string;
5392
5700
  signal?: StopMachineRequestSignal | (string & {});
5393
5701
  timeout?: string;
5702
+ lease_nonce?: string;
5394
5703
  }
5395
5704
  export const StopMachineRequest = /*@__PURE__*/ S.suspend(() =>
5396
5705
  S.Struct({
@@ -5398,6 +5707,7 @@ export const StopMachineRequest = /*@__PURE__*/ S.suspend(() =>
5398
5707
  machine_id: S.String.pipe(T.Label()),
5399
5708
  signal: S.optional(StopMachineRequestSignal),
5400
5709
  timeout: S.optional(S.String),
5710
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
5401
5711
  }).pipe(
5402
5712
  T.Http({
5403
5713
  method: "POST",
@@ -5421,11 +5731,13 @@ export interface SuspendMachineRequest {
5421
5731
  app_name: string;
5422
5732
  /** Machine ID */
5423
5733
  machine_id: string;
5734
+ lease_nonce?: string;
5424
5735
  }
5425
5736
  export const SuspendMachineRequest = /*@__PURE__*/ S.suspend(() =>
5426
5737
  S.Struct({
5427
5738
  app_name: S.String.pipe(T.Label()),
5428
5739
  machine_id: S.String.pipe(T.Label()),
5740
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
5429
5741
  }).pipe(
5430
5742
  T.Http({
5431
5743
  method: "POST",
@@ -5449,11 +5761,13 @@ export interface UncordonMachineRequest {
5449
5761
  app_name: string;
5450
5762
  /** Machine ID */
5451
5763
  machine_id: string;
5764
+ lease_nonce?: string;
5452
5765
  }
5453
5766
  export const UncordonMachineRequest = /*@__PURE__*/ S.suspend(() =>
5454
5767
  S.Struct({
5455
5768
  app_name: S.String.pipe(T.Label()),
5456
5769
  machine_id: S.String.pipe(T.Label()),
5770
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
5457
5771
  }).pipe(
5458
5772
  T.Http({
5459
5773
  method: "POST",
@@ -5479,6 +5793,7 @@ export interface UpdateMachineRequest {
5479
5793
  machine_id: string;
5480
5794
  /** An object defining the Machine configuration */
5481
5795
  config?: FlyMachineConfig;
5796
+ /** CurrentVersion is an optional optimistic-concurrency guard: the Machine's `version`, as returned by create, get or a previous update. When set and it is no longer the Machine's current version, the update is rejected with 409 Conflict and nothing changes. Omit it to update unconditionally. */
5482
5797
  current_version?: string;
5483
5798
  lease_ttl?: number;
5484
5799
  min_secrets_version?: number;
@@ -5489,6 +5804,7 @@ export interface UpdateMachineRequest {
5489
5804
  skip_launch?: boolean;
5490
5805
  skip_secrets?: boolean;
5491
5806
  skip_service_registration?: boolean;
5807
+ lease_nonce?: string;
5492
5808
  }
5493
5809
  export const UpdateMachineRequest = /*@__PURE__*/ S.suspend(() =>
5494
5810
  S.Struct({
@@ -5503,6 +5819,7 @@ export const UpdateMachineRequest = /*@__PURE__*/ S.suspend(() =>
5503
5819
  skip_launch: S.optional(S.Boolean),
5504
5820
  skip_secrets: S.optional(S.Boolean),
5505
5821
  skip_service_registration: S.optional(S.Boolean),
5822
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
5506
5823
  }).pipe(
5507
5824
  T.Http({
5508
5825
  method: "POST",
@@ -5514,48 +5831,6 @@ export const UpdateMachineRequest = /*@__PURE__*/ S.suspend(() =>
5514
5831
  identifier: "UpdateMachineRequest",
5515
5832
  }) as any as S.Schema<UpdateMachineRequest>;
5516
5833
 
5517
- export type UpdateMachineMetadataRequestMetadataMap = {
5518
- [key: string]: string | undefined;
5519
- };
5520
- export const UpdateMachineMetadataRequestMetadataMap = /*@__PURE__*/ S.Record(
5521
- S.String,
5522
- S.String,
5523
- ) as any as S.Schema<UpdateMachineMetadataRequestMetadataMap>;
5524
-
5525
- export interface UpdateMachineMetadataRequest {
5526
- /** Fly App Name */
5527
- app_name: string;
5528
- /** Machine ID */
5529
- machine_id: string;
5530
- machine_version?: string;
5531
- metadata?: UpdateMachineMetadataRequestMetadataMap;
5532
- updated_at?: string;
5533
- }
5534
- export const UpdateMachineMetadataRequest = /*@__PURE__*/ S.suspend(() =>
5535
- S.Struct({
5536
- app_name: S.String.pipe(T.Label()),
5537
- machine_id: S.String.pipe(T.Label()),
5538
- machine_version: S.optional(S.String),
5539
- metadata: S.optional(UpdateMachineMetadataRequestMetadataMap),
5540
- updated_at: S.optional(S.String),
5541
- }).pipe(
5542
- T.Http({
5543
- method: "PUT",
5544
- uri: "/v1/apps/{app_name}/machines/{machine_id}/metadata",
5545
- code: 200,
5546
- }),
5547
- ),
5548
- ).annotate({
5549
- identifier: "UpdateMachineMetadataRequest",
5550
- }) as any as S.Schema<UpdateMachineMetadataRequest>;
5551
-
5552
- export interface UpdateMachineMetadataResponse {}
5553
- export const UpdateMachineMetadataResponse = /*@__PURE__*/ S.suspend(() =>
5554
- S.Struct({}),
5555
- ).annotate({
5556
- identifier: "UpdateMachineMetadataResponse",
5557
- }) as any as S.Schema<UpdateMachineMetadataResponse>;
5558
-
5559
5834
  /** New role for the user. */
5560
5835
  export type UpdatePostgresUserRoleRequestRole =
5561
5836
  | "schema_admin"
@@ -5849,6 +6124,7 @@ export type CordonMachineError =
5849
6124
  | BadRequest
5850
6125
  | Forbidden
5851
6126
  | NotFound
6127
+ | Conflict
5852
6128
  | FlyIoOpError;
5853
6129
  /** Cordon Machine “Cordoning” a Machine refers to disabling its services, so the Fly Proxy won’t route requests to it. In flyctl this is used by blue/green deployments; one set of Machines is started up with services disabled, and when they are all healthy, the services are enabled on the new Machines and disabled on the old ones. */
5854
6130
  export const cordonMachine: API.OperationMethod<
@@ -5859,7 +6135,7 @@ export const cordonMachine: API.OperationMethod<
5859
6135
  > = /*@__PURE__*/ API.make(() => ({
5860
6136
  input: CordonMachineRequest,
5861
6137
  output: CordonMachineResponse,
5862
- errors: [BadRequest, Forbidden, NotFound],
6138
+ errors: [BadRequest, Forbidden, NotFound, Conflict],
5863
6139
  protocol: FlyIoProtocol,
5864
6140
  retry: Retry.Retry,
5865
6141
  }));
@@ -5951,6 +6227,7 @@ export type CreateAppIPAssignmentError =
5951
6227
  | Forbidden
5952
6228
  | NotFound
5953
6229
  | Conflict
6230
+ | NetworkNotFound
5954
6231
  | FlyIoOpError;
5955
6232
  /** Assign new IP address to app */
5956
6233
  export const createAppIPAssignment: API.OperationMethod<
@@ -5961,7 +6238,7 @@ export const createAppIPAssignment: API.OperationMethod<
5961
6238
  > = /*@__PURE__*/ API.make(() => ({
5962
6239
  input: CreateAppIPAssignmentRequest,
5963
6240
  output: AssignIPResponse,
5964
- errors: [BadRequest, Forbidden, NotFound, Conflict],
6241
+ errors: [BadRequest, Forbidden, NotFound, Conflict, NetworkNotFound],
5965
6242
  protocol: FlyIoProtocol,
5966
6243
  retry: Retry.Retry,
5967
6244
  }));
@@ -5990,17 +6267,18 @@ export type CreateMachineLeaseError =
5990
6267
  | BadRequest
5991
6268
  | Forbidden
5992
6269
  | NotFound
6270
+ | Conflict
5993
6271
  | FlyIoOpError;
5994
6272
  /** Create Lease Create a lease for a specific Machine within an app using the details provided in the request body. Machine leases can be used to obtain an exclusive lock on modifying a Machine. */
5995
6273
  export const createMachineLease: API.OperationMethod<
5996
6274
  CreateMachineLeaseRequest,
5997
- Lease,
6275
+ MachineLease,
5998
6276
  CreateMachineLeaseError,
5999
6277
  FlyIoOpContext
6000
6278
  > = /*@__PURE__*/ API.make(() => ({
6001
6279
  input: CreateMachineLeaseRequest,
6002
- output: Lease,
6003
- errors: [BadRequest, Forbidden, NotFound],
6280
+ output: MachineLease,
6281
+ errors: [BadRequest, Forbidden, NotFound, Conflict],
6004
6282
  protocol: FlyIoProtocol,
6005
6283
  retry: Retry.Retry,
6006
6284
  }));
@@ -6010,7 +6288,7 @@ export type CreatePostgresError =
6010
6288
  | NotFound
6011
6289
  | UnprocessableEntity
6012
6290
  | FlyIoOpError;
6013
- /** Create Postgres Cluster Create a Managed Postgres cluster for the organization named in the request body. Provisioning is asynchronous, and a name is generated when one is not supplied. */
6291
+ /** Create Postgres Cluster Create a Managed Postgres cluster for the organization named in the request body. Provisioning is asynchronous: poll `GET /v1/postgres/{id}` until `status == ready` before calling database, user, extension, or credential endpoints. */
6014
6292
  export const createPostgres: API.OperationMethod<
6015
6293
  CreatePostgresRequest,
6016
6294
  ShowPostgresClusterResponse,
@@ -6025,7 +6303,7 @@ export const createPostgres: API.OperationMethod<
6025
6303
  }));
6026
6304
 
6027
6305
  export type CreatePostgresAttachmentError = NotFound | FlyIoOpError;
6028
- /** Attach Cluster to App Attach a specific cluster to a Fly app. The attachment is created if it does not already exist. */
6306
+ /** Attach Cluster to App Record an attachment between a cluster and a Fly app. This endpoint records the relationship but does not set DATABASE_URL or other app secrets; configure the connection string separately. The attachment is created if it does not already exist. */
6029
6307
  export const createPostgresAttachment: API.OperationMethod<
6030
6308
  CreatePostgresAttachmentRequest,
6031
6309
  CreatePostgresAttachmentResponse,
@@ -6370,7 +6648,12 @@ export const deleteSecretKey: API.OperationMethod<
6370
6648
  retry: Retry.Retry,
6371
6649
  }));
6372
6650
 
6373
- export type DeleteVolumeError = Forbidden | NotFound | Conflict | FlyIoOpError;
6651
+ export type DeleteVolumeError =
6652
+ | Forbidden
6653
+ | NotFound
6654
+ | Conflict
6655
+ | VolumeAttached
6656
+ | FlyIoOpError;
6374
6657
  /** Destroy Volume Delete a specific volume within an app by volume ID. */
6375
6658
  export const deleteVolume: API.OperationMethod<
6376
6659
  DeleteVolumeRequest,
@@ -6380,7 +6663,7 @@ export const deleteVolume: API.OperationMethod<
6380
6663
  > = /*@__PURE__*/ API.make(() => ({
6381
6664
  input: DeleteVolumeRequest,
6382
6665
  output: Volume,
6383
- errors: [Forbidden, NotFound, Conflict],
6666
+ errors: [Forbidden, NotFound, Conflict, VolumeAttached],
6384
6667
  protocol: FlyIoProtocol,
6385
6668
  retry: Retry.Retry,
6386
6669
  }));
@@ -6443,7 +6726,12 @@ export const encryptSecretKey: API.OperationMethod<
6443
6726
  retry: Retry.Retry,
6444
6727
  }));
6445
6728
 
6446
- export type ExecMachineError = BadRequest | Forbidden | NotFound | FlyIoOpError;
6729
+ export type ExecMachineError =
6730
+ | BadRequest
6731
+ | Forbidden
6732
+ | NotFound
6733
+ | Conflict
6734
+ | FlyIoOpError;
6447
6735
  /** Execute Command Execute a command on a specific Machine and return the raw command output bytes. */
6448
6736
  export const execMachine: API.OperationMethod<
6449
6737
  ExecMachineRequest,
@@ -6453,7 +6741,7 @@ export const execMachine: API.OperationMethod<
6453
6741
  > = /*@__PURE__*/ API.make(() => ({
6454
6742
  input: ExecMachineRequest,
6455
6743
  output: Flydv1ExecResponse,
6456
- errors: [BadRequest, Forbidden, NotFound],
6744
+ errors: [BadRequest, Forbidden, NotFound, Conflict],
6457
6745
  protocol: FlyIoProtocol,
6458
6746
  retry: Retry.Retry,
6459
6747
  }));
@@ -6581,12 +6869,12 @@ export type GetMachineLeaseError = Forbidden | NotFound | FlyIoOpError;
6581
6869
  /** Get Lease Retrieve the current lease of a specific Machine within an app. Machine leases can be used to obtain an exclusive lock on modifying a Machine. */
6582
6870
  export const getMachineLease: API.OperationMethod<
6583
6871
  GetMachineLeaseRequest,
6584
- Lease,
6872
+ MachineLease,
6585
6873
  GetMachineLeaseError,
6586
6874
  FlyIoOpContext
6587
6875
  > = /*@__PURE__*/ API.make(() => ({
6588
6876
  input: GetMachineLeaseRequest,
6589
- output: Lease,
6877
+ output: MachineLease,
6590
6878
  errors: [Forbidden, NotFound],
6591
6879
  protocol: FlyIoProtocol,
6592
6880
  retry: Retry.Retry,
@@ -6851,7 +7139,11 @@ export const listMachineVersions: API.OperationMethod<
6851
7139
  retry: Retry.Retry,
6852
7140
  }));
6853
7141
 
6854
- export type ListPostgresError = NotFound | UnprocessableEntity | FlyIoOpError;
7142
+ export type ListPostgresError =
7143
+ | BadRequest
7144
+ | NotFound
7145
+ | UnprocessableEntity
7146
+ | FlyIoOpError;
6855
7147
  /** List Postgres Clusters List Managed Postgres clusters for an organization. */
6856
7148
  export const listPostgres: API.OperationMethod<
6857
7149
  ListPostgresRequest,
@@ -6861,7 +7153,7 @@ export const listPostgres: API.OperationMethod<
6861
7153
  > = /*@__PURE__*/ API.make(() => ({
6862
7154
  input: ListPostgresRequest,
6863
7155
  output: ListPostgresClustersResponse,
6864
- errors: [NotFound, UnprocessableEntity],
7156
+ errors: [BadRequest, NotFound, UnprocessableEntity],
6865
7157
  protocol: FlyIoProtocol,
6866
7158
  retry: Retry.Retry,
6867
7159
  }));
@@ -7016,8 +7308,12 @@ export const machinesReleaseLease: API.OperationMethod<
7016
7308
  retry: Retry.Retry,
7017
7309
  }));
7018
7310
 
7019
- export type PatchMachineMetadataError = BadRequest | FlyIoOpError;
7020
- /** Update Metadata (set/remove multiple keys) Update multiple metadata keys at once. Null values and empty strings remove keys. + If `machine_version` is provided and no longer matches the current machine version, returns 412 Precondition Failed. */
7311
+ export type PatchMachineMetadataError =
7312
+ | BadRequest
7313
+ | Forbidden
7314
+ | NotFound
7315
+ | FlyIoOpError;
7316
+ /** Update Metadata (set/remove multiple keys) Update multiple metadata keys at once. Keys that are not in the request are left untouched. Null values and empty strings remove keys. + If `machine_version` is provided and no longer matches the current machine version, returns 412 Precondition Failed. */
7021
7317
  export const patchMachineMetadata: API.OperationMethod<
7022
7318
  PatchMachineMetadataRequest,
7023
7319
  PatchMachineMetadataResponse,
@@ -7026,7 +7322,43 @@ export const patchMachineMetadata: API.OperationMethod<
7026
7322
  > = /*@__PURE__*/ API.make(() => ({
7027
7323
  input: PatchMachineMetadataRequest,
7028
7324
  output: PatchMachineMetadataResponse,
7029
- errors: [BadRequest],
7325
+ errors: [BadRequest, Forbidden, NotFound],
7326
+ protocol: FlyIoProtocol,
7327
+ retry: Retry.Retry,
7328
+ }));
7329
+
7330
+ export type PostgresQueriesActiveError =
7331
+ | NotFound
7332
+ | UnprocessableEntity
7333
+ | FlyIoOpError;
7334
+ /** List Active Queries List active queries in the supplied database. The database query parameter is required and must not be empty or whitespace-only. Returns full query text and durations in seconds. */
7335
+ export const postgresQueriesActive: API.OperationMethod<
7336
+ PostgresQueriesActiveRequest,
7337
+ ListPostgresActiveQueriesResponse,
7338
+ PostgresQueriesActiveError,
7339
+ FlyIoOpContext
7340
+ > = /*@__PURE__*/ API.make(() => ({
7341
+ input: PostgresQueriesActiveRequest,
7342
+ output: ListPostgresActiveQueriesResponse,
7343
+ errors: [NotFound, UnprocessableEntity],
7344
+ protocol: FlyIoProtocol,
7345
+ retry: Retry.Retry,
7346
+ }));
7347
+
7348
+ export type PostgresQueriesSlowError =
7349
+ | NotFound
7350
+ | UnprocessableEntity
7351
+ | FlyIoOpError;
7352
+ /** List Slow Queries List the top 20 queries by cumulative total execution time, excluding the postgres database. Uses the latest available metrics within the lookback range; statistics are cumulative PostgreSQL counters, not deltas over that range. Returns full query text and execution times in seconds. */
7353
+ export const postgresQueriesSlow: API.OperationMethod<
7354
+ PostgresQueriesSlowRequest,
7355
+ ListPostgresSlowQueriesResponse,
7356
+ PostgresQueriesSlowError,
7357
+ FlyIoOpContext
7358
+ > = /*@__PURE__*/ API.make(() => ({
7359
+ input: PostgresQueriesSlowRequest,
7360
+ output: ListPostgresSlowQueriesResponse,
7361
+ errors: [NotFound, UnprocessableEntity],
7030
7362
  protocol: FlyIoProtocol,
7031
7363
  retry: Retry.Retry,
7032
7364
  }));
@@ -7110,6 +7442,7 @@ export type RestartMachineError =
7110
7442
  | BadRequest
7111
7443
  | Forbidden
7112
7444
  | NotFound
7445
+ | Conflict
7113
7446
  | FlyIoOpError;
7114
7447
  /** Restart Machine Restart a specific Machine within an app, with an optional timeout parameter. */
7115
7448
  export const restartMachine: API.OperationMethod<
@@ -7120,7 +7453,7 @@ export const restartMachine: API.OperationMethod<
7120
7453
  > = /*@__PURE__*/ API.make(() => ({
7121
7454
  input: RestartMachineRequest,
7122
7455
  output: RestartMachineResponse,
7123
- errors: [BadRequest, Forbidden, NotFound],
7456
+ errors: [BadRequest, Forbidden, NotFound, Conflict],
7124
7457
  protocol: FlyIoProtocol,
7125
7458
  retry: Retry.Retry,
7126
7459
  }));
@@ -7246,6 +7579,7 @@ export type StartMachineError =
7246
7579
  | NotFound
7247
7580
  | Conflict
7248
7581
  | MachineStartFromCreatedState
7582
+ | MachineReplacing
7249
7583
  | FlyIoOpError;
7250
7584
  /** Start Machine Start a specific Machine within an app. */
7251
7585
  export const startMachine: API.OperationMethod<
@@ -7262,12 +7596,18 @@ export const startMachine: API.OperationMethod<
7262
7596
  NotFound,
7263
7597
  Conflict,
7264
7598
  MachineStartFromCreatedState,
7599
+ MachineReplacing,
7265
7600
  ],
7266
7601
  protocol: FlyIoProtocol,
7267
7602
  retry: Retry.Retry,
7268
7603
  }));
7269
7604
 
7270
- export type StopMachineError = BadRequest | Forbidden | NotFound | FlyIoOpError;
7605
+ export type StopMachineError =
7606
+ | BadRequest
7607
+ | Forbidden
7608
+ | NotFound
7609
+ | Conflict
7610
+ | FlyIoOpError;
7271
7611
  /** Stop Machine Stop a specific Machine within an app, with an optional request body to specify signal and timeout. */
7272
7612
  export const stopMachine: API.OperationMethod<
7273
7613
  StopMachineRequest,
@@ -7277,7 +7617,7 @@ export const stopMachine: API.OperationMethod<
7277
7617
  > = /*@__PURE__*/ API.make(() => ({
7278
7618
  input: StopMachineRequest,
7279
7619
  output: StopMachineResponse,
7280
- errors: [BadRequest, Forbidden, NotFound],
7620
+ errors: [BadRequest, Forbidden, NotFound, Conflict],
7281
7621
  protocol: FlyIoProtocol,
7282
7622
  retry: Retry.Retry,
7283
7623
  }));
@@ -7286,6 +7626,7 @@ export type SuspendMachineError =
7286
7626
  | BadRequest
7287
7627
  | Forbidden
7288
7628
  | NotFound
7629
+ | Conflict
7289
7630
  | FlyIoOpError;
7290
7631
  /** Suspend Machine Suspend a specific Machine within an app. The next start operation will attempt (but is not guaranteed) to resume the Machine from a snapshot taken at suspension time, rather than performing a cold boot. */
7291
7632
  export const suspendMachine: API.OperationMethod<
@@ -7296,7 +7637,7 @@ export const suspendMachine: API.OperationMethod<
7296
7637
  > = /*@__PURE__*/ API.make(() => ({
7297
7638
  input: SuspendMachineRequest,
7298
7639
  output: SuspendMachineResponse,
7299
- errors: [BadRequest, Forbidden, NotFound],
7640
+ errors: [BadRequest, Forbidden, NotFound, Conflict],
7300
7641
  protocol: FlyIoProtocol,
7301
7642
  retry: Retry.Retry,
7302
7643
  }));
@@ -7305,6 +7646,7 @@ export type UncordonMachineError =
7305
7646
  | BadRequest
7306
7647
  | Forbidden
7307
7648
  | NotFound
7649
+ | Conflict
7308
7650
  | FlyIoOpError;
7309
7651
  /** Uncordon Machine “Cordoning” a Machine refers to disabling its services, so the Fly Proxy won’t route requests to it. In flyctl this is used by blue/green deployments; one set of Machines is started up with services disabled, and when they are all healthy, the services are enabled on the new Machines and disabled on the old ones. */
7310
7652
  export const uncordonMachine: API.OperationMethod<
@@ -7315,7 +7657,7 @@ export const uncordonMachine: API.OperationMethod<
7315
7657
  > = /*@__PURE__*/ API.make(() => ({
7316
7658
  input: UncordonMachineRequest,
7317
7659
  output: UncordonMachineResponse,
7318
- errors: [BadRequest, Forbidden, NotFound],
7660
+ errors: [BadRequest, Forbidden, NotFound, Conflict],
7319
7661
  protocol: FlyIoProtocol,
7320
7662
  retry: Retry.Retry,
7321
7663
  }));
@@ -7340,25 +7682,6 @@ export const updateMachine: API.OperationMethod<
7340
7682
  retry: Retry.Retry,
7341
7683
  }));
7342
7684
 
7343
- export type UpdateMachineMetadataError =
7344
- | BadRequest
7345
- | Forbidden
7346
- | NotFound
7347
- | FlyIoOpError;
7348
- /** Update Metadata (set/remove multiple keys) Update multiple metadata keys at once. Null values and empty strings remove keys. + If `machine_version` is provided and no longer matches the current machine version, returns 412 Precondition Failed. */
7349
- export const updateMachineMetadata: API.OperationMethod<
7350
- UpdateMachineMetadataRequest,
7351
- UpdateMachineMetadataResponse,
7352
- UpdateMachineMetadataError,
7353
- FlyIoOpContext
7354
- > = /*@__PURE__*/ API.make(() => ({
7355
- input: UpdateMachineMetadataRequest,
7356
- output: UpdateMachineMetadataResponse,
7357
- errors: [BadRequest, Forbidden, NotFound],
7358
- protocol: FlyIoProtocol,
7359
- retry: Retry.Retry,
7360
- }));
7361
-
7362
7685
  export type UpdatePostgresUserRoleError =
7363
7686
  | BadRequest
7364
7687
  | NotFound