-
Notifications
You must be signed in to change notification settings - Fork 980
Expand file tree
/
Copy pathsandbox_network_config.py
More file actions
130 lines (100 loc) · 4.96 KB
/
Copy pathsandbox_network_config.py
File metadata and controls
130 lines (100 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
if TYPE_CHECKING:
from ..models.sandbox_network_config_rules import SandboxNetworkConfigRules
T = TypeVar("T", bound="SandboxNetworkConfig")
@_attrs_define
class SandboxNetworkConfig:
"""
Attributes:
allow_out (Union[Unset, list[str]]): List of allowed destinations for egress traffic. Each entry can be a CIDR
block (e.g. "8.8.8.8/32"), a bare IP address (e.g. "8.8.8.8"), or a domain name (e.g. "example.com",
"*.example.com"). Allowed entries always take precedence over denied entries.
allow_public_traffic (Union[Unset, bool]): Specify if the sandbox URLs should be accessible only with
authentication. Default: True.
deny_out (Union[Unset, list[str]]): List of denied CIDR blocks or IP addresses for egress traffic. Domain names
are not supported for deny rules.
https_ports (Union[Unset, list[int]]): Ports whose public URLs should connect to the sandbox using HTTPS.
Backend certificate verification is disabled.
mask_request_host (Union[Unset, str]): Specify host mask which will be used for all sandbox requests
rules (Union[Unset, SandboxNetworkConfigRules]): Per-domain transform rules applied to matching egress
HTTP/HTTPS requests. Keys are domains (e.g. "api.example.com", "example.com"). A domain listed here is not
automatically allowed - use allowOut to permit the traffic.
"""
allow_out: Union[Unset, list[str]] = UNSET
allow_public_traffic: Union[Unset, bool] = True
deny_out: Union[Unset, list[str]] = UNSET
https_ports: Union[Unset, list[int]] = UNSET
mask_request_host: Union[Unset, str] = UNSET
rules: Union[Unset, "SandboxNetworkConfigRules"] = UNSET
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> dict[str, Any]:
allow_out: Union[Unset, list[str]] = UNSET
if not isinstance(self.allow_out, Unset):
allow_out = self.allow_out
allow_public_traffic = self.allow_public_traffic
deny_out: Union[Unset, list[str]] = UNSET
if not isinstance(self.deny_out, Unset):
deny_out = self.deny_out
https_ports: Union[Unset, list[int]] = UNSET
if not isinstance(self.https_ports, Unset):
https_ports = self.https_ports
mask_request_host = self.mask_request_host
rules: Union[Unset, dict[str, Any]] = UNSET
if not isinstance(self.rules, Unset):
rules = self.rules.to_dict()
field_dict: dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if allow_out is not UNSET:
field_dict["allowOut"] = allow_out
if allow_public_traffic is not UNSET:
field_dict["allowPublicTraffic"] = allow_public_traffic
if deny_out is not UNSET:
field_dict["denyOut"] = deny_out
if https_ports is not UNSET:
field_dict["httpsPorts"] = https_ports
if mask_request_host is not UNSET:
field_dict["maskRequestHost"] = mask_request_host
if rules is not UNSET:
field_dict["rules"] = rules
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
from ..models.sandbox_network_config_rules import SandboxNetworkConfigRules
d = dict(src_dict)
allow_out = cast(list[str], d.pop("allowOut", UNSET))
allow_public_traffic = d.pop("allowPublicTraffic", UNSET)
deny_out = cast(list[str], d.pop("denyOut", UNSET))
https_ports = cast(list[int], d.pop("httpsPorts", UNSET))
mask_request_host = d.pop("maskRequestHost", UNSET)
_rules = d.pop("rules", UNSET)
rules: Union[Unset, SandboxNetworkConfigRules]
if isinstance(_rules, Unset):
rules = UNSET
else:
rules = SandboxNetworkConfigRules.from_dict(_rules)
sandbox_network_config = cls(
allow_out=allow_out,
allow_public_traffic=allow_public_traffic,
deny_out=deny_out,
https_ports=https_ports,
mask_request_host=mask_request_host,
rules=rules,
)
sandbox_network_config.additional_properties = d
return sandbox_network_config
@property
def additional_keys(self) -> list[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties