Skip to content

Commit b77a065

Browse files
feat(mux): expose CIDR egress rules on the network policy API (#10269)
1 parent 4a40176 commit b77a065

12 files changed

Lines changed: 197 additions & 6 deletions

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 119
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai/runloop-0e8f05634e48dcbabeafbb1ab71297b2c506f028ffc92a1f01767147e1244a77.yml
3-
openapi_spec_hash: 46d01fb341301ea07b9860151d9043f7
4-
config_hash: 9f32651e6269089b5d6c33594b992232
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai/runloop-53098c6f2c4d6e31f36a6975b3f7f504ad3f8fbe5a209dac9b2304afcd053a77.yml
3+
openapi_spec_hash: 05dcd360988cd1044b6a7ab03933a5ef
4+
config_hash: 218b8d25038e627faab98532392ee9a0

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,12 @@ Types:
419419

420420
```python
421421
from runloop_api_client.types import (
422+
AllowedCidr,
422423
NetworkPolicyCreateParameters,
423424
NetworkPolicyListView,
424425
NetworkPolicyUpdateParameters,
425426
NetworkPolicyView,
427+
PortRule,
426428
)
427429
```
428430

src/runloop_api_client/resources/network_policies.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import Iterable, Optional
66

77
import httpx
88

@@ -19,6 +19,7 @@
1919
)
2020
from ..pagination import SyncNetworkPoliciesCursorIDPage, AsyncNetworkPoliciesCursorIDPage
2121
from .._base_client import AsyncPaginator, make_request_options
22+
from ..types.allowed_cidr_param import AllowedCidrParam
2223
from ..types.network_policy_view import NetworkPolicyView
2324

