@distilled.cloud/fly-io 1.0.0-rc.11 → 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,74 @@ 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
+
36
+ export class MachineStartFromCreatedState
37
+ extends /*@__PURE__*/ T.applyErrorMatchers(
38
+ /*@__PURE__*/ S.TaggedError<MachineStartFromCreatedState>()(
39
+ "MachineStartFromCreatedState",
40
+ {
41
+ message: S.String,
42
+ },
43
+ ),
44
+ [
45
+ {
46
+ message:
47
+ "failed_precondition: unable to start machine from current state: 'created'",
48
+ },
49
+ ],
50
+ ) {}
51
+
52
+ export class MachineWaitTimeout
53
+ extends /*@__PURE__*/ T.applyErrorMatchers(
54
+ /*@__PURE__*/ S.TaggedError<MachineWaitTimeout>()("MachineWaitTimeout", {
55
+ message: S.String,
56
+ }),
57
+ [
58
+ {
59
+ message: {
60
+ matches:
61
+ "^deadline_exceeded: machine failed to reach desired state, [a-z_]+, currently [a-z_]+$",
62
+ },
63
+ },
64
+ ],
65
+ ) {}
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
+
22
90
  export interface AuthenticateTokenRequest {
23
91
  header?: string;
24
92
  }
@@ -479,11 +547,13 @@ export interface CordonMachineRequest {
479
547
  app_name: string;
480
548
  /** Machine ID */
481
549
  machine_id: string;
550
+ lease_nonce?: string;
482
551
  }
