33import { APIResource } from '../resource' ;
44import { isRequestOptions } from '../core' ;
55import * as Core from '../core' ;
6+ import * as NetworkPoliciesAPI from './network-policies' ;
67import { NetworkPoliciesCursorIDPage , type NetworkPoliciesCursorIDPageParams } from '../pagination' ;
78
89export class NetworkPolicies extends APIResource {
@@ -78,6 +79,22 @@ export class NetworkPolicies extends APIResource {
7879
7980export class NetworkPolicyViewsNetworkPoliciesCursorIDPage extends NetworkPoliciesCursorIDPage < NetworkPolicyView > { }
8081
82+ /**
83+ * A CIDR-based egress allow rule with optional port restrictions.
84+ */
85+ export interface AllowedCidr {
86+ /**
87+ * IPv4 CIDR block in canonical form (host bits zero), e.g. '10.12.0.0/16'.
88+ */
89+ cidr : string ;
90+
91+ /**
92+ * (Optional) Ports allowed for this CIDR. Empty or omitted means all ports and
93+ * protocols.
94+ */
95+ ports ?: Array < PortRule > | null ;
96+ }
97+
8198/**
8299 * Parameters required to create a new NetworkPolicy.
83100 */
@@ -113,6 +130,13 @@ export interface NetworkPolicyCreateParameters {
113130 */
114131 allow_mcp_gateway ?: boolean | null ;
115132
133+ /**
134+ * (Optional) IPv4 CIDR-based allow list with optional port restrictions, additive
135+ * with allowed_hostnames. Example: [{'cidr': '10.12.0.0/16', 'ports': [{'port':
136+ * 443}]}].
137+ */
138+ allowed_cidrs ?: Array < AllowedCidr > | null ;
139+
116140 /**
117141 * (Optional) DNS-based allow list with wildcard support. Examples: ['github.com',
118142 * '*.npmjs.org'].
@@ -169,6 +193,12 @@ export interface NetworkPolicyUpdateParameters {
169193 */
170194 allow_mcp_gateway ?: boolean | null ;
171195
196+ /**
197+ * Updated IPv4 CIDR-based allow list with optional port restrictions, additive
198+ * with allowed_hostnames.
199+ */
200+ allowed_cidrs ?: Array < AllowedCidr > | null ;
201+
172202 /**
173203 * Updated DNS-based allow list with wildcard support. Examples: ['github.com',
174204 * '*.npmjs.org'].
@@ -248,6 +278,12 @@ export namespace NetworkPolicyView {
248278 */
249279 allow_mcp_gateway : boolean ;
250280
281+ /**
282+ * CIDR-based allow list with optional port restrictions, additive with
283+ * allowed_hostnames.
284+ */
285+ allowed_cidrs : Array < NetworkPoliciesAPI . AllowedCidr > ;
286+
251287 /**
252288 * DNS-based allow list with wildcard support. Examples: ['github.com',
253289 * '*.npmjs.org', 'api.openai.com']. Empty list with allow_all=false means no
@@ -257,6 +293,26 @@ export namespace NetworkPolicyView {
257293 }
258294}
259295
296+ /**
297+ * A port or port range allowed for a CIDR egress rule.
298+ */
299+ export interface PortRule {
300+ /**
301+ * The allowed port (1-65535), or the start of a port range.
302+ */
303+ port : number ;
304+
305+ /**
306+ * (Optional) Inclusive end of the port range (port-65535). Omit for a single port.
307+ */
308+ end_port ?: number | null ;
309+
310+ /**
311+ * L4 protocol for a port rule.
312+ */
313+ protocol ?: 'TCP' | 'UDP' | null ;
314+ }
315+
260316export interface NetworkPolicyCreateParams {
261317 /**
262318 * The human-readable name for the NetworkPolicy. Must be unique within the
@@ -289,6 +345,13 @@ export interface NetworkPolicyCreateParams {
289345 */
290346 allow_mcp_gateway ?: boolean | null ;
291347
348+ /**
349+ * (Optional) IPv4 CIDR-based allow list with optional port restrictions, additive
350+ * with allowed_hostnames. Example: [{'cidr': '10.12.0.0/16', 'ports': [{'port':
351+ * 443}]}].
352+ */
353+ allowed_cidrs ?: Array < AllowedCidr > | null ;
354+
292355 /**
293356 * (Optional) DNS-based allow list with wildcard support. Examples: ['github.com',
294357 * '*.npmjs.org'].
@@ -322,6 +385,12 @@ export interface NetworkPolicyUpdateParams {
322385 */
323386 allow_mcp_gateway ?: boolean | null ;
324387
388+ /**
389+ * Updated IPv4 CIDR-based allow list with optional port restrictions, additive
390+ * with allowed_hostnames.
391+ */
392+ allowed_cidrs ?: Array < AllowedCidr > | null ;
393+
325394 /**
326395 * Updated DNS-based allow list with wildcard support. Examples: ['github.com',
327396 * '*.npmjs.org'].
@@ -368,10 +437,12 @@ NetworkPolicies.NetworkPolicyViewsNetworkPoliciesCursorIDPage = NetworkPolicyVie
368437
369438export declare namespace NetworkPolicies {
370439 export {
440+ type AllowedCidr as AllowedCidr ,
371441 type NetworkPolicyCreateParameters as NetworkPolicyCreateParameters ,
372442 type NetworkPolicyListView as NetworkPolicyListView ,
373443 type NetworkPolicyUpdateParameters as NetworkPolicyUpdateParameters ,
374444 type NetworkPolicyView as NetworkPolicyView ,
445+ type PortRule as PortRule ,
375446 NetworkPolicyViewsNetworkPoliciesCursorIDPage as NetworkPolicyViewsNetworkPoliciesCursorIDPage ,
376447 type NetworkPolicyCreateParams as NetworkPolicyCreateParams ,
377448 type NetworkPolicyUpdateParams as NetworkPolicyUpdateParams ,
0 commit comments