2425
__all__ = ["NetworkPoliciesResource", "AsyncNetworkPoliciesResource"]
@@ -52,6 +53,7 @@ def create(
5253
allow_all: Optional[bool] | Omit = omit,
5354
allow_devbox_to_devbox: Optional[bool] | Omit = omit,
5455
allow_mcp_gateway: Optional[bool] | Omit = omit,
56+
allowed_cidrs: Optional[Iterable[AllowedCidrParam]] | Omit = omit,
5557
allowed_hostnames: Optional[SequenceNotStr[str]] | Omit = omit,
5658
description: Optional[str] | Omit = omit,
5759
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -84,6 +86,10 @@ def create(
8486
allow_mcp_gateway: (Optional) If true, allows devbox egress to the MCP hub for MCP server access.
8587
Defaults to false.
8688
89+
allowed_cidrs: (Optional) IPv4 CIDR-based allow list with optional port restrictions, additive
90+
with allowed_hostnames. Example: [{'cidr': '10.12.0.0/16', 'ports': [{'port':
91+
443}]}].
92+
8793
allowed_hostnames: (Optional) DNS-based allow list with wildcard support. Examples: ['github.com',
8894
'*.npmjs.org'].
8995
@@ -108,6 +114,7 @@ def create(
108114
"allow_all": allow_all,
109115
"allow_devbox_to_devbox": allow_devbox_to_devbox,
110116
"allow_mcp_gateway": allow_mcp_gateway,
117+
"allowed_cidrs": allowed_cidrs,
111118
"allowed_hostnames": allowed_hostnames,
112119
"description": description,
113120
},
@@ -164,6 +171,7 @@ def update(
164171
allow_all: Optional[bool] | Omit = omit,
165172
allow_devbox_to_devbox: Optional[bool] | Omit = omit,
166173
allow_mcp_gateway: Optional[bool] | Omit = omit,
174+
allowed_cidrs: Optional[Iterable[AllowedCidrParam]] | Omit = omit,
167175
allowed_hostnames: Optional[SequenceNotStr[str]] | Omit = omit,
168176
description: Optional[str] | Omit = omit,
169177
name: Optional[str] | Omit = omit,
@@ -188,6 +196,9 @@ def update(
188196
189197
allow_mcp_gateway: If true, allows devbox egress to the MCP hub.
190198
199+
allowed_cidrs: Updated IPv4 CIDR-based allow list with optional port restrictions, additive
200+
with allowed_hostnames.
201+
191202
allowed_hostnames: Updated DNS-based allow list with wildcard support. Examples: ['github.com',
192203
'*.npmjs.org'].
193204
@@ -215,6 +226,7 @@ def update(
215226
"allow_all": allow_all,
216227
"allow_devbox_to_devbox": allow_devbox_to_devbox,
217228
"allow_mcp_gateway": allow_mcp_gateway,
229+
"allowed_cidrs": allowed_cidrs,
218230
"allowed_hostnames": allowed_hostnames,
219231
"description": description,
220232
"name": name,
@@ -365,6 +377,7 @@ async def create(
365377
allow_all: Optional[bool] | Omit = omit,
366378
allow_devbox_to_devbox: Optional[bool] | Omit = omit,
367379
allow_mcp_gateway: Optional[bool] | Omit = omit,
380+
allowed_cidrs: Optional[Iterable[AllowedCidrParam]] | Omit = omit,
368381
allowed_hostnames: Optional[SequenceNotStr[str]] | Omit = omit,
369382
description: Optional[str] | Omit = omit,
370383
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -397,6 +410,10 @@ async def create(
397410
allow_mcp_gateway: (Optional) If true, allows devbox egress to the MCP hub for MCP server access.
398411
Defaults to false.
399412
413+
allowed_cidrs: (Optional) IPv4 CIDR-based allow list with optional port restrictions, additive
414+
with allowed_hostnames. Example: [{'cidr': '10.12.0.0/16', 'ports': [{'port':
415+
443}]}].
416+
400417
allowed_hostnames: (Optional) DNS-based allow list with wildcard support. Examples: ['github.com',
401418
'*.npmjs.org'].
402419
@@ -421,6 +438,7 @@ async def create(
421438
"allow_all": allow_all,
422439
"allow_devbox_to_devbox": allow_devbox_to_devbox,
423440
"allow_mcp_gateway": allow_mcp_gateway,
441+
"allowed_cidrs": allowed_cidrs,
424442
"allowed_hostnames": allowed_hostnames,
425443
"description": description,
426444
},
@@ -477,6 +495,7 @@ async def update(
477495
allow_all: Optional[bool] | Omit = omit,
478496
allow_devbox_to_devbox: Optional[bool] | Omit = omit,
479497
allow_mcp_gateway: Optional[bool] | Omit = omit,
498+
allowed_cidrs: Optional[Iterable[AllowedCidrParam]] | Omit = omit,
480499
allowed_hostnames: Optional[SequenceNotStr[str]] | Omit = omit,
481500
description: Optional[str] | Omit = omit,
482501
name: Optional[str] | Omit = omit,
@@ -501,6 +520,9 @@ async def update(
501520
502521
allow_mcp_gateway: If true, allows devbox egress to the MCP hub.
503522
523+
allowed_cidrs: Updated IPv4 CIDR-based allow list with optional port restrictions, additive
524+
with allowed_hostnames.
525+
504526
allowed_hostnames: Updated DNS-based allow list with wildcard support. Examples: ['github.com',
505527
'*.npmjs.org'].
506528
@@ -528,6 +550,7 @@ async def update(
528550
"allow_all": allow_all,
529551
"allow_devbox_to_devbox": allow_devbox_to_devbox,
530552
"allow_mcp_gateway": allow_mcp_gateway,
553+
"allowed_cidrs": allowed_cidrs,
531554
"allowed_hostnames": allowed_hostnames,
532555
"description": description,
533556
"name": name,

src/runloop_api_client/types/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
LifecycleConfiguration as LifecycleConfiguration,
1818
)
1919
from .axon_view import AxonView as AxonView
20+
from .port_rule import PortRule as PortRule
2021
from .agent_view import AgentView as AgentView
2122
from .devbox_view import DevboxView as DevboxView
2223
from .object_view import ObjectView as ObjectView
2324
from .secret_view import SecretView as SecretView
2425
from .tunnel_view import TunnelView as TunnelView
2526
from .account_view import AccountView as AccountView
27+
from .allowed_cidr import AllowedCidr as AllowedCidr
2628
from .input_context import InputContext as InputContext
2729
from .scenario_view import ScenarioView as ScenarioView
2830
from .axon_list_view import AxonListView as AxonListView
@@ -31,6 +33,7 @@
3133
from .agent_list_view import AgentListView as AgentListView
3234
from .axon_event_view import AxonEventView as AxonEventView
3335
from .mcp_config_view import McpConfigView as McpConfigView
36+
from .port_rule_param import PortRuleParam as PortRuleParam
3437
from .pty_tunnel_view import PtyTunnelView as PtyTunnelView
3538
from .axon_list_params import AxonListParams as AxonListParams
3639
from .devbox_list_view import DevboxListView as DevboxListView
@@ -42,6 +45,7 @@
4245
from .secret_list_view import SecretListView as SecretListView
4346
from .agent_list_params import AgentListParams as AgentListParams
4447
from .scenario_run_view import ScenarioRunView as ScenarioRunView
48+
from .allowed_cidr_param import AllowedCidrParam as AllowedCidrParam
4549
from .axon_create_params import AxonCreateParams as AxonCreateParams
4650
from .benchmark_job_view import BenchmarkJobView as BenchmarkJobView
4751
from .benchmark_run_view import BenchmarkRunView as BenchmarkRunView
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List, Optional
4+
5+
from .._models import BaseModel
6+
from .port_rule import PortRule
7+
8+
__all__ = ["AllowedCidr"]
9+
10+
11+
class AllowedCidr(BaseModel):
12+
"""A CIDR-based egress allow rule with optional port restrictions."""
13+
14+
cidr: str
15+
"""IPv4 CIDR block in canonical form (host bits zero), e.g. '10.12.0.0/16'."""
16+
17+
ports: Optional[List[PortRule]] = None
18+
"""(Optional) Ports allowed for this CIDR.
19+
20+
Empty or omitted means all ports and protocols.
21+
"""
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Iterable, Optional
6+
from typing_extensions import Required, TypedDict
7+
8+
from .port_rule_param import PortRuleParam
9+
10+
__all__ = ["AllowedCidrParam"]
11+
12+
13+
class AllowedCidrParam(TypedDict, total=False):
14+
"""A CIDR-based egress allow rule with optional port restrictions."""
15+
16+
cidr: Required[str]
17+
"""IPv4 CIDR block in canonical form (host bits zero), e.g. '10.12.0.0/16'."""
18+
19+
ports: Optional[Iterable[PortRuleParam]]
20+
"""(Optional) Ports allowed for this CIDR.
21+
22+
Empty or omitted means all ports and protocols.
23+
"""

src/runloop_api_client/types/network_policy_create_params.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import Iterable, Optional
66
from typing_extensions import Required, TypedDict
77

88
from .._types import SequenceNotStr
9+
from .allowed_cidr_param import AllowedCidrParam
910

1011
__all__ = ["NetworkPolicyCreateParams"]
1112

@@ -42,6 +43,13 @@ class NetworkPolicyCreateParams(TypedDict, total=False):
4243
Defaults to false.
4344
"""
4445

46+
allowed_cidrs: Optional[Iterable[AllowedCidrParam]]
47+
"""
48+
(Optional) IPv4 CIDR-based allow list with optional port restrictions, additive
49+
with allowed_hostnames. Example: [{'cidr': '10.12.0.0/16', 'ports': [{'port':
50+
443}]}].
51+
"""
52+
4553
allowed_hostnames: Optional[SequenceNotStr[str]]
4654
"""(Optional) DNS-based allow list with wildcard support.
4755

src/runloop_api_client/types/network_policy_update_params.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import Iterable, Optional
66
from typing_extensions import TypedDict
77

88
from .._types import SequenceNotStr
9+
from .allowed_cidr_param import AllowedCidrParam
910

1011
__all__ = ["NetworkPolicyUpdateParams"]
1112

@@ -23,6 +24,12 @@ class NetworkPolicyUpdateParams(TypedDict, total=False):
2324
allow_mcp_gateway: Optional[bool]
2425
"""If true, allows devbox egress to the MCP hub."""
2526

27+
allowed_cidrs: Optional[Iterable[AllowedCidrParam]]
28+
"""
29+
Updated IPv4 CIDR-based allow list with optional port restrictions, additive
30+
with allowed_hostnames.
31+
"""
32+
2633
allowed_hostnames: Optional[SequenceNotStr[str]]
2734
"""Updated DNS-based allow list with wildcard support.
2835

src/runloop_api_client/types/network_policy_view.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import List, Optional
44

55
from .._models import BaseModel
6+
from .allowed_cidr import AllowedCidr
67

78
__all__ = ["NetworkPolicyView", "Egress"]
89

@@ -25,6 +26,12 @@ class Egress(BaseModel):
2526
allow_mcp_gateway: bool
2627
"""If true, allows devbox egress to the MCP hub for MCP server access."""
2728

29+
allowed_cidrs: List[AllowedCidr]
30+
"""
31+
CIDR-based allow list with optional port restrictions, additive with
32+
allowed_hostnames.
33+
"""
34+
2835
allowed_hostnames: List[str]
2936
"""DNS-based allow list with wildcard support.
3037
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from typing_extensions import Literal
5+
6+
from .._models import BaseModel
7+
8+
__all__ = ["PortRule"]
9+
10+
11+
class PortRule(BaseModel):
12+
"""A port or port range allowed for a CIDR egress rule."""
13+
14+
port: int
15+
"""The allowed port (1-65535), or the start of a port range."""
16+
17+
end_port: Optional[int] = None
18+
"""(Optional) Inclusive end of the port range (port-65535).
19+
20+
Omit for a single port.
21+
"""
22+
23+
protocol: Optional[Literal["TCP", "UDP"]] = None
24+
"""L4 protocol for a port rule."""

0 commit comments

Comments
 (0)