Skip to content

Commit 95c62ac

Browse files
feat(blueprint): Set cilium network policy on blueprint build (#7006)
1 parent 7a57030 commit 95c62ac

11 files changed

Lines changed: 86 additions & 20 deletions

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 103
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-8ebd9dbfacb180ec9c980f5e46a814b0c8a3cb6063136db18780271d33a8dfa6.yml
3-
openapi_spec_hash: 12d4edec72b722945bade9419636d63e
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-eac4defbf39825fa88e0be11955be80cd004bcea46398be52f79800570539be0.yml
3+
openapi_spec_hash: d18585a489895642807922dfa558226d
44
config_hash: ec63e62d4660c9c924b39a8671c2fdb1

src/runloop_api_client/resources/blueprints.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ def create(
136136
file_mounts: Optional[Dict[str, str]] | Omit = omit,
137137
launch_parameters: Optional[LaunchParameters] | Omit = omit,
138138
metadata: Optional[Dict[str, str]] | Omit = omit,
139+
network_policy_id: Optional[str] | Omit = omit,
139140
secrets: Optional[Dict[str, str]] | Omit = omit,
140141
services: Optional[Iterable[blueprint_create_params.Service]] | Omit = omit,
141142
system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
@@ -179,6 +180,12 @@ def create(
179180
180181
metadata: (Optional) User defined metadata for the Blueprint.
181182
183+
network_policy_id: (Optional) ID of the network policy to apply during blueprint build. This
184+
restricts network access during the build process. This does not affect devboxes
185+
created from this blueprint; if you want devboxes created from this blueprint to
186+
inherit the network policy, set the network_policy_id on the blueprint launch
187+
parameters.
188+
182189
secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
183190
will be available to commands during the build. Secrets are NOT stored in the
184191
blueprint image. Example: {"DB_PASS": "DATABASE_PASSWORD"} makes the secret
@@ -218,6 +225,7 @@ def create(
218225
"file_mounts": file_mounts,
219226
"launch_parameters": launch_parameters,
220227
"metadata": metadata,
228+
"network_policy_id": network_policy_id,
221229
"secrets": secrets,
222230
"services": services,
223231
"system_setup_commands": system_setup_commands,
@@ -489,6 +497,7 @@ def create_from_inspection(
489497
file_mounts: Optional[Dict[str, str]] | Omit = omit,
490498
launch_parameters: Optional[LaunchParameters] | Omit = omit,
491499
metadata: Optional[Dict[str, str]] | Omit = omit,
500+
network_policy_id: Optional[str] | Omit = omit,
492501
secrets: Optional[Dict[str, str]] | Omit = omit,
493502
system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
494503
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -516,6 +525,9 @@ def create_from_inspection(
516525
517526
metadata: (Optional) User defined metadata for the Blueprint.
518527
528+
network_policy_id: (Optional) ID of the network policy to apply during blueprint build. This
529+
restricts network access during the build process.
530+
519531
secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
520532
can be used as environment variables in system_setup_commands. Example:
521533
{"GITHUB_TOKEN": "gh_secret"} makes 'gh_secret' available as GITHUB_TOKEN.
@@ -541,6 +553,7 @@ def create_from_inspection(
541553
"file_mounts": file_mounts,
542554
"launch_parameters": launch_parameters,
543555
"metadata": metadata,
556+
"network_policy_id": network_policy_id,
544557
"secrets": secrets,
545558
"system_setup_commands": system_setup_commands,
546559
},
@@ -657,6 +670,7 @@ def preview(
657670
file_mounts: Optional[Dict[str, str]] | Omit = omit,
658671
launch_parameters: Optional[LaunchParameters] | Omit = omit,
659672
metadata: Optional[Dict[str, str]] | Omit = omit,
673+
network_policy_id: Optional[str] | Omit = omit,
660674
secrets: Optional[Dict[str, str]] | Omit = omit,
661675
services: Optional[Iterable[blueprint_preview_params.Service]] | Omit = omit,
662676
system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
@@ -698,6 +712,12 @@ def preview(
698712
699713
metadata: (Optional) User defined metadata for the Blueprint.
700714
715+
network_policy_id: (Optional) ID of the network policy to apply during blueprint build. This
716+
restricts network access during the build process. This does not affect devboxes
717+
created from this blueprint; if you want devboxes created from this blueprint to
718+
inherit the network policy, set the network_policy_id on the blueprint launch
719+
parameters.
720+
701721
secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
702722
will be available to commands during the build. Secrets are NOT stored in the
703723
blueprint image. Example: {"DB_PASS": "DATABASE_PASSWORD"} makes the secret
@@ -733,6 +753,7 @@ def preview(
733753
"file_mounts": file_mounts,
734754
"launch_parameters": launch_parameters,
735755
"metadata": metadata,
756+
"network_policy_id": network_policy_id,
736757
"secrets": secrets,
737758
"services": services,
738759
"system_setup_commands": system_setup_commands,
@@ -783,6 +804,7 @@ async def create(
783804
file_mounts: Optional[Dict[str, str]] | Omit = omit,
784805
launch_parameters: Optional[LaunchParameters] | Omit = omit,
785806
metadata: Optional[Dict[str, str]] | Omit = omit,
807+
network_policy_id: Optional[str] | Omit = omit,
786808
secrets: Optional[Dict[str, str]] | Omit = omit,
787809
services: Optional[Iterable[blueprint_create_params.Service]] | Omit = omit,
788810
system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
@@ -826,6 +848,12 @@ async def create(
826848
827849
metadata: (Optional) User defined metadata for the Blueprint.
828850
851+
network_policy_id: (Optional) ID of the network policy to apply during blueprint build. This
852+
restricts network access during the build process. This does not affect devboxes
853+
created from this blueprint; if you want devboxes created from this blueprint to
854+
inherit the network policy, set the network_policy_id on the blueprint launch
855+
parameters.
856+
829857
secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
830858
will be available to commands during the build. Secrets are NOT stored in the
831859
blueprint image. Example: {"DB_PASS": "DATABASE_PASSWORD"} makes the secret
@@ -865,6 +893,7 @@ async def create(
865893
"file_mounts": file_mounts,
866894
"launch_parameters": launch_parameters,
867895
"metadata": metadata,
896+
"network_policy_id": network_policy_id,
868897
"secrets": secrets,
869898
"services": services,
870899
"system_setup_commands": system_setup_commands,
@@ -1136,6 +1165,7 @@ async def create_from_inspection(
11361165
file_mounts: Optional[Dict[str, str]] | Omit = omit,
11371166
launch_parameters: Optional[LaunchParameters] | Omit = omit,
11381167
metadata: Optional[Dict[str, str]] | Omit = omit,
1168+
network_policy_id: Optional[str] | Omit = omit,
11391169
secrets: Optional[Dict[str, str]] | Omit = omit,
11401170
system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
11411171
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1163,6 +1193,9 @@ async def create_from_inspection(
11631193
11641194
metadata: (Optional) User defined metadata for the Blueprint.
11651195
1196+
network_policy_id: (Optional) ID of the network policy to apply during blueprint build. This
1197+
restricts network access during the build process.
1198+
11661199
secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
11671200
can be used as environment variables in system_setup_commands. Example:
11681201
{"GITHUB_TOKEN": "gh_secret"} makes 'gh_secret' available as GITHUB_TOKEN.
@@ -1188,6 +1221,7 @@ async def create_from_inspection(
11881221
"file_mounts": file_mounts,
11891222
"launch_parameters": launch_parameters,
11901223
"metadata": metadata,
1224+
"network_policy_id": network_policy_id,
11911225
"secrets": secrets,
11921226
"system_setup_commands": system_setup_commands,
11931227
},
@@ -1304,6 +1338,7 @@ async def preview(
13041338
file_mounts: Optional[Dict[str, str]] | Omit = omit,
13051339
launch_parameters: Optional[LaunchParameters] | Omit = omit,
13061340
metadata: Optional[Dict[str, str]] | Omit = omit,
1341+
network_policy_id: Optional[str] | Omit = omit,
13071342
secrets: Optional[Dict[str, str]] | Omit = omit,
13081343
services: Optional[Iterable[blueprint_preview_params.Service]] | Omit = omit,
13091344
system_setup_commands: Optional[SequenceNotStr[str]] | Omit = omit,
@@ -1345,6 +1380,12 @@ async def preview(
13451380
13461381
metadata: (Optional) User defined metadata for the Blueprint.
13471382
1383+
network_policy_id: (Optional) ID of the network policy to apply during blueprint build. This
1384+
restricts network access during the build process. This does not affect devboxes
1385+
created from this blueprint; if you want devboxes created from this blueprint to
1386+
inherit the network policy, set the network_policy_id on the blueprint launch
1387+
parameters.
1388+
13481389
secrets: (Optional) Map of mount IDs/environment variable names to secret names. Secrets
13491390
will be available to commands during the build. Secrets are NOT stored in the
13501391
blueprint image. Example: {"DB_PASS": "DATABASE_PASSWORD"} makes the secret
@@ -1380,6 +1421,7 @@ async def preview(
13801421
"file_mounts": file_mounts,
13811422
"launch_parameters": launch_parameters,
13821423
"metadata": metadata,
1424+
"network_policy_id": network_policy_id,
13831425
"secrets": secrets,
13841426
"services": services,
13851427
"system_setup_commands": system_setup_commands,

src/runloop_api_client/resources/devboxes/devboxes.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ def create(
189189
metadata: Optional[Dict[str, str]] | Omit = omit,
190190
mounts: Optional[Iterable[Mount]] | Omit = omit,
191191
name: Optional[str] | Omit = omit,
192-
network_policy_id: Optional[str] | Omit = omit,
193192
repo_connection_id: Optional[str] | Omit = omit,
194193
secrets: Optional[Dict[str, str]] | Omit = omit,
195194
snapshot_id: Optional[str] | Omit = omit,
@@ -236,9 +235,6 @@ def create(
236235
237236
name: (Optional) A user specified name to give the Devbox.
238237
239-
network_policy_id: (Optional) ID of the network policy to apply to this Devbox. If not specified,
240-
the default network policy will be used.
241-
242238
repo_connection_id: Repository connection id the devbox should source its base image from.
243239
244240
secrets: (Optional) Map of environment variable names to secret names. The secret values
@@ -273,7 +269,6 @@ def create(
273269
"metadata": metadata,
274270
"mounts": mounts,
275271
"name": name,
276-
"network_policy_id": network_policy_id,
277272
"repo_connection_id": repo_connection_id,
278273
"secrets": secrets,
279274
"snapshot_id": snapshot_id,
@@ -1732,7 +1727,6 @@ async def create(
17321727
metadata: Optional[Dict[str, str]] | Omit = omit,
17331728
mounts: Optional[Iterable[Mount]] | Omit = omit,
17341729
name: Optional[str] | Omit = omit,
1735-
network_policy_id: Optional[str] | Omit = omit,
17361730
repo_connection_id: Optional[str] | Omit = omit,
17371731
secrets: Optional[Dict[str, str]] | Omit = omit,
17381732
snapshot_id: Optional[str] | Omit = omit,
@@ -1779,9 +1773,6 @@ async def create(
17791773
17801774
name: (Optional) A user specified name to give the Devbox.
17811775
1782-
network_policy_id: (Optional) ID of the network policy to apply to this Devbox. If not specified,
1783-
the default network policy will be used.
1784-
17851776
repo_connection_id: Repository connection id the devbox should source its base image from.
17861777
17871778
secrets: (Optional) Map of environment variable names to secret names. The secret values
@@ -1816,7 +1807,6 @@ async def create(
18161807
"metadata": metadata,
18171808
"mounts": mounts,
18181809
"name": name,
1819-
"network_policy_id": network_policy_id,
18201810
"repo_connection_id": repo_connection_id,
18211811
"secrets": secrets,
18221812
"snapshot_id": snapshot_id,

src/runloop_api_client/types/blueprint_build_parameters.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ class BlueprintBuildParameters(BaseModel):
9191
metadata: Optional[Dict[str, str]] = None
9292
"""(Optional) User defined metadata for the Blueprint."""
9393

94+
network_policy_id: Optional[str] = None
95+
"""(Optional) ID of the network policy to apply during blueprint build.
96+
97+
This restricts network access during the build process. This does not affect
98+
devboxes created from this blueprint; if you want devboxes created from this
99+
blueprint to inherit the network policy, set the network_policy_id on the
100+
blueprint launch parameters.
101+
"""
102+
94103
secrets: Optional[Dict[str, str]] = None
95104
"""(Optional) Map of mount IDs/environment variable names to secret names.
96105

src/runloop_api_client/types/blueprint_create_from_inspection_params.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ class BlueprintCreateFromInspectionParams(TypedDict, total=False):
3232
metadata: Optional[Dict[str, str]]
3333
"""(Optional) User defined metadata for the Blueprint."""
3434

35+
network_policy_id: Optional[str]
36+
"""(Optional) ID of the network policy to apply during blueprint build.
37+
38+
This restricts network access during the build process.
39+
"""
40+
3541
secrets: Optional[Dict[str, str]]
3642
"""(Optional) Map of mount IDs/environment variable names to secret names.
3743

src/runloop_api_client/types/blueprint_create_params.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ class BlueprintCreateParams(TypedDict, total=False):
5151
metadata: Optional[Dict[str, str]]
5252
"""(Optional) User defined metadata for the Blueprint."""
5353

54+
network_policy_id: Optional[str]
55+
"""(Optional) ID of the network policy to apply during blueprint build.
56+
57+
This restricts network access during the build process. This does not affect
58+
devboxes created from this blueprint; if you want devboxes created from this
59+
blueprint to inherit the network policy, set the network_policy_id on the
60+
blueprint launch parameters.
61+
"""
62+
5463
secrets: Optional[Dict[str, str]]
5564
"""(Optional) Map of mount IDs/environment variable names to secret names.
5665

src/runloop_api_client/types/blueprint_preview_params.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ class BlueprintPreviewParams(TypedDict, total=False):
5151
metadata: Optional[Dict[str, str]]
5252
"""(Optional) User defined metadata for the Blueprint."""
5353

54+
network_policy_id: Optional[str]
55+
"""(Optional) ID of the network policy to apply during blueprint build.
56+
57+
This restricts network access during the build process. This does not affect
58+
devboxes created from this blueprint; if you want devboxes created from this
59+
blueprint to inherit the network policy, set the network_policy_id on the
60+
blueprint launch parameters.
61+
"""
62+
5463
secrets: Optional[Dict[str, str]]
5564
"""(Optional) Map of mount IDs/environment variable names to secret names.
5665

src/runloop_api_client/types/devbox_create_params.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ class DevboxBaseCreateParams(TypedDict, total=False):
4949
name: Optional[str]
5050
"""(Optional) A user specified name to give the Devbox."""
5151

52-
network_policy_id: Optional[str]
53-
"""(Optional) ID of the network policy to apply to this Devbox.
54-
55-
If not specified, the default network policy will be used.
56-
"""
57-
5852
repo_connection_id: Optional[str]
5953
"""Repository connection id the devbox should source its base image from."""
6054

src/runloop_api_client/types/devbox_view.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ class DevboxView(BaseModel):
8787
name: Optional[str] = None
8888
"""The name of the Devbox."""
8989

90+
network_policy_id: Optional[str] = None
91+
"""The network policy ID used to create the Devbox."""
92+
9093
shutdown_reason: Optional[Literal["api_shutdown", "keep_alive_timeout", "entrypoint_exit", "idle"]] = None
9194
"""
9295
The shutdown reason if the Devbox shutdown, if the Devbox has a 'shutdown'

tests/api_resources/test_blueprints.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def test_method_create_with_all_params(self, client: Runloop) -> None:
7171
},
7272
},
7373
metadata={"foo": "string"},
74+
network_policy_id="network_policy_id",
7475
secrets={"foo": "string"},
7576
services=[
7677
{
@@ -284,6 +285,7 @@ def test_method_create_from_inspection_with_all_params(self, client: Runloop) ->
284285
},
285286
},
286287
metadata={"foo": "string"},
288+
network_policy_id="network_policy_id",
287289
secrets={"foo": "string"},
288290
system_setup_commands=["string"],
289291
)
@@ -437,6 +439,7 @@ def test_method_preview_with_all_params(self, client: Runloop) -> None:
437439
},
438440
},
439441
metadata={"foo": "string"},
442+
network_policy_id="network_policy_id",
440443
secrets={"foo": "string"},
441444
services=[
442445
{
@@ -534,6 +537,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -
534537
},
535538
},
536539
metadata={"foo": "string"},
540+
network_policy_id="network_policy_id",
537541
secrets={"foo": "string"},
538542
services=[
539543
{
@@ -747,6 +751,7 @@ async def test_method_create_from_inspection_with_all_params(self, async_client:
747751
},
748752
},
749753
metadata={"foo": "string"},
754+
network_policy_id="network_policy_id",
750755
secrets={"foo": "string"},
751756
system_setup_commands=["string"],
752757
)
@@ -900,6 +905,7 @@ async def test_method_preview_with_all_params(self, async_client: AsyncRunloop)
900905
},
901906
},
902907
metadata={"foo": "string"},
908+
network_policy_id="network_policy_id",
903909
secrets={"foo": "string"},
904910
services=[
905911
{

0 commit comments

Comments
 (0)