blaxel 0.1.9rc35__py3-none-any.whl → 0.1.9rc36__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- blaxel/agents/__init__.py +1 -1
- blaxel/authentication/__init__.py +3 -4
- blaxel/client/api/compute/__init__.py +0 -0
- blaxel/client/api/compute/create_sandbox.py +166 -0
- blaxel/client/api/compute/delete_sandbox.py +154 -0
- blaxel/client/api/compute/get_sandbox.py +154 -0
- blaxel/client/api/compute/list_sandboxes.py +135 -0
- blaxel/client/api/compute/start_sandbox.py +157 -0
- blaxel/client/api/compute/stop_sandbox.py +157 -0
- blaxel/client/api/compute/update_sandbox.py +179 -0
- blaxel/client/api/default/list_sandbox_hub_definitions.py +123 -0
- blaxel/client/api/functions/list_function_revisions.py +16 -11
- blaxel/client/api/knowledgebases/list_knowledgebase_revisions.py +16 -11
- blaxel/client/api/models/list_model_revisions.py +16 -11
- blaxel/client/api/templates/list_templates.py +16 -11
- blaxel/client/models/__init__.py +32 -2
- blaxel/client/models/agent_spec.py +25 -69
- blaxel/client/models/core_spec.py +1 -45
- blaxel/client/models/function_spec.py +1 -45
- blaxel/client/models/last_n_requests_metric.py +18 -0
- blaxel/client/models/metrics.py +20 -0
- blaxel/client/models/model_spec.py +1 -45
- blaxel/client/models/{agent_chain.py → port.py} +23 -32
- blaxel/client/models/request_total_metric.py +12 -1
- blaxel/client/models/request_total_response_data.py +97 -0
- blaxel/client/models/resource_log.py +9 -0
- blaxel/client/models/resource_metrics.py +144 -0
- blaxel/client/models/resource_metrics_request_total_per_code_previous.py +45 -0
- blaxel/client/models/resource_metrics_rps_per_code_previous.py +45 -0
- blaxel/client/models/runtime.py +83 -7
- blaxel/client/models/runtime_configuration.py +45 -0
- blaxel/client/models/sandbox.py +129 -0
- blaxel/client/models/sandbox_definition.py +181 -0
- blaxel/client/models/sandbox_spec.py +208 -0
- blaxel/client/models/sandboxes.py +129 -0
- blaxel/client/models/serverless_config.py +29 -1
- blaxel/client/models/serverless_config_configuration.py +45 -0
- blaxel/client/models/start_sandbox.py +94 -0
- blaxel/client/models/stop_sandbox.py +94 -0
- blaxel/client/models/trigger.py +98 -0
- blaxel/client/models/trigger_configuration.py +45 -0
- blaxel/client/models/workspace.py +20 -0
- blaxel/client/models/workspace_runtime.py +61 -0
- blaxel/common/autoload.py +0 -1
- blaxel/instrumentation/exporters.py +3 -6
- blaxel/instrumentation/manager.py +5 -3
- blaxel/mcp/client.py +1 -3
- blaxel/mcp/server.py +2 -3
- blaxel/models/__init__.py +2 -1
- blaxel/models/custom/langchain/gemini.py +41 -18
- blaxel/models/custom/llamaindex/cohere.py +25 -16
- blaxel/models/custom/pydantic/gemini.py +0 -1
- blaxel/models/livekit.py +1 -1
- blaxel/tools/__init__.py +1 -1
- blaxel/tools/langchain.py +1 -2
- {blaxel-0.1.9rc35.dist-info → blaxel-0.1.9rc36.dist-info}/METADATA +1 -4
- {blaxel-0.1.9rc35.dist-info → blaxel-0.1.9rc36.dist-info}/RECORD +59 -36
- {blaxel-0.1.9rc35.dist-info → blaxel-0.1.9rc36.dist-info}/WHEEL +0 -0
- {blaxel-0.1.9rc35.dist-info → blaxel-0.1.9rc36.dist-info}/licenses/LICENSE +0 -0
blaxel/client/models/runtime.py
CHANGED
@@ -6,6 +6,8 @@ from attrs import field as _attrs_field
|
|
6
6
|
from ..types import UNSET, Unset
|
7
7
|
|
8
8
|
if TYPE_CHECKING:
|
9
|
+
from ..models.port import Port
|
10
|
+
from ..models.runtime_configuration import RuntimeConfiguration
|
9
11
|
from ..models.runtime_startup_probe import RuntimeStartupProbe
|
10
12
|
|
11
13
|
|
@@ -19,33 +21,44 @@ class Runtime:
|
|
19
21
|
Attributes:
|
20
22
|
args (Union[Unset, list[Any]]): The arguments to pass to the deployment runtime
|
21
23
|
command (Union[Unset, list[Any]]): The command to run the deployment
|
24
|
+
configuration (Union[Unset, RuntimeConfiguration]): The configuration for the deployment
|
22
25
|
cpu (Union[Unset, int]): The CPU for the deployment in cores, only available for private cluster
|
23
26
|
endpoint_name (Union[Unset, str]): Endpoint Name of the model. In case of hf_private_endpoint, it is the
|
24
27
|
endpoint name. In case of hf_public_endpoint, it is not used.
|
25
28
|
envs (Union[Unset, list[Any]]): The env variables to set in the deployment. Should be a list of Kubernetes
|
26
29
|
EnvVar types
|
30
|
+
generation (Union[Unset, str]): The generation of the deployment
|
27
31
|
image (Union[Unset, str]): The Docker image for the deployment
|
32
|
+
max_scale (Union[Unset, int]): The minimum number of replicas for the deployment. Can be 0 or 1 (in which case
|
33
|
+
the deployment is always running in at least one location).
|
28
34
|
memory (Union[Unset, int]): The memory for the deployment in MB
|
29
35
|
metric_port (Union[Unset, int]): The port to serve the metrics on
|
36
|
+
min_scale (Union[Unset, int]): The maximum number of replicas for the deployment.
|
30
37
|
model (Union[Unset, str]): The slug name of the origin model at HuggingFace.
|
31
38
|
organization (Union[Unset, str]): The organization of the model
|
32
|
-
|
39
|
+
ports (Union[Unset, list['Port']]): Set of ports for a resource
|
33
40
|
startup_probe (Union[Unset, RuntimeStartupProbe]): The readiness probe. Should be a Kubernetes Probe type
|
41
|
+
timeout (Union[Unset, int]): The timeout for the deployment in seconds
|
34
42
|
type_ (Union[Unset, str]): The type of origin for the deployment (hf_private_endpoint, hf_public_endpoint)
|
35
43
|
"""
|
36
44
|
|
37
45
|
args: Union[Unset, list[Any]] = UNSET
|
38
46
|
command: Union[Unset, list[Any]] = UNSET
|
47
|
+
configuration: Union[Unset, "RuntimeConfiguration"] = UNSET
|
39
48
|
cpu: Union[Unset, int] = UNSET
|
40
49
|
endpoint_name: Union[Unset, str] = UNSET
|
41
50
|
envs: Union[Unset, list[Any]] = UNSET
|
51
|
+
generation: Union[Unset, str] = UNSET
|
42
52
|
image: Union[Unset, str] = UNSET
|
53
|
+
max_scale: Union[Unset, int] = UNSET
|
43
54
|
memory: Union[Unset, int] = UNSET
|
44
55
|
metric_port: Union[Unset, int] = UNSET
|
56
|
+
min_scale: Union[Unset, int] = UNSET
|
45
57
|
model: Union[Unset, str] = UNSET
|
46
58
|
organization: Union[Unset, str] = UNSET
|
47
|
-
|
59
|
+
ports: Union[Unset, list["Port"]] = UNSET
|
48
60
|
startup_probe: Union[Unset, "RuntimeStartupProbe"] = UNSET
|
61
|
+
timeout: Union[Unset, int] = UNSET
|
49
62
|
type_: Union[Unset, str] = UNSET
|
50
63
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
51
64
|
|
@@ -58,6 +71,16 @@ class Runtime:
|
|
58
71
|
if not isinstance(self.command, Unset):
|
59
72
|
command = self.command
|
60
73
|
|
74
|
+
configuration: Union[Unset, dict[str, Any]] = UNSET
|
75
|
+
if (
|
76
|
+
self.configuration
|
77
|
+
and not isinstance(self.configuration, Unset)
|
78
|
+
and not isinstance(self.configuration, dict)
|
79
|
+
):
|
80
|
+
configuration = self.configuration.to_dict()
|
81
|
+
elif self.configuration and isinstance(self.configuration, dict):
|
82
|
+
configuration = self.configuration
|
83
|
+
|
61
84
|
cpu = self.cpu
|
62
85
|
|
63
86
|
endpoint_name = self.endpoint_name
|
@@ -66,17 +89,31 @@ class Runtime:
|
|
66
89
|
if not isinstance(self.envs, Unset):
|
67
90
|
envs = self.envs
|
68
91
|
|
92
|
+
generation = self.generation
|
93
|
+
|
69
94
|
image = self.image
|
70
95
|
|
96
|
+
max_scale = self.max_scale
|
97
|
+
|
71
98
|
memory = self.memory
|
72
99
|
|
73
100
|
metric_port = self.metric_port
|
74
101
|
|
102
|
+
min_scale = self.min_scale
|
103
|
+
|
75
104
|
model = self.model
|
76
105
|
|
77
106
|
organization = self.organization
|
78
107
|
|
79
|
-
|
108
|
+
ports: Union[Unset, list[dict[str, Any]]] = UNSET
|
109
|
+
if not isinstance(self.ports, Unset):
|
110
|
+
ports = []
|
111
|
+
for componentsschemas_ports_item_data in self.ports:
|
112
|
+
if type(componentsschemas_ports_item_data) == dict:
|
113
|
+
componentsschemas_ports_item = componentsschemas_ports_item_data
|
114
|
+
else:
|
115
|
+
componentsschemas_ports_item = componentsschemas_ports_item_data.to_dict()
|
116
|
+
ports.append(componentsschemas_ports_item)
|
80
117
|
|
81
118
|
startup_probe: Union[Unset, dict[str, Any]] = UNSET
|
82
119
|
if (
|
@@ -88,6 +125,8 @@ class Runtime:
|
|
88
125
|
elif self.startup_probe and isinstance(self.startup_probe, dict):
|
89
126
|
startup_probe = self.startup_probe
|
90
127
|
|
128
|
+
timeout = self.timeout
|
129
|
+
|
91
130
|
type_ = self.type_
|
92
131
|
|
93
132
|
field_dict: dict[str, Any] = {}
|
@@ -97,26 +136,36 @@ class Runtime:
|
|
97
136
|
field_dict["args"] = args
|
98
137
|
if command is not UNSET:
|
99
138
|
field_dict["command"] = command
|
139
|
+
if configuration is not UNSET:
|
140
|
+
field_dict["configuration"] = configuration
|
100
141
|
if cpu is not UNSET:
|
101
142
|
field_dict["cpu"] = cpu
|
102
143
|
if endpoint_name is not UNSET:
|
103
144
|
field_dict["endpointName"] = endpoint_name
|
104
145
|
if envs is not UNSET:
|
105
146
|
field_dict["envs"] = envs
|
147
|
+
if generation is not UNSET:
|
148
|
+
field_dict["generation"] = generation
|
106
149
|
if image is not UNSET:
|
107
150
|
field_dict["image"] = image
|
151
|
+
if max_scale is not UNSET:
|
152
|
+
field_dict["maxScale"] = max_scale
|
108
153
|
if memory is not UNSET:
|
109
154
|
field_dict["memory"] = memory
|
110
155
|
if metric_port is not UNSET:
|
111
156
|
field_dict["metricPort"] = metric_port
|
157
|
+
if min_scale is not UNSET:
|
158
|
+
field_dict["minScale"] = min_scale
|
112
159
|
if model is not UNSET:
|
113
160
|
field_dict["model"] = model
|
114
161
|
if organization is not UNSET:
|
115
162
|
field_dict["organization"] = organization
|
116
|
-
if
|
117
|
-
field_dict["
|
163
|
+
if ports is not UNSET:
|
164
|
+
field_dict["ports"] = ports
|
118
165
|
if startup_probe is not UNSET:
|
119
166
|
field_dict["startupProbe"] = startup_probe
|
167
|
+
if timeout is not UNSET:
|
168
|
+
field_dict["timeout"] = timeout
|
120
169
|
if type_ is not UNSET:
|
121
170
|
field_dict["type"] = type_
|
122
171
|
|
@@ -124,6 +173,8 @@ class Runtime:
|
|
124
173
|
|
125
174
|
@classmethod
|
126
175
|
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
176
|
+
from ..models.port import Port
|
177
|
+
from ..models.runtime_configuration import RuntimeConfiguration
|
127
178
|
from ..models.runtime_startup_probe import RuntimeStartupProbe
|
128
179
|
|
129
180
|
if not src_dict:
|
@@ -133,23 +184,41 @@ class Runtime:
|
|
133
184
|
|
134
185
|
command = cast(list[Any], d.pop("command", UNSET))
|
135
186
|
|
187
|
+
_configuration = d.pop("configuration", UNSET)
|
188
|
+
configuration: Union[Unset, RuntimeConfiguration]
|
189
|
+
if isinstance(_configuration, Unset):
|
190
|
+
configuration = UNSET
|
191
|
+
else:
|
192
|
+
configuration = RuntimeConfiguration.from_dict(_configuration)
|
193
|
+
|
136
194
|
cpu = d.pop("cpu", UNSET)
|
137
195
|
|
138
196
|
endpoint_name = d.pop("endpointName", UNSET)
|
139
197
|
|
140
198
|
envs = cast(list[Any], d.pop("envs", UNSET))
|
141
199
|
|
200
|
+
generation = d.pop("generation", UNSET)
|
201
|
+
|
142
202
|
image = d.pop("image", UNSET)
|
143
203
|
|
204
|
+
max_scale = d.pop("maxScale", UNSET)
|
205
|
+
|
144
206
|
memory = d.pop("memory", UNSET)
|
145
207
|
|
146
208
|
metric_port = d.pop("metricPort", UNSET)
|
147
209
|
|
210
|
+
min_scale = d.pop("minScale", UNSET)
|
211
|
+
|
148
212
|
model = d.pop("model", UNSET)
|
149
213
|
|
150
214
|
organization = d.pop("organization", UNSET)
|
151
215
|
|
152
|
-
|
216
|
+
ports = []
|
217
|
+
_ports = d.pop("ports", UNSET)
|
218
|
+
for componentsschemas_ports_item_data in _ports or []:
|
219
|
+
componentsschemas_ports_item = Port.from_dict(componentsschemas_ports_item_data)
|
220
|
+
|
221
|
+
ports.append(componentsschemas_ports_item)
|
153
222
|
|
154
223
|
_startup_probe = d.pop("startupProbe", UNSET)
|
155
224
|
startup_probe: Union[Unset, RuntimeStartupProbe]
|
@@ -158,21 +227,28 @@ class Runtime:
|
|
158
227
|
else:
|
159
228
|
startup_probe = RuntimeStartupProbe.from_dict(_startup_probe)
|
160
229
|
|
230
|
+
timeout = d.pop("timeout", UNSET)
|
231
|
+
|
161
232
|
type_ = d.pop("type", UNSET)
|
162
233
|
|
163
234
|
runtime = cls(
|
164
235
|
args=args,
|
165
236
|
command=command,
|
237
|
+
configuration=configuration,
|
166
238
|
cpu=cpu,
|
167
239
|
endpoint_name=endpoint_name,
|
168
240
|
envs=envs,
|
241
|
+
generation=generation,
|
169
242
|
image=image,
|
243
|
+
max_scale=max_scale,
|
170
244
|
memory=memory,
|
171
245
|
metric_port=metric_port,
|
246
|
+
min_scale=min_scale,
|
172
247
|
model=model,
|
173
248
|
organization=organization,
|
174
|
-
|
249
|
+
ports=ports,
|
175
250
|
startup_probe=startup_probe,
|
251
|
+
timeout=timeout,
|
176
252
|
type_=type_,
|
177
253
|
)
|
178
254
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
from typing import Any, TypeVar
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
T = TypeVar("T", bound="RuntimeConfiguration")
|
7
|
+
|
8
|
+
|
9
|
+
@_attrs_define
|
10
|
+
class RuntimeConfiguration:
|
11
|
+
"""The configuration for the deployment"""
|
12
|
+
|
13
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
14
|
+
|
15
|
+
def to_dict(self) -> dict[str, Any]:
|
16
|
+
field_dict: dict[str, Any] = {}
|
17
|
+
field_dict.update(self.additional_properties)
|
18
|
+
|
19
|
+
return field_dict
|
20
|
+
|
21
|
+
@classmethod
|
22
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
23
|
+
if not src_dict:
|
24
|
+
return None
|
25
|
+
d = src_dict.copy()
|
26
|
+
runtime_configuration = cls()
|
27
|
+
|
28
|
+
runtime_configuration.additional_properties = d
|
29
|
+
return runtime_configuration
|
30
|
+
|
31
|
+
@property
|
32
|
+
def additional_keys(self) -> list[str]:
|
33
|
+
return list(self.additional_properties.keys())
|
34
|
+
|
35
|
+
def __getitem__(self, key: str) -> Any:
|
36
|
+
return self.additional_properties[key]
|
37
|
+
|
38
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
39
|
+
self.additional_properties[key] = value
|
40
|
+
|
41
|
+
def __delitem__(self, key: str) -> None:
|
42
|
+
del self.additional_properties[key]
|
43
|
+
|
44
|
+
def __contains__(self, key: str) -> bool:
|
45
|
+
return key in self.additional_properties
|
@@ -0,0 +1,129 @@
|
|
1
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
from ..types import UNSET, Unset
|
7
|
+
|
8
|
+
if TYPE_CHECKING:
|
9
|
+
from ..models.core_event import CoreEvent
|
10
|
+
from ..models.metadata import Metadata
|
11
|
+
from ..models.sandbox_spec import SandboxSpec
|
12
|
+
|
13
|
+
|
14
|
+
T = TypeVar("T", bound="Sandbox")
|
15
|
+
|
16
|
+
|
17
|
+
@_attrs_define
|
18
|
+
class Sandbox:
|
19
|
+
"""Micro VM for running agentic tasks
|
20
|
+
|
21
|
+
Attributes:
|
22
|
+
events (Union[Unset, list['CoreEvent']]): Core events
|
23
|
+
metadata (Union[Unset, Metadata]): Metadata
|
24
|
+
spec (Union[Unset, SandboxSpec]): Sandbox specification
|
25
|
+
status (Union[Unset, str]): Sandbox status
|
26
|
+
"""
|
27
|
+
|
28
|
+
events: Union[Unset, list["CoreEvent"]] = UNSET
|
29
|
+
metadata: Union[Unset, "Metadata"] = UNSET
|
30
|
+
spec: Union[Unset, "SandboxSpec"] = UNSET
|
31
|
+
status: Union[Unset, str] = UNSET
|
32
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
33
|
+
|
34
|
+
def to_dict(self) -> dict[str, Any]:
|
35
|
+
events: Union[Unset, list[dict[str, Any]]] = UNSET
|
36
|
+
if not isinstance(self.events, Unset):
|
37
|
+
events = []
|
38
|
+
for componentsschemas_core_events_item_data in self.events:
|
39
|
+
if type(componentsschemas_core_events_item_data) == dict:
|
40
|
+
componentsschemas_core_events_item = componentsschemas_core_events_item_data
|
41
|
+
else:
|
42
|
+
componentsschemas_core_events_item = componentsschemas_core_events_item_data.to_dict()
|
43
|
+
events.append(componentsschemas_core_events_item)
|
44
|
+
|
45
|
+
metadata: Union[Unset, dict[str, Any]] = UNSET
|
46
|
+
if self.metadata and not isinstance(self.metadata, Unset) and not isinstance(self.metadata, dict):
|
47
|
+
metadata = self.metadata.to_dict()
|
48
|
+
elif self.metadata and isinstance(self.metadata, dict):
|
49
|
+
metadata = self.metadata
|
50
|
+
|
51
|
+
spec: Union[Unset, dict[str, Any]] = UNSET
|
52
|
+
if self.spec and not isinstance(self.spec, Unset) and not isinstance(self.spec, dict):
|
53
|
+
spec = self.spec.to_dict()
|
54
|
+
elif self.spec and isinstance(self.spec, dict):
|
55
|
+
spec = self.spec
|
56
|
+
|
57
|
+
status = self.status
|
58
|
+
|
59
|
+
field_dict: dict[str, Any] = {}
|
60
|
+
field_dict.update(self.additional_properties)
|
61
|
+
field_dict.update({})
|
62
|
+
if events is not UNSET:
|
63
|
+
field_dict["events"] = events
|
64
|
+
if metadata is not UNSET:
|
65
|
+
field_dict["metadata"] = metadata
|
66
|
+
if spec is not UNSET:
|
67
|
+
field_dict["spec"] = spec
|
68
|
+
if status is not UNSET:
|
69
|
+
field_dict["status"] = status
|
70
|
+
|
71
|
+
return field_dict
|
72
|
+
|
73
|
+
@classmethod
|
74
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
75
|
+
from ..models.core_event import CoreEvent
|
76
|
+
from ..models.metadata import Metadata
|
77
|
+
from ..models.sandbox_spec import SandboxSpec
|
78
|
+
|
79
|
+
if not src_dict:
|
80
|
+
return None
|
81
|
+
d = src_dict.copy()
|
82
|
+
events = []
|
83
|
+
_events = d.pop("events", UNSET)
|
84
|
+
for componentsschemas_core_events_item_data in _events or []:
|
85
|
+
componentsschemas_core_events_item = CoreEvent.from_dict(componentsschemas_core_events_item_data)
|
86
|
+
|
87
|
+
events.append(componentsschemas_core_events_item)
|
88
|
+
|
89
|
+
_metadata = d.pop("metadata", UNSET)
|
90
|
+
metadata: Union[Unset, Metadata]
|
91
|
+
if isinstance(_metadata, Unset):
|
92
|
+
metadata = UNSET
|
93
|
+
else:
|
94
|
+
metadata = Metadata.from_dict(_metadata)
|
95
|
+
|
96
|
+
_spec = d.pop("spec", UNSET)
|
97
|
+
spec: Union[Unset, SandboxSpec]
|
98
|
+
if isinstance(_spec, Unset):
|
99
|
+
spec = UNSET
|
100
|
+
else:
|
101
|
+
spec = SandboxSpec.from_dict(_spec)
|
102
|
+
|
103
|
+
status = d.pop("status", UNSET)
|
104
|
+
|
105
|
+
sandbox = cls(
|
106
|
+
events=events,
|
107
|
+
metadata=metadata,
|
108
|
+
spec=spec,
|
109
|
+
status=status,
|
110
|
+
)
|
111
|
+
|
112
|
+
sandbox.additional_properties = d
|
113
|
+
return sandbox
|
114
|
+
|
115
|
+
@property
|
116
|
+
def additional_keys(self) -> list[str]:
|
117
|
+
return list(self.additional_properties.keys())
|
118
|
+
|
119
|
+
def __getitem__(self, key: str) -> Any:
|
120
|
+
return self.additional_properties[key]
|
121
|
+
|
122
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
123
|
+
self.additional_properties[key] = value
|
124
|
+
|
125
|
+
def __delitem__(self, key: str) -> None:
|
126
|
+
del self.additional_properties[key]
|
127
|
+
|
128
|
+
def __contains__(self, key: str) -> bool:
|
129
|
+
return key in self.additional_properties
|
@@ -0,0 +1,181 @@
|
|
1
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
from ..types import UNSET, Unset
|
7
|
+
|
8
|
+
if TYPE_CHECKING:
|
9
|
+
from ..models.port import Port
|
10
|
+
|
11
|
+
|
12
|
+
T = TypeVar("T", bound="SandboxDefinition")
|
13
|
+
|
14
|
+
|
15
|
+
@_attrs_define
|
16
|
+
class SandboxDefinition:
|
17
|
+
"""Sandbox definition for admin store operations
|
18
|
+
|
19
|
+
Attributes:
|
20
|
+
categories (Union[Unset, list[Any]]): Categories of the defintion
|
21
|
+
coming_soon (Union[Unset, bool]): If the definition is coming soon
|
22
|
+
description (Union[Unset, str]): Description of the defintion
|
23
|
+
display_name (Union[Unset, str]): Display name of the definition
|
24
|
+
enterprise (Union[Unset, bool]): If the definition is enterprise
|
25
|
+
icon (Union[Unset, str]): Icon of the definition
|
26
|
+
image (Union[Unset, str]): Image of the Sandbox definition
|
27
|
+
long_description (Union[Unset, str]): Long description of the defintion
|
28
|
+
memory (Union[Unset, int]): Memory of the Sandbox definition in MB
|
29
|
+
name (Union[Unset, str]): Name of the artifact
|
30
|
+
ports (Union[Unset, list['Port']]): Set of ports for a resource
|
31
|
+
url (Union[Unset, str]): URL of the definition
|
32
|
+
"""
|
33
|
+
|
34
|
+
categories: Union[Unset, list[Any]] = UNSET
|
35
|
+
coming_soon: Union[Unset, bool] = UNSET
|
36
|
+
description: Union[Unset, str] = UNSET
|
37
|
+
display_name: Union[Unset, str] = UNSET
|
38
|
+
enterprise: Union[Unset, bool] = UNSET
|
39
|
+
icon: Union[Unset, str] = UNSET
|
40
|
+
image: Union[Unset, str] = UNSET
|
41
|
+
long_description: Union[Unset, str] = UNSET
|
42
|
+
memory: Union[Unset, int] = UNSET
|
43
|
+
name: Union[Unset, str] = UNSET
|
44
|
+
ports: Union[Unset, list["Port"]] = UNSET
|
45
|
+
url: Union[Unset, str] = UNSET
|
46
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
47
|
+
|
48
|
+
def to_dict(self) -> dict[str, Any]:
|
49
|
+
categories: Union[Unset, list[Any]] = UNSET
|
50
|
+
if not isinstance(self.categories, Unset):
|
51
|
+
categories = self.categories
|
52
|
+
|
53
|
+
coming_soon = self.coming_soon
|
54
|
+
|
55
|
+
description = self.description
|
56
|
+
|
57
|
+
display_name = self.display_name
|
58
|
+
|
59
|
+
enterprise = self.enterprise
|
60
|
+
|
61
|
+
icon = self.icon
|
62
|
+
|
63
|
+
image = self.image
|
64
|
+
|
65
|
+
long_description = self.long_description
|
66
|
+
|
67
|
+
memory = self.memory
|
68
|
+
|
69
|
+
name = self.name
|
70
|
+
|
71
|
+
ports: Union[Unset, list[dict[str, Any]]] = UNSET
|
72
|
+
if not isinstance(self.ports, Unset):
|
73
|
+
ports = []
|
74
|
+
for componentsschemas_ports_item_data in self.ports:
|
75
|
+
if type(componentsschemas_ports_item_data) == dict:
|
76
|
+
componentsschemas_ports_item = componentsschemas_ports_item_data
|
77
|
+
else:
|
78
|
+
componentsschemas_ports_item = componentsschemas_ports_item_data.to_dict()
|
79
|
+
ports.append(componentsschemas_ports_item)
|
80
|
+
|
81
|
+
url = self.url
|
82
|
+
|
83
|
+
field_dict: dict[str, Any] = {}
|
84
|
+
field_dict.update(self.additional_properties)
|
85
|
+
field_dict.update({})
|
86
|
+
if categories is not UNSET:
|
87
|
+
field_dict["categories"] = categories
|
88
|
+
if coming_soon is not UNSET:
|
89
|
+
field_dict["coming_soon"] = coming_soon
|
90
|
+
if description is not UNSET:
|
91
|
+
field_dict["description"] = description
|
92
|
+
if display_name is not UNSET:
|
93
|
+
field_dict["displayName"] = display_name
|
94
|
+
if enterprise is not UNSET:
|
95
|
+
field_dict["enterprise"] = enterprise
|
96
|
+
if icon is not UNSET:
|
97
|
+
field_dict["icon"] = icon
|
98
|
+
if image is not UNSET:
|
99
|
+
field_dict["image"] = image
|
100
|
+
if long_description is not UNSET:
|
101
|
+
field_dict["longDescription"] = long_description
|
102
|
+
if memory is not UNSET:
|
103
|
+
field_dict["memory"] = memory
|
104
|
+
if name is not UNSET:
|
105
|
+
field_dict["name"] = name
|
106
|
+
if ports is not UNSET:
|
107
|
+
field_dict["ports"] = ports
|
108
|
+
if url is not UNSET:
|
109
|
+
field_dict["url"] = url
|
110
|
+
|
111
|
+
return field_dict
|
112
|
+
|
113
|
+
@classmethod
|
114
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
115
|
+
from ..models.port import Port
|
116
|
+
|
117
|
+
if not src_dict:
|
118
|
+
return None
|
119
|
+
d = src_dict.copy()
|
120
|
+
categories = cast(list[Any], d.pop("categories", UNSET))
|
121
|
+
|
122
|
+
coming_soon = d.pop("coming_soon", UNSET)
|
123
|
+
|
124
|
+
description = d.pop("description", UNSET)
|
125
|
+
|
126
|
+
display_name = d.pop("displayName", UNSET)
|
127
|
+
|
128
|
+
enterprise = d.pop("enterprise", UNSET)
|
129
|
+
|
130
|
+
icon = d.pop("icon", UNSET)
|
131
|
+
|
132
|
+
image = d.pop("image", UNSET)
|
133
|
+
|
134
|
+
long_description = d.pop("longDescription", UNSET)
|
135
|
+
|
136
|
+
memory = d.pop("memory", UNSET)
|
137
|
+
|
138
|
+
name = d.pop("name", UNSET)
|
139
|
+
|
140
|
+
ports = []
|
141
|
+
_ports = d.pop("ports", UNSET)
|
142
|
+
for componentsschemas_ports_item_data in _ports or []:
|
143
|
+
componentsschemas_ports_item = Port.from_dict(componentsschemas_ports_item_data)
|
144
|
+
|
145
|
+
ports.append(componentsschemas_ports_item)
|
146
|
+
|
147
|
+
url = d.pop("url", UNSET)
|
148
|
+
|
149
|
+
sandbox_definition = cls(
|
150
|
+
categories=categories,
|
151
|
+
coming_soon=coming_soon,
|
152
|
+
description=description,
|
153
|
+
display_name=display_name,
|
154
|
+
enterprise=enterprise,
|
155
|
+
icon=icon,
|
156
|
+
image=image,
|
157
|
+
long_description=long_description,
|
158
|
+
memory=memory,
|
159
|
+
name=name,
|
160
|
+
ports=ports,
|
161
|
+
url=url,
|
162
|
+
)
|
163
|
+
|
164
|
+
sandbox_definition.additional_properties = d
|
165
|
+
return sandbox_definition
|
166
|
+
|
167
|
+
@property
|
168
|
+
def additional_keys(self) -> list[str]:
|
169
|
+
return list(self.additional_properties.keys())
|
170
|
+
|
171
|
+
def __getitem__(self, key: str) -> Any:
|
172
|
+
return self.additional_properties[key]
|
173
|
+
|
174
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
175
|
+
self.additional_properties[key] = value
|
176
|
+
|
177
|
+
def __delitem__(self, key: str) -> None:
|
178
|
+
del self.additional_properties[key]
|
179
|
+
|
180
|
+
def __contains__(self, key: str) -> bool:
|
181
|
+
return key in self.additional_properties
|