-
Notifications
You must be signed in to change notification settings - Fork 887
Expand file tree
/
Copy pathsandbox_api.py
More file actions
80 lines (67 loc) · 1.8 KB
/
sandbox_api.py
File metadata and controls
80 lines (67 loc) · 1.8 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
from dataclasses import dataclass
from typing import Optional, Dict
from datetime import datetime
from e2b.api.client.models import SandboxState
@dataclass
class SandboxInfo:
"""Information about a sandbox."""
sandbox_id: str
"""Sandbox ID."""
sandbox_domain: Optional[str]
"""Domain where the sandbox is hosted."""
template_id: str
"""Template ID."""
name: Optional[str]
"""Template name."""
metadata: Dict[str, str]
"""Saved sandbox metadata."""
started_at: datetime
"""Sandbox start time."""
end_at: datetime
"""Sandbox expiration date."""
envd_version: Optional[str]
"""Envd version."""
_envd_access_token: Optional[str]
"""Envd access token."""
@dataclass
class ListedSandbox:
"""Information about a sandbox."""
sandbox_id: str
"""Sandbox ID."""
template_id: str
"""Template ID."""
name: Optional[str]
"""Template Alias."""
state: SandboxState
"""Sandbox state."""
cpu_count: int
"""Sandbox CPU count."""
memory_mb: int
"""Sandbox Memory size in MB."""
metadata: Dict[str, str]
"""Saved sandbox metadata."""
started_at: datetime
"""Sandbox start time."""
end_at: datetime
@dataclass
class SandboxQuery:
"""Query parameters for listing sandboxes."""
metadata: Optional[dict[str, str]] = None
"""Filter sandboxes by metadata."""
@dataclass
class SandboxMetrics:
"""Sandbox metrics."""
cpu_count: int
"""Number of CPUs."""
cpu_used_pct: float
"""CPU usage percentage."""
disk_total: int
"""Total disk space in bytes."""
disk_used: int
"""Disk used in bytes."""
mem_total: int
"""Total memory in bytes."""
mem_used: int
"""Memory used in bytes."""
timestamp: datetime
"""Timestamp of the metric entry."""