483
552
  export const CordonMachineRequest = /*@__PURE__*/ S.suspend(() =>
484
553
  S.Struct({
485
554
  app_name: S.String.pipe(T.Label()),
486
555
  machine_id: S.String.pipe(T.Label()),
556
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
487
557
  }).pipe(
488
558
  T.Http({
489
559
  method: "POST",
@@ -504,6 +574,8 @@ export const CordonMachineResponse = /*@__PURE__*/ S.suspend(() =>
504
574
 
505
575
  export interface CreateAppRequest {
506
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;
507
579
  name?: string;
508
580
  network?: string;
509
581
  org_slug?: string;
@@ -511,6 +583,7 @@ export interface CreateAppRequest {
511
583
  export const CreateAppRequest = /*@__PURE__*/ S.suspend(() =>
512
584
  S.Struct({
513
585
  enable_subdomains: S.optional(S.Boolean),
586
+ idempotency_key: S.optional(S.String),
514
587
  name: S.optional(S.String),
515
588
  network: S.optional(S.String),
516
589
  org_slug: S.optional(S.String),
@@ -519,9 +592,15 @@ export const CreateAppRequest = /*@__PURE__*/ S.suspend(() =>
519
592
  identifier: "CreateAppRequest",
520
593
  }) as any as S.Schema<CreateAppRequest>;
521
594
 
522
- export interface CreateAppResponse {}
595
+ export interface CreateAppResponse {
596
+ created_at?: number;
597
+ id?: string;
598
+ }
523
599
  export const CreateAppResponse = /*@__PURE__*/ S.suspend(() =>
524
- S.Struct({}),
600
+ S.Struct({
601
+ created_at: S.optional(S.Number),
602
+ id: S.optional(S.String),
603
+ }),
525
604
  ).annotate({
526
605
  identifier: "CreateAppResponse",
527
606
  }) as any as S.Schema<CreateAppResponse>;
@@ -691,12 +770,28 @@ export const IPPair = /*@__PURE__*/ S.suspend(() =>
691
770
  }),
692
771
  ).annotate({ identifier: "IPPair" }) as any as S.Schema<IPPair>;
693
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
+
694
788
  export interface AssignIPResponse {
695
789
  created_at?: string;
696
790
  egress?: boolean;
697
791
  ip?: string;
698
792
  /** ip_pair is returned when "egress-pair" IP type is requested; in this case, ip is null. */
699
793
  ip_pair?: IPPair;
794
+ network?: IPAssignmentNetwork | null;
700
795
  region?: string;
701
796
  service_name?: string;
702
797
  shared?: boolean;
@@ -707,6 +802,7 @@ export const AssignIPResponse = /*@__PURE__*/ S.suspend(() =>
707
802
  egress: S.optional(S.Boolean),
708
803
  ip: S.optional(S.String),
709
804
  ip_pair: S.optional(IPPair),
805
+ network: S.optional(S.NullOr(IPAssignmentNetwork)),
710
806
  region: S.optional(S.String),
711
807
  service_name: S.optional(S.String),
712
808
  shared: S.optional(S.Boolean),
@@ -1039,26 +1135,19 @@ export const FlyContainerConfigHealthchecksList = /*@__PURE__*/ S.Array(
1039
1135
  FlyContainerHealthcheck,
1040
1136
  ) as any as S.Schema<FlyContainerConfigHealthchecksList>;
1041
1137
 
1042
- /** * 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. */
1043
- export type FlyMachineRestartPolicy =
1044
- | "no"
1045
- | "always"
1046
- | "on-failure"
1047
- | "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";
1048
1140
  export const FlyMachineRestartPolicy = S.String;
1049
1141
 
1050
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/. */
1051
1143
  export interface FlyMachineRestart {
1052
- /** GPU bid price for spot Machines. */
1053
- gpu_bid_price?: number;
1054
1144
  /** When policy is on-failure, the maximum number of times to attempt to restart the Machine before letting it stop. */
1055
1145
  max_retries?: number;
1056
- /** * 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. */
1057
1147
  policy?: FlyMachineRestartPolicy | (string & {});
1058
1148
  }
1059
1149
  export const FlyMachineRestart = /*@__PURE__*/ S.suspend(() =>
1060
1150
  S.Struct({
1061
- gpu_bid_price: S.optional(S.Number),
1062
1151
  max_retries: S.optional(S.Number),
1063
1152
  policy: S.optional(FlyMachineRestartPolicy),
1064
1153
  }),
@@ -1130,7 +1219,7 @@ export interface FlyContainerConfig {
1130
1219
  image?: string;
1131
1220
  /** Name is used to identify the container in the machine. */
1132
1221
  name?: string;
1133
- /** 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. */
1134
1223
  restart?: FlyMachineRestart;
1135
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. */
1136
1225
  secrets?: FlyContainerConfigSecretsList;
@@ -1252,6 +1341,11 @@ export const FlyMachineGuestKernelArgsList = /*@__PURE__*/ S.Array(
1252
1341
  export type FlyMachineGuestPersistRootfs = "never" | "always" | "restart";
1253
1342
  export const FlyMachineGuestPersistRootfs = S.String;
1254
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
+
1255
1349
  export interface FlyMachineGuest {
1256
1350
  cpu_kind?: string;
1257
1351
  cpus?: number;
@@ -1263,6 +1357,7 @@ export interface FlyMachineGuest {
1263
1357
  memory_mb?: number;
1264
1358
  /** Deprecated: use MachineConfig.Rootfs instead */
1265
1359
  persist_rootfs?: FlyMachineGuestPersistRootfs | (string & {});
1360
+ required_host_features?: FlyMachineGuestRequiredHostFeaturesList;
1266
1361
  }
1267
1362
  export const FlyMachineGuest = /*@__PURE__*/ S.suspend(() =>
1268
1363
  S.Struct({
@@ -1275,6 +1370,7 @@ export const FlyMachineGuest = /*@__PURE__*/ S.suspend(() =>
1275
1370
  max_memory_mb: S.optional(S.Number),
1276
1371
  memory_mb: S.optional(S.Number),
1277
1372
  persist_rootfs: S.optional(FlyMachineGuestPersistRootfs),
1373
+ required_host_features: S.optional(FlyMachineGuestRequiredHostFeaturesList),
1278
1374
  }),
1279
1375
  ).annotate({
1280
1376
  identifier: "FlyMachineGuest",
@@ -1342,8 +1438,12 @@ export const FlyMachineMetrics = /*@__PURE__*/ S.suspend(() =>
1342
1438
 
1343
1439
  export interface FlyMachineMount {
1344
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;
1345
1443
  encrypted?: boolean;
1346
1444
  extend_threshold_percent?: number;
1445
+ /** MinAddSizeGb is the minimum proportional growth in GiB (default 1). */
1446
+ min_add_size_gb?: number;
1347
1447
  name?: string;
1348
1448
  path?: string;
1349
1449
  size_gb?: number;
@@ -1353,8 +1453,10 @@ export interface FlyMachineMount {
1353
1453
  export const FlyMachineMount = /*@__PURE__*/ S.suspend(() =>
1354
1454
  S.Struct({
1355
1455
  add_size_gb: S.optional(S.Number),
1456
+ add_size_percent: S.optional(S.Number),
1356
1457
  encrypted: S.optional(S.Boolean),
1357
1458
  extend_threshold_percent: S.optional(S.Number),
1459
+ min_add_size_gb: S.optional(S.Number),
1358
1460
  name: S.optional(S.String),
1359
1461
  path: S.optional(S.String),
1360
1462
  size_gb: S.optional(S.Number),
@@ -1453,8 +1555,16 @@ export const FlyMachineRootfs = /*@__PURE__*/ S.suspend(() =>
1453
1555
  }) as any as S.Schema<FlyMachineRootfs>;
1454
1556
 
1455
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. */
1456
- export type FlyMachineServiceAutostop = "off" | "stop" | "suspend";
1457
- 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]);
1458
1568
 
1459
1569
  export type FlyMachineServiceCheckHeadersList = Array<FlyMachineHTTPHeader>;
1460
1570
  export const FlyMachineServiceCheckHeadersList = /*@__PURE__*/ S.Array(
@@ -1661,7 +1771,7 @@ export const FlyMachineServicePortsList = /*@__PURE__*/ S.Array(
1661
1771
  export interface FlyMachineService {
1662
1772
  autostart?: boolean;
1663
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. */
1664
- autostop?: FlyMachineServiceAutostop | (string & {});
1774
+ autostop?: FlyMachineServiceAutostop;
1665
1775
  /** An optional list of service checks */
1666
1776
  checks?: FlyMachineServiceChecksList;
1667
1777
  concurrency?: FlyMachineServiceConcurrency;
@@ -1872,6 +1982,11 @@ export const MachineEventsList = /*@__PURE__*/ S.Array(
1872
1982
  MachineEvent,
1873
1983
  ) as any as S.Schema<MachineEventsList>;
1874
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
+
1875
1990
  export type MachineHostStatus = "ok" | "unknown" | "unreachable";
1876
1991
  export const MachineHostStatus = S.String;
1877
1992
 
@@ -1917,11 +2032,12 @@ export interface Machine {
1917
2032
  cordoned?: boolean;
1918
2033
  created_at?: string;
1919
2034
  events?: MachineEventsList;
2035
+ host_features?: MachineHostFeaturesList;
1920
2036
  host_status?: MachineHostStatus;
1921
2037
  id?: string;
1922
2038
  image_ref?: ImageRef;
1923
2039
  incomplete_config?: FlyMachineConfig;
1924
- /** InstanceID is unique for each version of the machine */
2040
+ /** InstanceID is the same value as `version`. Deprecated: use `version`. */
1925
2041
  instance_id?: string;
1926
2042
  lease?: StrippedLease;
1927
2043
  name?: string;
@@ -1932,6 +2048,8 @@ export interface Machine {
1932
2048
  region?: string;
1933
2049
  state?: string;
1934
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;
1935
2053
  }
1936
2054
  export const Machine = /*@__PURE__*/ S.suspend(() =>
1937
2055
  S.Struct({
@@ -1940,6 +2058,7 @@ export const Machine = /*@__PURE__*/ S.suspend(() =>
1940
2058
  cordoned: S.optional(S.Boolean),
1941
2059
  created_at: S.optional(S.String),
1942
2060
  events: S.optional(MachineEventsList),
2061
+ host_features: S.optional(MachineHostFeaturesList),
1943
2062
  host_status: S.optional(MachineHostStatus),
1944
2063
  id: S.optional(S.String),
1945
2064
  image_ref: S.optional(ImageRef),
@@ -1952,6 +2071,7 @@ export const Machine = /*@__PURE__*/ S.suspend(() =>
1952
2071
  region: S.optional(S.String),
1953
2072
  state: S.optional(S.String),
1954
2073
  updated_at: S.optional(S.String),
2074
+ version: S.optional(S.String),
1955
2075
  }),
1956
2076
  ).annotate({ identifier: "Machine" }) as any as S.Schema<Machine>;
1957
2077
 
@@ -1963,13 +2083,16 @@ export interface CreateMachineLeaseRequest {
1963
2083
  description?: string;
1964
2084
  /** seconds lease will be valid */
1965
2085
  ttl?: number;
2086
+ /** Existing lease nonce when refreshing; omit to acquire a new lease. Keep the nonce private. */
2087
+ lease_nonce?: string;
1966
2088
  }
1967
2089
  export const CreateMachineLeaseRequest = /*@__PURE__*/ S.suspend(() =>
1968
2090
  S.Struct({
1969
2091
  app_name: S.String.pipe(T.Label()),
1970
2092
  machine_id: S.String.pipe(T.Label()),
1971
2093
  description: S.optional(S.String),
1972
- 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"))),
1973
2096
  }).pipe(
1974
2097
  T.Http({
1975
2098
  method: "POST",
@@ -2003,11 +2126,22 @@ export const Lease = /*@__PURE__*/ S.suspend(() =>
2003
2126
  }),
2004
2127
  ).annotate({ identifier: "Lease" }) as any as S.Schema<Lease>;
2005
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
+
2006
2140
  /** Postgres major version. */
2007
2141
  export type CreatePostgresRequestPgMajorVersion = "16" | "17";
2008
2142
  export const CreatePostgresRequestPgMajorVersion = S.String;
2009
2143
 
2010
- /** Plan slug selecting CPU, memory, and disk sizing. */
2144
+ /** Plan slug selecting CPU, memory, and disk sizing. Matched case-insensitively. */
2011
2145
  export type CreatePostgresRequestPlan =
2012
2146
  | "basic"
2013
2147
  | "starter"
@@ -2025,11 +2159,11 @@ export interface CreatePostgresRequest {
2025
2159
  disk_size_gb?: number;
2026
2160
  /** Name for the cluster. A name is generated when omitted. */
2027
2161
  name?: string;
2028
- /** 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. */
2029
2163
  org_slug: string;
2030
2164
  /** Postgres major version. */
2031
2165
  pg_major_version?: CreatePostgresRequestPgMajorVersion | (string & {});
2032
- /** Plan slug selecting CPU, memory, and disk sizing. */
2166
+ /** Plan slug selecting CPU, memory, and disk sizing. Matched case-insensitively. */
2033
2167
  plan: CreatePostgresRequestPlan | (string & {});
2034
2168
  /** Connection pooler mode. */
2035
2169
  pool_mode?: CreatePostgresRequestPoolMode | (string & {});
@@ -2164,7 +2298,7 @@ export interface PostgresCluster {
2164
2298
  cpus?: number;
2165
2299
  /** RFC 3339 creation timestamp. */
2166
2300
  created_at?: string;
2167
- /** Disk size in gigabytes. */
2301
+ /** Disk size in gigabytes, for one replica. */
2168
2302
  disk_size_gb?: number;
2169
2303
  /** Connection endpoints. Populated once the cluster is ready. */
2170
2304
  endpoints?: PostgresClusterEndpoints;
@@ -2187,6 +2321,10 @@ export interface PostgresCluster {
2187
2321
  replicas?: number;
2188
2322
  /** Current lifecycle status. */
2189
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;
2190
2328
  }
2191
2329
  export const PostgresCluster = /*@__PURE__*/ S.suspend(() =>
2192
2330
  S.Struct({
@@ -2206,6 +2344,8 @@ export const PostgresCluster = /*@__PURE__*/ S.suspend(() =>
2206
2344
  region: S.optional(S.String),
2207
2345
  replicas: S.optional(S.Number),
2208
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)),
2209
2349
  }),
2210
2350
  ).annotate({
2211
2351
  identifier: "PostgresCluster",
@@ -2307,7 +2447,7 @@ export const CreatePostgresBackupResponse = /*@__PURE__*/ S.suspend(() =>
2307
2447
  export interface CreatePostgresDatabaseRequest {
2308
2448
  /** Managed Postgres Cluster ID */
2309
2449
  postgres_cluster_id: string;
2310
- /** 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. */
2311
2451
  name: string;
2312
2452
  }
2313
2453
  export const CreatePostgresDatabaseRequest = /*@__PURE__*/ S.suspend(() =>
@@ -2360,7 +2500,7 @@ export interface CreatePostgresUserRequest {
2360
2500
  postgres_cluster_id: string;
2361
2501
  /** Role to grant the user. */
2362
2502
  role: CreatePostgresUserRequestRole | (string & {});
2363
- /** 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. */
2364
2504
  username: string;
2365
2505
  }
2366
2506
  export const CreatePostgresUserRequest = /*@__PURE__*/ S.suspend(() =>
@@ -2497,9 +2637,19 @@ export const CreateVolumeRequest = /*@__PURE__*/ S.suspend(() =>
2497
2637
  identifier: "CreateVolumeRequest",
2498
2638
  }) as any as S.Schema<CreateVolumeRequest>;
2499
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
+
2500
2645
  export type VolumeHostStatus = "ok" | "unknown" | "unreachable";
2501
2646
  export const VolumeHostStatus = S.String;
2502
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
+
2503
2653
  export type VolumeType = "local" | "cache";
2504
2654
  export const VolumeType = S.String;
2505
2655
 
@@ -2516,10 +2666,12 @@ export interface Volume {
2516
2666
  created_at?: string;
2517
2667
  encrypted?: boolean;
2518
2668
  fstype?: string;
2669
+ host_features?: VolumeHostFeaturesList;
2519
2670
  host_status?: VolumeHostStatus;
2520
2671
  id?: string;
2521
2672
  name?: string;
2522
2673
  region?: string;
2674
+ required_host_features?: VolumeRequiredHostFeaturesList;
2523
2675
  size_gb?: number;
2524
2676
  snapshot_retention?: number;
2525
2677
  state?: string;
@@ -2540,10 +2692,12 @@ export const Volume = /*@__PURE__*/ S.suspend(() =>
2540
2692
  created_at: S.optional(S.String),
2541
2693
  encrypted: S.optional(S.Boolean),
2542
2694
  fstype: S.optional(S.String),
2695
+ host_features: S.optional(VolumeHostFeaturesList),
2543
2696
  host_status: S.optional(VolumeHostStatus),
2544
2697
  id: S.optional(S.String),
2545
2698
  name: S.optional(S.String),
2546
2699
  region: S.optional(S.String),
2700
+ required_host_features: S.optional(VolumeRequiredHostFeaturesList),
2547
2701
  size_gb: S.optional(S.Number),
2548
2702
  snapshot_retention: S.optional(S.Number),
2549
2703
  state: S.optional(S.String),
@@ -2790,12 +2944,14 @@ export interface DeleteMachineRequest {
2790
2944
  machine_id: string;
2791
2945
  /** Force kill the machine if it's running */
2792
2946
  force?: boolean;
2947
+ lease_nonce?: string;
2793
2948
  }
2794
2949
  export const DeleteMachineRequest = /*@__PURE__*/ S.suspend(() =>
2795
2950
  S.Struct({
2796
2951
  app_name: S.String.pipe(T.Label()),
2797
2952
  machine_id: S.String.pipe(T.Label()),
2798
2953
  force: S.optional(S.Boolean.pipe(T.Query())),
2954
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
2799
2955
  }).pipe(
2800
2956
  T.Http({
2801
2957
  method: "DELETE",
@@ -3446,6 +3602,8 @@ export interface GetMachineRequest {
3446
3602
  app_name: string;
3447
3603
  /** Machine ID */
3448
3604
  machine_id: string;
3605
+ /** 26-character Machine version ID; returns that version of the Machine instead of the current one */
3606
+ version?: string;
3449
3607
  /** Include machine lease */
3450
3608
  include_leases?: boolean;
3451
3609
  }
@@ -3453,6 +3611,7 @@ export const GetMachineRequest = /*@__PURE__*/ S.suspend(() =>
3453
3611
  S.Struct({
3454
3612
  app_name: S.String.pipe(T.Label()),
3455
3613
  machine_id: S.String.pipe(T.Label()),
3614
+ version: S.optional(S.String.pipe(T.Query())),
3456
3615
  include_leases: S.optional(S.Boolean.pipe(T.Query())),
3457
3616
  }).pipe(
3458
3617
  T.Http({
@@ -3939,6 +4098,7 @@ export interface IPAssignment {
3939
4098
  created_at?: string;
3940
4099
  egress?: boolean;
3941
4100
  ip?: string;
4101
+ network?: IPAssignmentNetwork | null;
3942
4102
  region?: string;
3943
4103
  service_name?: string;
3944
4104
  shared?: boolean;
@@ -3949,6 +4109,7 @@ export const IPAssignment = /*@__PURE__*/ S.suspend(() =>
3949
4109
  created_at: S.optional(S.String),
3950
4110
  egress: S.optional(S.Boolean),
3951
4111
  ip: S.optional(S.String),
4112
+ network: S.optional(S.NullOr(IPAssignmentNetwork)),
3952
4113
  region: S.optional(S.String),
3953
4114
  service_name: S.optional(S.String),
3954
4115
  shared: S.optional(S.Boolean),
@@ -4134,6 +4295,10 @@ export interface ListMachinesRequest {
4134
4295
  summary?: boolean;
4135
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. */
4136
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;
4137
4302
  }
4138
4303
  export const ListMachinesRequest = /*@__PURE__*/ S.suspend(() =>
4139
4304
  S.Struct({
@@ -4144,6 +4309,8 @@ export const ListMachinesRequest = /*@__PURE__*/ S.suspend(() =>
4144
4309
  state: S.optional(S.String.pipe(T.Query())),
4145
4310
  summary: S.optional(S.Boolean.pipe(T.Query())),
4146
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())),
4147
4314
  }).pipe(
4148
4315
  T.Http({ method: "GET", uri: "/v1/apps/{app_name}/machines", code: 200 }),
4149
4316
  ),
@@ -4322,7 +4489,7 @@ export const ListMachineVersionsResponse = /*@__PURE__*/ S.suspend(() =>
4322
4489
  }) as any as S.Schema<ListMachineVersionsResponse>;
4323
4490
 
4324
4491
  export interface ListPostgresRequest {
4325
- /** Fly Organization Slug */
4492
+ /** Fly Organization Slug, or 'personal' for the caller's personal organization */
4326
4493
  org_slug: string;
4327
4494
  /** Include deleted clusters */
4328
4495
  include_deleted?: boolean;
@@ -4529,20 +4696,21 @@ export const ListPostgresExtensionsRequest = /*@__PURE__*/ S.suspend(() =>
4529
4696
  identifier: "ListPostgresExtensionsRequest",
4530
4697
  }) as any as S.Schema<ListPostgresExtensionsRequest>;
4531
4698
 
4532
- export interface PostgresInstalledExtension {
4699
+ /** Installation details, or null when the extension is not installed. */
4700
+ export interface PostgresExtensionInstalled {
4533
4701
  /** Schema the extension is installed into. */
4534
4702
  schema?: string;
4535
4703
  /** Installed version. */
4536
4704
  version?: string;
4537
4705
  }
4538
- export const PostgresInstalledExtension = /*@__PURE__*/ S.suspend(() =>
4706
+ export const PostgresExtensionInstalled = /*@__PURE__*/ S.suspend(() =>
4539
4707
  S.Struct({
4540
4708
  schema: S.optional(S.String),
4541
4709
  version: S.optional(S.String),
4542
4710
  }),
4543
4711
  ).annotate({
4544
- identifier: "PostgresInstalledExtension",
4545
- }) as any as S.Schema<PostgresInstalledExtension>;
4712
+ identifier: "PostgresExtensionInstalled",
4713
+ }) as any as S.Schema<PostgresExtensionInstalled>;
4546
4714
 
4547
4715
  export interface PostgresExtension {
4548
4716
  /** Default version installed when enabled. */
@@ -4550,7 +4718,7 @@ export interface PostgresExtension {
4550
4718
  /** Human-readable description. */
4551
4719
  description?: string;
4552
4720
  /** Installation details, or null when the extension is not installed. */
4553
- installed?: PostgresInstalledExtension;
4721
+ installed?: PostgresExtensionInstalled | null;
4554
4722
  /** Extension name. */
4555
4723
  name?: string;
4556
4724
  /** Whether this is a system extension that cannot be disabled. */
@@ -4560,7 +4728,7 @@ export const PostgresExtension = /*@__PURE__*/ S.suspend(() =>
4560
4728
  S.Struct({
4561
4729
  default_version: S.optional(S.String),
4562
4730
  description: S.optional(S.String),
4563
- installed: S.optional(PostgresInstalledExtension),
4731
+ installed: S.optional(S.NullOr(PostgresExtensionInstalled)),
4564
4732
  name: S.optional(S.String),
4565
4733
  system: S.optional(S.Boolean),
4566
4734
  }),
@@ -4804,9 +4972,19 @@ export const ListVolumesOrgRequest = /*@__PURE__*/ S.suspend(() =>
4804
4972
  identifier: "ListVolumesOrgRequest",
4805
4973
  }) as any as S.Schema<ListVolumesOrgRequest>;
4806
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
+
4807
4980
  export type OrgVolumeHostStatus = "ok" | "unknown" | "unreachable";
4808
4981
  export const OrgVolumeHostStatus = S.String;
4809
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
+
4810
4988
  export type OrgVolumeType = "local" | "cache";
4811
4989
  export const OrgVolumeType = S.String;
4812
4990
 
@@ -4824,10 +5002,12 @@ export interface OrgVolume {
4824
5002
  created_at?: string;
4825
5003
  encrypted?: boolean;
4826
5004
  fstype?: string;
5005
+ host_features?: OrgVolumeHostFeaturesList;
4827
5006
  host_status?: OrgVolumeHostStatus;
4828
5007
  id?: string;
4829
5008
  name?: string;
4830
5009
  region?: string;
5010
+ required_host_features?: OrgVolumeRequiredHostFeaturesList;
4831
5011
  size_gb?: number;
4832
5012
  snapshot_retention?: number;
4833
5013
  state?: string;
@@ -4850,10 +5030,12 @@ export const OrgVolume = /*@__PURE__*/ S.suspend(() =>
4850
5030
  created_at: S.optional(S.String),
4851
5031
  encrypted: S.optional(S.Boolean),
4852
5032
  fstype: S.optional(S.String),
5033
+ host_features: S.optional(OrgVolumeHostFeaturesList),
4853
5034
  host_status: S.optional(OrgVolumeHostStatus),
4854
5035
  id: S.optional(S.String),
4855
5036
  name: S.optional(S.String),
4856
5037
  region: S.optional(S.String),
5038
+ required_host_features: S.optional(OrgVolumeRequiredHostFeaturesList),
4857
5039
  size_gb: S.optional(S.Number),
4858
5040
  snapshot_retention: S.optional(S.Number),
4859
5041
  state: S.optional(S.String),
@@ -4890,11 +5072,14 @@ export interface MachinesReleaseLeaseRequest {
4890
5072
  app_name: string;
4891
5073
  /** Machine ID */
4892
5074
  machine_id: string;
5075
+ /** Nonce of the lease to release. Keep the nonce private. */
5076
+ lease_nonce: string;
4893
5077
  }
4894
5078
  export const MachinesReleaseLeaseRequest = /*@__PURE__*/ S.suspend(() =>
4895
5079
  S.Struct({
4896
5080
  app_name: S.String.pipe(T.Label()),
4897
5081
  machine_id: S.String.pipe(T.Label()),
5082
+ lease_nonce: S.String.pipe(T.Header("fly-machine-lease-nonce")),
4898
5083
  }).pipe(
4899
5084
  T.Http({
4900
5085
  method: "DELETE",
@@ -4955,6 +5140,156 @@ export const PatchMachineMetadataResponse = /*@__PURE__*/ S.suspend(() =>
4955
5140
  identifier: "PatchMachineMetadataResponse",
4956
5141
  }) as any as S.Schema<PatchMachineMetadataResponse>;
4957
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
+
4958
5293
  export interface PostgresUsersCredentialsRequest {
4959
5294
  /** Managed Postgres Cluster ID */
4960
5295
  postgres_cluster_id: string;
@@ -5091,6 +5426,7 @@ export interface RestartMachineRequest {
5091
5426
  timeout?: string;
5092
5427
  /** Unix signal name */
5093
5428
  signal?: RestartMachineRequestSignal | (string & {});
5429
+ lease_nonce?: string;
5094
5430
  }
5095
5431
  export const RestartMachineRequest = /*@__PURE__*/ S.suspend(() =>
5096
5432
  S.Struct({
@@ -5098,6 +5434,7 @@ export const RestartMachineRequest = /*@__PURE__*/ S.suspend(() =>
5098
5434
  machine_id: S.String.pipe(T.Label()),
5099
5435
  timeout: S.optional(S.String.pipe(T.Query())),
5100
5436
  signal: S.optional(RestartMachineRequestSignal.pipe(T.Query())),
5437
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
5101
5438
  }).pipe(
5102
5439
  T.Http({
5103
5440
  method: "POST",
@@ -5320,11 +5657,13 @@ export interface StartMachineRequest {
5320
5657
  app_name: string;
5321
5658
  /** Machine ID */
5322
5659
  machine_id: string;
5660
+ lease_nonce?: string;
5323
5661
  }
5324
5662
  export const StartMachineRequest = /*@__PURE__*/ S.suspend(() =>
5325
5663
  S.Struct({
5326
5664
  app_name: S.String.pipe(T.Label()),
5327
5665
  machine_id: S.String.pipe(T.Label()),
5666
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
5328
5667
  }).pipe(
5329
5668
  T.Http({
5330
5669
  method: "POST",
@@ -5360,6 +5699,7 @@ export interface StopMachineRequest {
5360
5699
  machine_id: string;
5361
5700
  signal?: StopMachineRequestSignal | (string & {});
5362
5701
  timeout?: string;
5702
+ lease_nonce?: string;
5363
5703
  }
5364
5704
  export const StopMachineRequest = /*@__PURE__*/ S.suspend(() =>
5365
5705
  S.Struct({
@@ -5367,6 +5707,7 @@ export const StopMachineRequest = /*@__PURE__*/ S.suspend(() =>
5367
5707
  machine_id: S.String.pipe(T.Label()),
5368
5708
  signal: S.optional(StopMachineRequestSignal),
5369
5709
  timeout: S.optional(S.String),
5710
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
5370
5711
  }).pipe(
5371
5712
  T.Http({
5372
5713
  method: "POST",
@@ -5390,11 +5731,13 @@ export interface SuspendMachineRequest {
5390
5731
  app_name: string;
5391
5732
  /** Machine ID */
5392
5733
  machine_id: string;
5734
+ lease_nonce?: string;
5393
5735
  }
5394
5736
  export const SuspendMachineRequest = /*@__PURE__*/ S.suspend(() =>
5395
5737
  S.Struct({
5396
5738
  app_name: S.String.pipe(T.Label()),
5397
5739
  machine_id: S.String.pipe(T.Label()),
5740
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
5398
5741
  }).pipe(
5399
5742
  T.Http({
5400
5743
  method: "POST",
@@ -5418,11 +5761,13 @@ export interface UncordonMachineRequest {
5418
5761
  app_name: string;
5419
5762
  /** Machine ID */
5420
5763
  machine_id: string;
5764
+ lease_nonce?: string;
5421
5765
  }
5422
5766
  export const UncordonMachineRequest = /*@__PURE__*/ S.suspend(() =>
5423
5767
  S.Struct({
5424
5768
  app_name: S.String.pipe(T.Label()),
5425
5769
  machine_id: S.String.pipe(T.Label()),
5770
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
5426
5771
  }).pipe(
5427
5772
  T.Http({
5428
5773
  method: "POST",
@@ -5448,6 +5793,7 @@ export interface UpdateMachineRequest {
5448
5793
  machine_id: string;
5449
5794
  /** An object defining the Machine configuration */
5450
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. */
5451
5797
  current_version?: string;
5452
5798
  lease_ttl?: number;
5453
5799
  min_secrets_version?: number;
@@ -5458,6 +5804,7 @@ export interface UpdateMachineRequest {
5458
5804
  skip_launch?: boolean;
5459
5805
  skip_secrets?: boolean;
5460
5806
  skip_service_registration?: boolean;
5807
+ lease_nonce?: string;
5461
5808
  }
5462
5809
  export const UpdateMachineRequest = /*@__PURE__*/ S.suspend(() =>
5463
5810
  S.Struct({
@@ -5472,6 +5819,7 @@ export const UpdateMachineRequest = /*@__PURE__*/ S.suspend(() =>
5472
5819
  skip_launch: S.optional(S.Boolean),
5473
5820
  skip_secrets: S.optional(S.Boolean),
5474
5821
  skip_service_registration: S.optional(S.Boolean),
5822
+ lease_nonce: S.optional(S.String.pipe(T.Header("fly-machine-lease-nonce"))),
5475
5823
  }).pipe(
5476
5824
  T.Http({
5477
5825
  method: "POST",
@@ -5483,48 +5831,6 @@ export const UpdateMachineRequest = /*@__PURE__*/ S.suspend(() =>
5483
5831
  identifier: "UpdateMachineRequest",
5484
5832
  }) as any as S.Schema<UpdateMachineRequest>;
5485
5833
 
5486
- export type UpdateMachineMetadataRequestMetadataMap = {
5487
- [key: string]: string | undefined;
5488
- };
5489
- export const UpdateMachineMetadataRequestMetadataMap = /*@__PURE__*/ S.Record(
5490
- S.String,
5491
- S.String,
5492
- ) as any as S.Schema<UpdateMachineMetadataRequestMetadataMap>;
5493
-
5494
- export interface UpdateMachineMetadataRequest {
5495
- /** Fly App Name */
5496
- app_name: string;
5497
- /** Machine ID */
5498
- machine_id: string;
5499
- machine_version?: string;
5500
- metadata?: UpdateMachineMetadataRequestMetadataMap;
5501
- updated_at?: string;
5502
- }
5503
- export const UpdateMachineMetadataRequest = /*@__PURE__*/ S.suspend(() =>
5504
- S.Struct({
5505
- app_name: S.String.pipe(T.Label()),
5506
- machine_id: S.String.pipe(T.Label()),
5507
- machine_version: S.optional(S.String),
5508
- metadata: S.optional(UpdateMachineMetadataRequestMetadataMap),
5509
- updated_at: S.optional(S.String),
5510
- }).pipe(
5511
- T.Http({
5512
- method: "PUT",
5513
- uri: "/v1/apps/{app_name}/machines/{machine_id}/metadata",
5514
- code: 200,
5515
- }),
5516
- ),
5517
- ).annotate({
5518
- identifier: "UpdateMachineMetadataRequest",
5519
- }) as any as S.Schema<UpdateMachineMetadataRequest>;
5520
-
5521
- export interface UpdateMachineMetadataResponse {}
5522
- export const UpdateMachineMetadataResponse = /*@__PURE__*/ S.suspend(() =>
5523
- S.Struct({}),
5524
- ).annotate({
5525
- identifier: "UpdateMachineMetadataResponse",
5526
- }) as any as S.Schema<UpdateMachineMetadataResponse>;
5527
-
5528
5834
  /** New role for the user. */
5529
5835
  export type UpdatePostgresUserRoleRequestRole =
5530
5836
  | "schema_admin"
@@ -5818,6 +6124,7 @@ export type CordonMachineError =
5818
6124
  | BadRequest
5819
6125
  | Forbidden
5820
6126
  | NotFound
6127
+ | Conflict
5821
6128
  | FlyIoOpError;
5822
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. */
5823
6130
  export const cordonMachine: API.OperationMethod<
@@ -5828,7 +6135,7 @@ export const cordonMachine: API.OperationMethod<
5828
6135
  > = /*@__PURE__*/ API.make(() => ({
5829
6136
  input: CordonMachineRequest,
5830
6137
  output: CordonMachineResponse,
5831
- errors: [BadRequest, Forbidden, NotFound],
6138
+ errors: [BadRequest, Forbidden, NotFound, Conflict],
5832
6139
  protocol: FlyIoProtocol,
5833
6140
  retry: Retry.Retry,
5834
6141
  }));
@@ -5920,6 +6227,7 @@ export type CreateAppIPAssignmentError =
5920
6227
  | Forbidden
5921
6228
  | NotFound
5922
6229
  | Conflict
6230
+ | NetworkNotFound
5923
6231
  | FlyIoOpError;
5924
6232
  /** Assign new IP address to app */
5925
6233
  export const createAppIPAssignment: API.OperationMethod<
@@ -5930,7 +6238,7 @@ export const createAppIPAssignment: API.OperationMethod<
5930
6238
  > = /*@__PURE__*/ API.make(() => ({
5931
6239
  input: CreateAppIPAssignmentRequest,
5932
6240
  output: AssignIPResponse,
5933
- errors: [BadRequest, Forbidden, NotFound, Conflict],
6241
+ errors: [BadRequest, Forbidden, NotFound, Conflict, NetworkNotFound],
5934
6242
  protocol: FlyIoProtocol,
5935
6243
  retry: Retry.Retry,
5936
6244
  }));
@@ -5959,17 +6267,18 @@ export type CreateMachineLeaseError =
5959
6267
  | BadRequest
5960
6268
  | Forbidden
5961
6269
  | NotFound
6270
+ | Conflict
5962
6271
  | FlyIoOpError;
5963
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. */
5964
6273
  export const createMachineLease: API.OperationMethod<
5965
6274
  CreateMachineLeaseRequest,
5966
- Lease,
6275
+ MachineLease,
5967
6276
  CreateMachineLeaseError,
5968
6277
  FlyIoOpContext
5969
6278
  > = /*@__PURE__*/ API.make(() => ({
5970
6279
  input: CreateMachineLeaseRequest,
5971
- output: Lease,
5972
- errors: [BadRequest, Forbidden, NotFound],
6280
+ output: MachineLease,
6281
+ errors: [BadRequest, Forbidden, NotFound, Conflict],
5973
6282
  protocol: FlyIoProtocol,
5974
6283
  retry: Retry.Retry,
5975
6284
  }));
@@ -5979,7 +6288,7 @@ export type CreatePostgresError =
5979
6288
  | NotFound
5980
6289
  | UnprocessableEntity
5981
6290
  | FlyIoOpError;
5982
- /** 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. */
5983
6292
  export const createPostgres: API.OperationMethod<
5984
6293
  CreatePostgresRequest,
5985
6294
  ShowPostgresClusterResponse,
@@ -5994,7 +6303,7 @@ export const createPostgres: API.OperationMethod<
5994
6303
  }));
5995
6304
 
5996
6305
  export type CreatePostgresAttachmentError = NotFound | FlyIoOpError;
5997
- /** 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. */
5998
6307
  export const createPostgresAttachment: API.OperationMethod<
5999
6308
  CreatePostgresAttachmentRequest,
6000
6309
  CreatePostgresAttachmentResponse,
@@ -6339,7 +6648,12 @@ export const deleteSecretKey: API.OperationMethod<
6339
6648
  retry: Retry.Retry,
6340
6649
  }));
6341
6650
 
6342
- export type DeleteVolumeError = Forbidden | NotFound | Conflict | FlyIoOpError;
6651
+ export type DeleteVolumeError =
6652
+ | Forbidden
6653
+ | NotFound
6654
+ | Conflict
6655
+ | VolumeAttached
6656
+ | FlyIoOpError;
6343
6657
  /** Destroy Volume Delete a specific volume within an app by volume ID. */
6344
6658
  export const deleteVolume: API.OperationMethod<
6345
6659
  DeleteVolumeRequest,
@@ -6349,7 +6663,7 @@ export const deleteVolume: API.OperationMethod<
6349
6663
  > = /*@__PURE__*/ API.make(() => ({
6350
6664
  input: DeleteVolumeRequest,
6351
6665
  output: Volume,
6352
- errors: [Forbidden, NotFound, Conflict],
6666
+ errors: [Forbidden, NotFound, Conflict, VolumeAttached],
6353
6667
  protocol: FlyIoProtocol,
6354
6668
  retry: Retry.Retry,
6355
6669
  }));
@@ -6412,7 +6726,12 @@ export const encryptSecretKey: API.OperationMethod<
6412
6726
  retry: Retry.Retry,
6413
6727
  }));
6414
6728
 
6415
- export type ExecMachineError = BadRequest | Forbidden | NotFound | FlyIoOpError;
6729
+ export type ExecMachineError =
6730
+ | BadRequest
6731
+ | Forbidden
6732
+ | NotFound
6733
+ | Conflict
6734
+ | FlyIoOpError;
6416
6735
  /** Execute Command Execute a command on a specific Machine and return the raw command output bytes. */
6417
6736
  export const execMachine: API.OperationMethod<
6418
6737
  ExecMachineRequest,
@@ -6422,7 +6741,7 @@ export const execMachine: API.OperationMethod<
6422
6741
  > = /*@__PURE__*/ API.make(() => ({
6423
6742
  input: ExecMachineRequest,
6424
6743
  output: Flydv1ExecResponse,
6425
- errors: [BadRequest, Forbidden, NotFound],
6744
+ errors: [BadRequest, Forbidden, NotFound, Conflict],
6426
6745
  protocol: FlyIoProtocol,
6427
6746
  retry: Retry.Retry,
6428
6747
  }));
@@ -6550,12 +6869,12 @@ export type GetMachineLeaseError = Forbidden | NotFound | FlyIoOpError;
6550
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. */
6551
6870
  export const getMachineLease: API.OperationMethod<
6552
6871
  GetMachineLeaseRequest,
6553
- Lease,
6872
+ MachineLease,
6554
6873
  GetMachineLeaseError,
6555
6874
  FlyIoOpContext
6556
6875
  > = /*@__PURE__*/ API.make(() => ({
6557
6876
  input: GetMachineLeaseRequest,
6558
- output: Lease,
6877
+ output: MachineLease,
6559
6878
  errors: [Forbidden, NotFound],
6560
6879
  protocol: FlyIoProtocol,
6561
6880
  retry: Retry.Retry,
@@ -6820,7 +7139,11 @@ export const listMachineVersions: API.OperationMethod<
6820
7139
  retry: Retry.Retry,
6821
7140
  }));
6822
7141
 
6823
- export type ListPostgresError = NotFound | UnprocessableEntity | FlyIoOpError;
7142
+ export type ListPostgresError =
7143
+ | BadRequest
7144
+ | NotFound
7145
+ | UnprocessableEntity
7146
+ | FlyIoOpError;
6824
7147
  /** List Postgres Clusters List Managed Postgres clusters for an organization. */
6825
7148
  export const listPostgres: API.OperationMethod<
6826
7149
  ListPostgresRequest,
@@ -6830,7 +7153,7 @@ export const listPostgres: API.OperationMethod<
6830
7153
  > = /*@__PURE__*/ API.make(() => ({
6831
7154
  input: ListPostgresRequest,
6832
7155
  output: ListPostgresClustersResponse,
6833
- errors: [NotFound, UnprocessableEntity],
7156
+ errors: [BadRequest, NotFound, UnprocessableEntity],
6834
7157
  protocol: FlyIoProtocol,
6835
7158
  retry: Retry.Retry,
6836
7159
  }));
@@ -6985,8 +7308,12 @@ export const machinesReleaseLease: API.OperationMethod<
6985
7308
  retry: Retry.Retry,
6986
7309
  }));
6987
7310
 
6988
- export type PatchMachineMetadataError = BadRequest | FlyIoOpError;
6989
- /** 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. */
6990
7317
  export const patchMachineMetadata: API.OperationMethod<
6991
7318
  PatchMachineMetadataRequest,
6992
7319
  PatchMachineMetadataResponse,
@@ -6995,7 +7322,43 @@ export const patchMachineMetadata: API.OperationMethod<
6995
7322
  > = /*@__PURE__*/ API.make(() => ({
6996
7323
  input: PatchMachineMetadataRequest,
6997
7324
  output: PatchMachineMetadataResponse,
6998
- 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],
6999
7362
  protocol: FlyIoProtocol,
7000
7363
  retry: Retry.Retry,
7001
7364
  }));
@@ -7079,6 +7442,7 @@ export type RestartMachineError =
7079
7442
  | BadRequest
7080
7443
  | Forbidden
7081
7444
  | NotFound
7445
+ | Conflict
7082
7446
  | FlyIoOpError;
7083
7447
  /** Restart Machine Restart a specific Machine within an app, with an optional timeout parameter. */
7084
7448
  export const restartMachine: API.OperationMethod<
@@ -7089,7 +7453,7 @@ export const restartMachine: API.OperationMethod<
7089
7453
  > = /*@__PURE__*/ API.make(() => ({
7090
7454
  input: RestartMachineRequest,
7091
7455
  output: RestartMachineResponse,
7092
- errors: [BadRequest, Forbidden, NotFound],
7456
+ errors: [BadRequest, Forbidden, NotFound, Conflict],
7093
7457
  protocol: FlyIoProtocol,
7094
7458
  retry: Retry.Retry,
7095
7459
  }));
@@ -7214,6 +7578,8 @@ export type StartMachineError =
7214
7578
  | Forbidden
7215
7579
  | NotFound
7216
7580
  | Conflict
7581
+ | MachineStartFromCreatedState
7582
+ | MachineReplacing
7217
7583
  | FlyIoOpError;
7218
7584
  /** Start Machine Start a specific Machine within an app. */
7219
7585
  export const startMachine: API.OperationMethod<
@@ -7224,12 +7590,24 @@ export const startMachine: API.OperationMethod<
7224
7590
  > = /*@__PURE__*/ API.make(() => ({
7225
7591
  input: StartMachineRequest,
7226
7592
  output: StartMachineResponse,
7227
- errors: [BadRequest, Forbidden, NotFound, Conflict],
7593
+ errors: [
7594
+ BadRequest,
7595
+ Forbidden,
7596
+ NotFound,
7597
+ Conflict,
7598
+ MachineStartFromCreatedState,
7599
+ MachineReplacing,
7600
+ ],
7228
7601
  protocol: FlyIoProtocol,
7229
7602
  retry: Retry.Retry,
7230
7603
  }));
7231
7604
 
7232
- export type StopMachineError = BadRequest | Forbidden | NotFound | FlyIoOpError;
7605
+ export type StopMachineError =
7606
+ | BadRequest
7607
+ | Forbidden
7608
+ | NotFound
7609
+ | Conflict
7610
+ | FlyIoOpError;
7233
7611
  /** Stop Machine Stop a specific Machine within an app, with an optional request body to specify signal and timeout. */
7234
7612
  export const stopMachine: API.OperationMethod<
7235
7613
  StopMachineRequest,
@@ -7239,7 +7617,7 @@ export const stopMachine: API.OperationMethod<
7239
7617
  > = /*@__PURE__*/ API.make(() => ({
7240
7618
  input: StopMachineRequest,
7241
7619
  output: StopMachineResponse,
7242
- errors: [BadRequest, Forbidden, NotFound],
7620
+ errors: [BadRequest, Forbidden, NotFound, Conflict],
7243
7621
  protocol: FlyIoProtocol,
7244
7622
  retry: Retry.Retry,
7245
7623
  }));
@@ -7248,6 +7626,7 @@ export type SuspendMachineError =
7248
7626
  | BadRequest
7249
7627
  | Forbidden
7250
7628
  | NotFound
7629
+ | Conflict
7251
7630
  | FlyIoOpError;
7252
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. */
7253
7632
  export const suspendMachine: API.OperationMethod<
@@ -7258,7 +7637,7 @@ export const suspendMachine: API.OperationMethod<
7258
7637
  > = /*@__PURE__*/ API.make(() => ({
7259
7638
  input: SuspendMachineRequest,
7260
7639
  output: SuspendMachineResponse,
7261
- errors: [BadRequest, Forbidden, NotFound],
7640
+ errors: [BadRequest, Forbidden, NotFound, Conflict],
7262
7641
  protocol: FlyIoProtocol,
7263
7642
  retry: Retry.Retry,
7264
7643
  }));
@@ -7267,6 +7646,7 @@ export type UncordonMachineError =
7267
7646
  | BadRequest
7268
7647
  | Forbidden
7269
7648
  | NotFound
7649
+ | Conflict
7270
7650
  | FlyIoOpError;
7271
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. */
7272
7652
  export const uncordonMachine: API.OperationMethod<
@@ -7277,7 +7657,7 @@ export const uncordonMachine: API.OperationMethod<
7277
7657
  > = /*@__PURE__*/ API.make(() => ({
7278
7658
  input: UncordonMachineRequest,
7279
7659
  output: UncordonMachineResponse,
7280
- errors: [BadRequest, Forbidden, NotFound],
7660
+ errors: [BadRequest, Forbidden, NotFound, Conflict],
7281
7661
  protocol: FlyIoProtocol,
7282
7662
  retry: Retry.Retry,
7283
7663
  }));
@@ -7302,25 +7682,6 @@ export const updateMachine: API.OperationMethod<
7302
7682
  retry: Retry.Retry,
7303
7683
  }));
7304
7684
 
7305
- export type UpdateMachineMetadataError =
7306
- | BadRequest
7307
- | Forbidden
7308
- | NotFound
7309
- | FlyIoOpError;
7310
- /** 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 const updateMachineMetadata: API.OperationMethod<
7312
- UpdateMachineMetadataRequest,
7313
- UpdateMachineMetadataResponse,
7314
- UpdateMachineMetadataError,
7315
- FlyIoOpContext
7316
- > = /*@__PURE__*/ API.make(() => ({
7317
- input: UpdateMachineMetadataRequest,
7318
- output: UpdateMachineMetadataResponse,
7319
- errors: [BadRequest, Forbidden, NotFound],
7320
- protocol: FlyIoProtocol,
7321
- retry: Retry.Retry,
7322
- }));
7323
-
7324
7685
  export type UpdatePostgresUserRoleError =
7325
7686
  | BadRequest
7326
7687
  | NotFound
@@ -7422,6 +7783,7 @@ export type WaitMachineError =
7422
7783
  | Forbidden
7423
7784
  | NotFound
7424
7785
  | GatewayTimeout
7786
+ | MachineWaitTimeout
7425
7787
  | FlyIoOpError;
7426
7788
  /** Wait for State Wait for a Machine to reach a specific state. Specify the desired state with the state parameter. See the [Machine states table](https://fly.io/docs/machines/working-with-machines/#machine-states) for a list of possible states. The default for this parameter is `started`. This request will block for up to 60 seconds. Set a shorter timeout with the timeout parameter. */
7427
7789
  export const waitMachine: API.OperationMethod<
@@ -7432,7 +7794,7 @@ export const waitMachine: API.OperationMethod<
7432
7794
  > = /*@__PURE__*/ API.make(() => ({
7433
7795
  input: WaitMachineRequest,
7434
7796
  output: WaitMachineResponse,
7435
- errors: [BadRequest, Forbidden, NotFound, GatewayTimeout],
7797
+ errors: [BadRequest, Forbidden, NotFound, GatewayTimeout, MachineWaitTimeout],
7436
7798
  protocol: FlyIoProtocol,
7437
7799
  retry: Retry.Retry,
7438
7800
  }));