22
33from __future__ import annotations
44
5- from typing import Dict , Iterable
5+ from typing import Dict , Union , Iterable
6+ from datetime import datetime
67from typing_extensions import Literal
78
89import httpx
@@ -126,6 +127,7 @@ def create(
126127 disk_io_bps : str | Omit = omit ,
127128 entrypoint : SequenceNotStr [str ] | Omit = omit ,
128129 env : Dict [str , str ] | Omit = omit ,
130+ expires_at : Union [str , datetime ] | Omit = omit ,
129131 gpu : instance_create_params .GPU | Omit = omit ,
130132 health_check : HealthCheckParam | Omit = omit ,
131133 hotplug_size : str | Omit = omit ,
@@ -139,6 +141,7 @@ def create(
139141 skip_kernel_headers : bool | Omit = omit ,
140142 snapshot_policy : SnapshotPolicyParam | Omit = omit ,
141143 tags : Dict [str , str ] | Omit = omit ,
144+ ttl : str | Omit = omit ,
142145 vcpus : int | Omit = omit ,
143146 volumes : Iterable [VolumeMountParam ] | Omit = omit ,
144147 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -178,6 +181,9 @@ def create(
178181
179182 env: Environment variables
180183
184+ expires_at: Absolute expiration time. Must be in the future and is mutually exclusive with
185+ ttl.
186+
181187 gpu: GPU configuration for the instance
182188
183189 health_check: Workload health check policy. Health is reported separately from instance
@@ -219,6 +225,10 @@ def create(
219225
220226 tags: User-defined key-value tags.
221227
228+ ttl: Relative lifetime from instance creation, in Go duration format. Use "0s" or
229+ omit both expiration fields to disable automatic expiration. Mutually exclusive
230+ with expires_at.
231+
222232 vcpus: Number of virtual CPUs
223233
224234 volumes: Volumes to attach to the instance at creation time
@@ -244,6 +254,7 @@ def create(
244254 "disk_io_bps" : disk_io_bps ,
245255 "entrypoint" : entrypoint ,
246256 "env" : env ,
257+ "expires_at" : expires_at ,
247258 "gpu" : gpu ,
248259 "health_check" : health_check ,
249260 "hotplug_size" : hotplug_size ,
@@ -257,6 +268,7 @@ def create(
257268 "skip_kernel_headers" : skip_kernel_headers ,
258269 "snapshot_policy" : snapshot_policy ,
259270 "tags" : tags ,
271+ "ttl" : ttl ,
260272 "vcpus" : vcpus ,
261273 "volumes" : volumes ,
262274 },
@@ -274,20 +286,21 @@ def update(
274286 * ,
275287 auto_standby : AutoStandbyPolicyParam | Omit = omit ,
276288 env : Dict [str , str ] | Omit = omit ,
289+ expires_at : Union [str , datetime ] | Omit = omit ,
277290 health_check : HealthCheckParam | Omit = omit ,
278291 restart_policy : RestartPolicyParam | Omit = omit ,
292+ ttl : str | Omit = omit ,
279293 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
280294 # The extra values given here take precedence over values defined on the client or passed to this method.
281295 extra_headers : Headers | None = None ,
282296 extra_query : Query | None = None ,
283297 extra_body : Body | None = None ,
284298 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
285299 ) -> Instance :
286- """Update mutable properties of a running instance.
300+ """Update mutable instance properties .
287301
288- Currently supports updating
289- only the environment variables referenced by existing credential policies,
290- enabling secret/key rotation without instance restart.
302+ TTL values are relative to when the update
303+ is committed. Expiration updates are rejected after the current deadline passes.
291304
292305 Args:
293306 auto_standby: Linux-only automatic standby policy based on active inbound TCP connections
@@ -297,11 +310,17 @@ def update(
297310 the instance's existing credential `source.env` bindings are accepted. Use this
298311 to rotate real credential values without restarting the VM.
299312
313+ expires_at: Absolute expiration time. Must be in the future and is mutually exclusive with
314+ ttl.
315+
300316 health_check: Workload health check policy. Health is reported separately from instance
301317 lifecycle state.
302318
303319 restart_policy: Whole-instance restart supervision policy.
304320
321+ ttl: Relative lifetime from when this update is committed, in Go duration format. Use
322+ "0s" to disable automatic expiration. Mutually exclusive with expires_at.
323+
305324 extra_headers: Send extra headers
306325
307326 extra_query: Add additional query parameters to the request
@@ -318,8 +337,10 @@ def update(
318337 {
319338 "auto_standby" : auto_standby ,
320339 "env" : env ,
340+ "expires_at" : expires_at ,
321341 "health_check" : health_check ,
322342 "restart_policy" : restart_policy ,
343+ "ttl" : ttl ,
323344 },
324345 instance_update_params .InstanceUpdateParams ,
325346 ),
@@ -919,6 +940,7 @@ async def create(
919940 disk_io_bps : str | Omit = omit ,
920941 entrypoint : SequenceNotStr [str ] | Omit = omit ,
921942 env : Dict [str , str ] | Omit = omit ,
943+ expires_at : Union [str , datetime ] | Omit = omit ,
922944 gpu : instance_create_params .GPU | Omit = omit ,
923945 health_check : HealthCheckParam | Omit = omit ,
924946 hotplug_size : str | Omit = omit ,
@@ -932,6 +954,7 @@ async def create(
932954 skip_kernel_headers : bool | Omit = omit ,
933955 snapshot_policy : SnapshotPolicyParam | Omit = omit ,
934956 tags : Dict [str , str ] | Omit = omit ,
957+ ttl : str | Omit = omit ,
935958 vcpus : int | Omit = omit ,
936959 volumes : Iterable [VolumeMountParam ] | Omit = omit ,
937960 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -971,6 +994,9 @@ async def create(
971994
972995 env: Environment variables
973996
997+ expires_at: Absolute expiration time. Must be in the future and is mutually exclusive with
998+ ttl.
999+
9741000 gpu: GPU configuration for the instance
9751001
9761002 health_check: Workload health check policy. Health is reported separately from instance
@@ -1012,6 +1038,10 @@ async def create(
10121038
10131039 tags: User-defined key-value tags.
10141040
1041+ ttl: Relative lifetime from instance creation, in Go duration format. Use "0s" or
1042+ omit both expiration fields to disable automatic expiration. Mutually exclusive
1043+ with expires_at.
1044+
10151045 vcpus: Number of virtual CPUs
10161046
10171047 volumes: Volumes to attach to the instance at creation time
@@ -1037,6 +1067,7 @@ async def create(
10371067 "disk_io_bps" : disk_io_bps ,
10381068 "entrypoint" : entrypoint ,
10391069 "env" : env ,
1070+ "expires_at" : expires_at ,
10401071 "gpu" : gpu ,
10411072 "health_check" : health_check ,
10421073 "hotplug_size" : hotplug_size ,
@@ -1050,6 +1081,7 @@ async def create(
10501081 "skip_kernel_headers" : skip_kernel_headers ,
10511082 "snapshot_policy" : snapshot_policy ,
10521083 "tags" : tags ,
1084+ "ttl" : ttl ,
10531085 "vcpus" : vcpus ,
10541086 "volumes" : volumes ,
10551087 },
@@ -1067,20 +1099,21 @@ async def update(
10671099 * ,
10681100 auto_standby : AutoStandbyPolicyParam | Omit = omit ,
10691101 env : Dict [str , str ] | Omit = omit ,
1102+ expires_at : Union [str , datetime ] | Omit = omit ,
10701103 health_check : HealthCheckParam | Omit = omit ,
10711104 restart_policy : RestartPolicyParam | Omit = omit ,
1105+ ttl : str | Omit = omit ,
10721106 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
10731107 # The extra values given here take precedence over values defined on the client or passed to this method.
10741108 extra_headers : Headers | None = None ,
10751109 extra_query : Query | None = None ,
10761110 extra_body : Body | None = None ,
10771111 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
10781112 ) -> Instance :
1079- """Update mutable properties of a running instance.
1113+ """Update mutable instance properties .
10801114
1081- Currently supports updating
1082- only the environment variables referenced by existing credential policies,
1083- enabling secret/key rotation without instance restart.
1115+ TTL values are relative to when the update
1116+ is committed. Expiration updates are rejected after the current deadline passes.
10841117
10851118 Args:
10861119 auto_standby: Linux-only automatic standby policy based on active inbound TCP connections
@@ -1090,11 +1123,17 @@ async def update(
10901123 the instance's existing credential `source.env` bindings are accepted. Use this
10911124 to rotate real credential values without restarting the VM.
10921125
1126+ expires_at: Absolute expiration time. Must be in the future and is mutually exclusive with
1127+ ttl.
1128+
10931129 health_check: Workload health check policy. Health is reported separately from instance
10941130 lifecycle state.
10951131
10961132 restart_policy: Whole-instance restart supervision policy.
10971133
1134+ ttl: Relative lifetime from when this update is committed, in Go duration format. Use
1135+ "0s" to disable automatic expiration. Mutually exclusive with expires_at.
1136+
10981137 extra_headers: Send extra headers
10991138
11001139 extra_query: Add additional query parameters to the request
@@ -1111,8 +1150,10 @@ async def update(
11111150 {
11121151 "auto_standby" : auto_standby ,
11131152 "env" : env ,
1153+ "expires_at" : expires_at ,
11141154 "health_check" : health_check ,
11151155 "restart_policy" : restart_policy ,
1156+ "ttl" : ttl ,
11161157 },
11171158 instance_update_params .InstanceUpdateParams ,
11181159 ),
0 commit comments