moru 0.1.0__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.
Files changed (152) hide show
  1. moru/__init__.py +174 -0
  2. moru/api/__init__.py +164 -0
  3. moru/api/client/__init__.py +8 -0
  4. moru/api/client/api/__init__.py +1 -0
  5. moru/api/client/api/sandboxes/__init__.py +1 -0
  6. moru/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py +161 -0
  7. moru/api/client/api/sandboxes/get_sandboxes.py +176 -0
  8. moru/api/client/api/sandboxes/get_sandboxes_metrics.py +173 -0
  9. moru/api/client/api/sandboxes/get_sandboxes_sandbox_id.py +163 -0
  10. moru/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py +199 -0
  11. moru/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +212 -0
  12. moru/api/client/api/sandboxes/get_v2_sandboxes.py +230 -0
  13. moru/api/client/api/sandboxes/post_sandboxes.py +172 -0
  14. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py +193 -0
  15. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py +165 -0
  16. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py +181 -0
  17. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py +189 -0
  18. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py +193 -0
  19. moru/api/client/api/templates/__init__.py +1 -0
  20. moru/api/client/api/templates/delete_templates_template_id.py +157 -0
  21. moru/api/client/api/templates/get_templates.py +172 -0
  22. moru/api/client/api/templates/get_templates_template_id.py +195 -0
  23. moru/api/client/api/templates/get_templates_template_id_builds_build_id_status.py +217 -0
  24. moru/api/client/api/templates/get_templates_template_id_files_hash.py +180 -0
  25. moru/api/client/api/templates/patch_templates_template_id.py +183 -0
  26. moru/api/client/api/templates/post_templates.py +172 -0
  27. moru/api/client/api/templates/post_templates_template_id.py +181 -0
  28. moru/api/client/api/templates/post_templates_template_id_builds_build_id.py +170 -0
  29. moru/api/client/api/templates/post_v2_templates.py +172 -0
  30. moru/api/client/api/templates/post_v3_templates.py +172 -0
  31. moru/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py +192 -0
  32. moru/api/client/client.py +286 -0
  33. moru/api/client/errors.py +16 -0
  34. moru/api/client/models/__init__.py +123 -0
  35. moru/api/client/models/aws_registry.py +85 -0
  36. moru/api/client/models/aws_registry_type.py +8 -0
  37. moru/api/client/models/build_log_entry.py +89 -0
  38. moru/api/client/models/build_status_reason.py +95 -0
  39. moru/api/client/models/connect_sandbox.py +59 -0
  40. moru/api/client/models/created_access_token.py +100 -0
  41. moru/api/client/models/created_team_api_key.py +166 -0
  42. moru/api/client/models/disk_metrics.py +91 -0
  43. moru/api/client/models/error.py +67 -0
  44. moru/api/client/models/gcp_registry.py +69 -0
  45. moru/api/client/models/gcp_registry_type.py +8 -0
  46. moru/api/client/models/general_registry.py +77 -0
  47. moru/api/client/models/general_registry_type.py +8 -0
  48. moru/api/client/models/identifier_masking_details.py +83 -0
  49. moru/api/client/models/listed_sandbox.py +154 -0
  50. moru/api/client/models/log_level.py +11 -0
  51. moru/api/client/models/max_team_metric.py +78 -0
  52. moru/api/client/models/mcp_type_0.py +44 -0
  53. moru/api/client/models/new_access_token.py +59 -0
  54. moru/api/client/models/new_sandbox.py +172 -0
  55. moru/api/client/models/new_team_api_key.py +59 -0
  56. moru/api/client/models/node.py +155 -0
  57. moru/api/client/models/node_detail.py +165 -0
  58. moru/api/client/models/node_metrics.py +122 -0
  59. moru/api/client/models/node_status.py +11 -0
  60. moru/api/client/models/node_status_change.py +79 -0
  61. moru/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py +59 -0
  62. moru/api/client/models/post_sandboxes_sandbox_id_timeout_body.py +59 -0
  63. moru/api/client/models/resumed_sandbox.py +68 -0
  64. moru/api/client/models/sandbox.py +145 -0
  65. moru/api/client/models/sandbox_detail.py +183 -0
  66. moru/api/client/models/sandbox_log.py +70 -0
  67. moru/api/client/models/sandbox_log_entry.py +93 -0
  68. moru/api/client/models/sandbox_log_entry_fields.py +44 -0
  69. moru/api/client/models/sandbox_logs.py +91 -0
  70. moru/api/client/models/sandbox_metric.py +118 -0
  71. moru/api/client/models/sandbox_network_config.py +92 -0
  72. moru/api/client/models/sandbox_state.py +9 -0
  73. moru/api/client/models/sandboxes_with_metrics.py +59 -0
  74. moru/api/client/models/team.py +83 -0
  75. moru/api/client/models/team_api_key.py +158 -0
  76. moru/api/client/models/team_metric.py +86 -0
  77. moru/api/client/models/team_user.py +68 -0
  78. moru/api/client/models/template.py +217 -0
  79. moru/api/client/models/template_build.py +139 -0
  80. moru/api/client/models/template_build_file_upload.py +70 -0
  81. moru/api/client/models/template_build_info.py +126 -0
  82. moru/api/client/models/template_build_request.py +115 -0
  83. moru/api/client/models/template_build_request_v2.py +88 -0
  84. moru/api/client/models/template_build_request_v3.py +88 -0
  85. moru/api/client/models/template_build_start_v2.py +184 -0
  86. moru/api/client/models/template_build_status.py +11 -0
  87. moru/api/client/models/template_legacy.py +207 -0
  88. moru/api/client/models/template_request_response_v3.py +83 -0
  89. moru/api/client/models/template_step.py +91 -0
  90. moru/api/client/models/template_update_request.py +59 -0
  91. moru/api/client/models/template_with_builds.py +148 -0
  92. moru/api/client/models/update_team_api_key.py +59 -0
  93. moru/api/client/py.typed +1 -0
  94. moru/api/client/types.py +54 -0
  95. moru/api/client_async/__init__.py +50 -0
  96. moru/api/client_sync/__init__.py +52 -0
  97. moru/api/metadata.py +14 -0
  98. moru/connection_config.py +217 -0
  99. moru/envd/api.py +59 -0
  100. moru/envd/filesystem/filesystem_connect.py +193 -0
  101. moru/envd/filesystem/filesystem_pb2.py +76 -0
  102. moru/envd/filesystem/filesystem_pb2.pyi +233 -0
  103. moru/envd/process/process_connect.py +155 -0
  104. moru/envd/process/process_pb2.py +92 -0
  105. moru/envd/process/process_pb2.pyi +304 -0
  106. moru/envd/rpc.py +61 -0
  107. moru/envd/versions.py +6 -0
  108. moru/exceptions.py +95 -0
  109. moru/sandbox/commands/command_handle.py +69 -0
  110. moru/sandbox/commands/main.py +39 -0
  111. moru/sandbox/filesystem/filesystem.py +94 -0
  112. moru/sandbox/filesystem/watch_handle.py +60 -0
  113. moru/sandbox/main.py +210 -0
  114. moru/sandbox/mcp.py +1120 -0
  115. moru/sandbox/network.py +8 -0
  116. moru/sandbox/sandbox_api.py +210 -0
  117. moru/sandbox/signature.py +45 -0
  118. moru/sandbox/utils.py +34 -0
  119. moru/sandbox_async/commands/command.py +336 -0
  120. moru/sandbox_async/commands/command_handle.py +196 -0
  121. moru/sandbox_async/commands/pty.py +240 -0
  122. moru/sandbox_async/filesystem/filesystem.py +531 -0
  123. moru/sandbox_async/filesystem/watch_handle.py +62 -0
  124. moru/sandbox_async/main.py +734 -0
  125. moru/sandbox_async/paginator.py +69 -0
  126. moru/sandbox_async/sandbox_api.py +325 -0
  127. moru/sandbox_async/utils.py +7 -0
  128. moru/sandbox_sync/commands/command.py +328 -0
  129. moru/sandbox_sync/commands/command_handle.py +150 -0
  130. moru/sandbox_sync/commands/pty.py +230 -0
  131. moru/sandbox_sync/filesystem/filesystem.py +518 -0
  132. moru/sandbox_sync/filesystem/watch_handle.py +69 -0
  133. moru/sandbox_sync/main.py +726 -0
  134. moru/sandbox_sync/paginator.py +69 -0
  135. moru/sandbox_sync/sandbox_api.py +308 -0
  136. moru/template/consts.py +30 -0
  137. moru/template/dockerfile_parser.py +275 -0
  138. moru/template/logger.py +232 -0
  139. moru/template/main.py +1360 -0
  140. moru/template/readycmd.py +138 -0
  141. moru/template/types.py +105 -0
  142. moru/template/utils.py +320 -0
  143. moru/template_async/build_api.py +202 -0
  144. moru/template_async/main.py +366 -0
  145. moru/template_sync/build_api.py +199 -0
  146. moru/template_sync/main.py +371 -0
  147. moru-0.1.0.dist-info/METADATA +63 -0
  148. moru-0.1.0.dist-info/RECORD +152 -0
  149. moru-0.1.0.dist-info/WHEEL +4 -0
  150. moru-0.1.0.dist-info/licenses/LICENSE +9 -0
  151. moru_connect/__init__.py +1 -0
  152. moru_connect/client.py +493 -0
@@ -0,0 +1,91 @@
1
+ from collections.abc import Mapping
2
+ from typing import TYPE_CHECKING, Any, TypeVar
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ if TYPE_CHECKING:
8
+ from ..models.sandbox_log import SandboxLog
9
+ from ..models.sandbox_log_entry import SandboxLogEntry
10
+
11
+
12
+ T = TypeVar("T", bound="SandboxLogs")
13
+
14
+
15
+ @_attrs_define
16
+ class SandboxLogs:
17
+ """
18
+ Attributes:
19
+ log_entries (list['SandboxLogEntry']): Structured logs of the sandbox
20
+ logs (list['SandboxLog']): Logs of the sandbox
21
+ """
22
+
23
+ log_entries: list["SandboxLogEntry"]
24
+ logs: list["SandboxLog"]
25
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
26
+
27
+ def to_dict(self) -> dict[str, Any]:
28
+ log_entries = []
29
+ for log_entries_item_data in self.log_entries:
30
+ log_entries_item = log_entries_item_data.to_dict()
31
+ log_entries.append(log_entries_item)
32
+
33
+ logs = []
34
+ for logs_item_data in self.logs:
35
+ logs_item = logs_item_data.to_dict()
36
+ logs.append(logs_item)
37
+
38
+ field_dict: dict[str, Any] = {}
39
+ field_dict.update(self.additional_properties)
40
+ field_dict.update(
41
+ {
42
+ "logEntries": log_entries,
43
+ "logs": logs,
44
+ }
45
+ )
46
+
47
+ return field_dict
48
+
49
+ @classmethod
50
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
51
+ from ..models.sandbox_log import SandboxLog
52
+ from ..models.sandbox_log_entry import SandboxLogEntry
53
+
54
+ d = dict(src_dict)
55
+ log_entries = []
56
+ _log_entries = d.pop("logEntries")
57
+ for log_entries_item_data in _log_entries:
58
+ log_entries_item = SandboxLogEntry.from_dict(log_entries_item_data)
59
+
60
+ log_entries.append(log_entries_item)
61
+
62
+ logs = []
63
+ _logs = d.pop("logs")
64
+ for logs_item_data in _logs:
65
+ logs_item = SandboxLog.from_dict(logs_item_data)
66
+
67
+ logs.append(logs_item)
68
+
69
+ sandbox_logs = cls(
70
+ log_entries=log_entries,
71
+ logs=logs,
72
+ )
73
+
74
+ sandbox_logs.additional_properties = d
75
+ return sandbox_logs
76
+
77
+ @property
78
+ def additional_keys(self) -> list[str]:
79
+ return list(self.additional_properties.keys())
80
+
81
+ def __getitem__(self, key: str) -> Any:
82
+ return self.additional_properties[key]
83
+
84
+ def __setitem__(self, key: str, value: Any) -> None:
85
+ self.additional_properties[key] = value
86
+
87
+ def __delitem__(self, key: str) -> None:
88
+ del self.additional_properties[key]
89
+
90
+ def __contains__(self, key: str) -> bool:
91
+ return key in self.additional_properties
@@ -0,0 +1,118 @@
1
+ import datetime
2
+ from collections.abc import Mapping
3
+ from typing import Any, TypeVar
4
+
5
+ from attrs import define as _attrs_define
6
+ from attrs import field as _attrs_field
7
+ from dateutil.parser import isoparse
8
+
9
+ T = TypeVar("T", bound="SandboxMetric")
10
+
11
+
12
+ @_attrs_define
13
+ class SandboxMetric:
14
+ """Metric entry with timestamp and line
15
+
16
+ Attributes:
17
+ cpu_count (int): Number of CPU cores
18
+ cpu_used_pct (float): CPU usage percentage
19
+ disk_total (int): Total disk space in bytes
20
+ disk_used (int): Disk used in bytes
21
+ mem_total (int): Total memory in bytes
22
+ mem_used (int): Memory used in bytes
23
+ timestamp (datetime.datetime): Timestamp of the metric entry
24
+ timestamp_unix (int): Timestamp of the metric entry in Unix time (seconds since epoch)
25
+ """
26
+
27
+ cpu_count: int
28
+ cpu_used_pct: float
29
+ disk_total: int
30
+ disk_used: int
31
+ mem_total: int
32
+ mem_used: int
33
+ timestamp: datetime.datetime
34
+ timestamp_unix: int
35
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
36
+
37
+ def to_dict(self) -> dict[str, Any]:
38
+ cpu_count = self.cpu_count
39
+
40
+ cpu_used_pct = self.cpu_used_pct
41
+
42
+ disk_total = self.disk_total
43
+
44
+ disk_used = self.disk_used
45
+
46
+ mem_total = self.mem_total
47
+
48
+ mem_used = self.mem_used
49
+
50
+ timestamp = self.timestamp.isoformat()
51
+
52
+ timestamp_unix = self.timestamp_unix
53
+
54
+ field_dict: dict[str, Any] = {}
55
+ field_dict.update(self.additional_properties)
56
+ field_dict.update(
57
+ {
58
+ "cpuCount": cpu_count,
59
+ "cpuUsedPct": cpu_used_pct,
60
+ "diskTotal": disk_total,
61
+ "diskUsed": disk_used,
62
+ "memTotal": mem_total,
63
+ "memUsed": mem_used,
64
+ "timestamp": timestamp,
65
+ "timestampUnix": timestamp_unix,
66
+ }
67
+ )
68
+
69
+ return field_dict
70
+
71
+ @classmethod
72
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
73
+ d = dict(src_dict)
74
+ cpu_count = d.pop("cpuCount")
75
+
76
+ cpu_used_pct = d.pop("cpuUsedPct")
77
+
78
+ disk_total = d.pop("diskTotal")
79
+
80
+ disk_used = d.pop("diskUsed")
81
+
82
+ mem_total = d.pop("memTotal")
83
+
84
+ mem_used = d.pop("memUsed")
85
+
86
+ timestamp = isoparse(d.pop("timestamp"))
87
+
88
+ timestamp_unix = d.pop("timestampUnix")
89
+
90
+ sandbox_metric = cls(
91
+ cpu_count=cpu_count,
92
+ cpu_used_pct=cpu_used_pct,
93
+ disk_total=disk_total,
94
+ disk_used=disk_used,
95
+ mem_total=mem_total,
96
+ mem_used=mem_used,
97
+ timestamp=timestamp,
98
+ timestamp_unix=timestamp_unix,
99
+ )
100
+
101
+ sandbox_metric.additional_properties = d
102
+ return sandbox_metric
103
+
104
+ @property
105
+ def additional_keys(self) -> list[str]:
106
+ return list(self.additional_properties.keys())
107
+
108
+ def __getitem__(self, key: str) -> Any:
109
+ return self.additional_properties[key]
110
+
111
+ def __setitem__(self, key: str, value: Any) -> None:
112
+ self.additional_properties[key] = value
113
+
114
+ def __delitem__(self, key: str) -> None:
115
+ del self.additional_properties[key]
116
+
117
+ def __contains__(self, key: str) -> bool:
118
+ return key in self.additional_properties
@@ -0,0 +1,92 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar, Union, cast
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ from ..types import UNSET, Unset
8
+
9
+ T = TypeVar("T", bound="SandboxNetworkConfig")
10
+
11
+
12
+ @_attrs_define
13
+ class SandboxNetworkConfig:
14
+ """
15
+ Attributes:
16
+ allow_out (Union[Unset, list[str]]): List of allowed CIDR blocks or IP addresses for egress traffic. Allowed
17
+ addresses always take precedence over blocked addresses.
18
+ allow_public_traffic (Union[Unset, bool]): Specify if the sandbox URLs should be accessible only with
19
+ authentication. Default: True.
20
+ deny_out (Union[Unset, list[str]]): List of denied CIDR blocks or IP addresses for egress traffic
21
+ mask_request_host (Union[Unset, str]): Specify host mask which will be used for all sandbox requests
22
+ """
23
+
24
+ allow_out: Union[Unset, list[str]] = UNSET
25
+ allow_public_traffic: Union[Unset, bool] = True
26
+ deny_out: Union[Unset, list[str]] = UNSET
27
+ mask_request_host: Union[Unset, str] = UNSET
28
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
29
+
30
+ def to_dict(self) -> dict[str, Any]:
31
+ allow_out: Union[Unset, list[str]] = UNSET
32
+ if not isinstance(self.allow_out, Unset):
33
+ allow_out = self.allow_out
34
+
35
+ allow_public_traffic = self.allow_public_traffic
36
+
37
+ deny_out: Union[Unset, list[str]] = UNSET
38
+ if not isinstance(self.deny_out, Unset):
39
+ deny_out = self.deny_out
40
+
41
+ mask_request_host = self.mask_request_host
42
+
43
+ field_dict: dict[str, Any] = {}
44
+ field_dict.update(self.additional_properties)
45
+ field_dict.update({})
46
+ if allow_out is not UNSET:
47
+ field_dict["allowOut"] = allow_out
48
+ if allow_public_traffic is not UNSET:
49
+ field_dict["allowPublicTraffic"] = allow_public_traffic
50
+ if deny_out is not UNSET:
51
+ field_dict["denyOut"] = deny_out
52
+ if mask_request_host is not UNSET:
53
+ field_dict["maskRequestHost"] = mask_request_host
54
+
55
+ return field_dict
56
+
57
+ @classmethod
58
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
59
+ d = dict(src_dict)
60
+ allow_out = cast(list[str], d.pop("allowOut", UNSET))
61
+
62
+ allow_public_traffic = d.pop("allowPublicTraffic", UNSET)
63
+
64
+ deny_out = cast(list[str], d.pop("denyOut", UNSET))
65
+
66
+ mask_request_host = d.pop("maskRequestHost", UNSET)
67
+
68
+ sandbox_network_config = cls(
69
+ allow_out=allow_out,
70
+ allow_public_traffic=allow_public_traffic,
71
+ deny_out=deny_out,
72
+ mask_request_host=mask_request_host,
73
+ )
74
+
75
+ sandbox_network_config.additional_properties = d
76
+ return sandbox_network_config
77
+
78
+ @property
79
+ def additional_keys(self) -> list[str]:
80
+ return list(self.additional_properties.keys())
81
+
82
+ def __getitem__(self, key: str) -> Any:
83
+ return self.additional_properties[key]
84
+
85
+ def __setitem__(self, key: str, value: Any) -> None:
86
+ self.additional_properties[key] = value
87
+
88
+ def __delitem__(self, key: str) -> None:
89
+ del self.additional_properties[key]
90
+
91
+ def __contains__(self, key: str) -> bool:
92
+ return key in self.additional_properties
@@ -0,0 +1,9 @@
1
+ from enum import Enum
2
+
3
+
4
+ class SandboxState(str, Enum):
5
+ PAUSED = "paused"
6
+ RUNNING = "running"
7
+
8
+ def __str__(self) -> str:
9
+ return str(self.value)
@@ -0,0 +1,59 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ T = TypeVar("T", bound="SandboxesWithMetrics")
8
+
9
+
10
+ @_attrs_define
11
+ class SandboxesWithMetrics:
12
+ """
13
+ Attributes:
14
+ sandboxes (Any):
15
+ """
16
+
17
+ sandboxes: Any
18
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
19
+
20
+ def to_dict(self) -> dict[str, Any]:
21
+ sandboxes = self.sandboxes
22
+
23
+ field_dict: dict[str, Any] = {}
24
+ field_dict.update(self.additional_properties)
25
+ field_dict.update(
26
+ {
27
+ "sandboxes": sandboxes,
28
+ }
29
+ )
30
+
31
+ return field_dict
32
+
33
+ @classmethod
34
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
35
+ d = dict(src_dict)
36
+ sandboxes = d.pop("sandboxes")
37
+
38
+ sandboxes_with_metrics = cls(
39
+ sandboxes=sandboxes,
40
+ )
41
+
42
+ sandboxes_with_metrics.additional_properties = d
43
+ return sandboxes_with_metrics
44
+
45
+ @property
46
+ def additional_keys(self) -> list[str]:
47
+ return list(self.additional_properties.keys())
48
+
49
+ def __getitem__(self, key: str) -> Any:
50
+ return self.additional_properties[key]
51
+
52
+ def __setitem__(self, key: str, value: Any) -> None:
53
+ self.additional_properties[key] = value
54
+
55
+ def __delitem__(self, key: str) -> None:
56
+ del self.additional_properties[key]
57
+
58
+ def __contains__(self, key: str) -> bool:
59
+ return key in self.additional_properties
@@ -0,0 +1,83 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ T = TypeVar("T", bound="Team")
8
+
9
+
10
+ @_attrs_define
11
+ class Team:
12
+ """
13
+ Attributes:
14
+ api_key (str): API key for the team
15
+ is_default (bool): Whether the team is the default team
16
+ name (str): Name of the team
17
+ team_id (str): Identifier of the team
18
+ """
19
+
20
+ api_key: str
21
+ is_default: bool
22
+ name: str
23
+ team_id: str
24
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
25
+
26
+ def to_dict(self) -> dict[str, Any]:
27
+ api_key = self.api_key
28
+
29
+ is_default = self.is_default
30
+
31
+ name = self.name
32
+
33
+ team_id = self.team_id
34
+
35
+ field_dict: dict[str, Any] = {}
36
+ field_dict.update(self.additional_properties)
37
+ field_dict.update(
38
+ {
39
+ "apiKey": api_key,
40
+ "isDefault": is_default,
41
+ "name": name,
42
+ "teamID": team_id,
43
+ }
44
+ )
45
+
46
+ return field_dict
47
+
48
+ @classmethod
49
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
50
+ d = dict(src_dict)
51
+ api_key = d.pop("apiKey")
52
+
53
+ is_default = d.pop("isDefault")
54
+
55
+ name = d.pop("name")
56
+
57
+ team_id = d.pop("teamID")
58
+
59
+ team = cls(
60
+ api_key=api_key,
61
+ is_default=is_default,
62
+ name=name,
63
+ team_id=team_id,
64
+ )
65
+
66
+ team.additional_properties = d
67
+ return team
68
+
69
+ @property
70
+ def additional_keys(self) -> list[str]:
71
+ return list(self.additional_properties.keys())
72
+
73
+ def __getitem__(self, key: str) -> Any:
74
+ return self.additional_properties[key]
75
+
76
+ def __setitem__(self, key: str, value: Any) -> None:
77
+ self.additional_properties[key] = value
78
+
79
+ def __delitem__(self, key: str) -> None:
80
+ del self.additional_properties[key]
81
+
82
+ def __contains__(self, key: str) -> bool:
83
+ return key in self.additional_properties
@@ -0,0 +1,158 @@
1
+ import datetime
2
+ from collections.abc import Mapping
3
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
4
+ from uuid import UUID
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+ from dateutil.parser import isoparse
9
+
10
+ from ..types import UNSET, Unset
11
+
12
+ if TYPE_CHECKING:
13
+ from ..models.identifier_masking_details import IdentifierMaskingDetails
14
+ from ..models.team_user import TeamUser
15
+
16
+
17
+ T = TypeVar("T", bound="TeamAPIKey")
18
+
19
+
20
+ @_attrs_define
21
+ class TeamAPIKey:
22
+ """
23
+ Attributes:
24
+ created_at (datetime.datetime): Timestamp of API key creation
25
+ id (UUID): Identifier of the API key
26
+ mask (IdentifierMaskingDetails):
27
+ name (str): Name of the API key
28
+ created_by (Union['TeamUser', None, Unset]):
29
+ last_used (Union[None, Unset, datetime.datetime]): Last time this API key was used
30
+ """
31
+
32
+ created_at: datetime.datetime
33
+ id: UUID
34
+ mask: "IdentifierMaskingDetails"
35
+ name: str
36
+ created_by: Union["TeamUser", None, Unset] = UNSET
37
+ last_used: Union[None, Unset, datetime.datetime] = UNSET
38
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
39
+
40
+ def to_dict(self) -> dict[str, Any]:
41
+ from ..models.team_user import TeamUser
42
+
43
+ created_at = self.created_at.isoformat()
44
+
45
+ id = str(self.id)
46
+
47
+ mask = self.mask.to_dict()
48
+
49
+ name = self.name
50
+
51
+ created_by: Union[None, Unset, dict[str, Any]]
52
+ if isinstance(self.created_by, Unset):
53
+ created_by = UNSET
54
+ elif isinstance(self.created_by, TeamUser):
55
+ created_by = self.created_by.to_dict()
56
+ else:
57
+ created_by = self.created_by
58
+
59
+ last_used: Union[None, Unset, str]
60
+ if isinstance(self.last_used, Unset):
61
+ last_used = UNSET
62
+ elif isinstance(self.last_used, datetime.datetime):
63
+ last_used = self.last_used.isoformat()
64
+ else:
65
+ last_used = self.last_used
66
+
67
+ field_dict: dict[str, Any] = {}
68
+ field_dict.update(self.additional_properties)
69
+ field_dict.update(
70
+ {
71
+ "createdAt": created_at,
72
+ "id": id,
73
+ "mask": mask,
74
+ "name": name,
75
+ }
76
+ )
77
+ if created_by is not UNSET:
78
+ field_dict["createdBy"] = created_by
79
+ if last_used is not UNSET:
80
+ field_dict["lastUsed"] = last_used
81
+
82
+ return field_dict
83
+
84
+ @classmethod
85
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
86
+ from ..models.identifier_masking_details import IdentifierMaskingDetails
87
+ from ..models.team_user import TeamUser
88
+
89
+ d = dict(src_dict)
90
+ created_at = isoparse(d.pop("createdAt"))
91
+
92
+ id = UUID(d.pop("id"))
93
+
94
+ mask = IdentifierMaskingDetails.from_dict(d.pop("mask"))
95
+
96
+ name = d.pop("name")
97
+
98
+ def _parse_created_by(data: object) -> Union["TeamUser", None, Unset]:
99
+ if data is None:
100
+ return data
101
+ if isinstance(data, Unset):
102
+ return data
103
+ try:
104
+ if not isinstance(data, dict):
105
+ raise TypeError()
106
+ created_by_type_1 = TeamUser.from_dict(data)
107
+
108
+ return created_by_type_1
109
+ except: # noqa: E722
110
+ pass
111
+ return cast(Union["TeamUser", None, Unset], data)
112
+
113
+ created_by = _parse_created_by(d.pop("createdBy", UNSET))
114
+
115
+ def _parse_last_used(data: object) -> Union[None, Unset, datetime.datetime]:
116
+ if data is None:
117
+ return data
118
+ if isinstance(data, Unset):
119
+ return data
120
+ try:
121
+ if not isinstance(data, str):
122
+ raise TypeError()
123
+ last_used_type_0 = isoparse(data)
124
+
125
+ return last_used_type_0
126
+ except: # noqa: E722
127
+ pass
128
+ return cast(Union[None, Unset, datetime.datetime], data)
129
+
130
+ last_used = _parse_last_used(d.pop("lastUsed", UNSET))
131
+
132
+ team_api_key = cls(
133
+ created_at=created_at,
134
+ id=id,
135
+ mask=mask,
136
+ name=name,
137
+ created_by=created_by,
138
+ last_used=last_used,
139
+ )
140
+
141
+ team_api_key.additional_properties = d
142
+ return team_api_key
143
+
144
+ @property
145
+ def additional_keys(self) -> list[str]:
146
+ return list(self.additional_properties.keys())
147
+
148
+ def __getitem__(self, key: str) -> Any:
149
+ return self.additional_properties[key]
150
+
151
+ def __setitem__(self, key: str, value: Any) -> None:
152
+ self.additional_properties[key] = value
153
+
154
+ def __delitem__(self, key: str) -> None:
155
+ del self.additional_properties[key]
156
+
157
+ def __contains__(self, key: str) -> bool:
158
+ return key in self.additional_properties
@@ -0,0 +1,86 @@
1
+ import datetime
2
+ from collections.abc import Mapping
3
+ from typing import Any, TypeVar
4
+
5
+ from attrs import define as _attrs_define
6
+ from attrs import field as _attrs_field
7
+ from dateutil.parser import isoparse
8
+
9
+ T = TypeVar("T", bound="TeamMetric")
10
+
11
+
12
+ @_attrs_define
13
+ class TeamMetric:
14
+ """Team metric with timestamp
15
+
16
+ Attributes:
17
+ concurrent_sandboxes (int): The number of concurrent sandboxes for the team
18
+ sandbox_start_rate (float): Number of sandboxes started per second
19
+ timestamp (datetime.datetime): Timestamp of the metric entry
20
+ timestamp_unix (int): Timestamp of the metric entry in Unix time (seconds since epoch)
21
+ """
22
+
23
+ concurrent_sandboxes: int
24
+ sandbox_start_rate: float
25
+ timestamp: datetime.datetime
26
+ timestamp_unix: int
27
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
28
+
29
+ def to_dict(self) -> dict[str, Any]:
30
+ concurrent_sandboxes = self.concurrent_sandboxes
31
+
32
+ sandbox_start_rate = self.sandbox_start_rate
33
+
34
+ timestamp = self.timestamp.isoformat()
35
+
36
+ timestamp_unix = self.timestamp_unix
37
+
38
+ field_dict: dict[str, Any] = {}
39
+ field_dict.update(self.additional_properties)
40
+ field_dict.update(
41
+ {
42
+ "concurrentSandboxes": concurrent_sandboxes,
43
+ "sandboxStartRate": sandbox_start_rate,
44
+ "timestamp": timestamp,
45
+ "timestampUnix": timestamp_unix,
46
+ }
47
+ )
48
+
49
+ return field_dict
50
+
51
+ @classmethod
52
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
53
+ d = dict(src_dict)
54
+ concurrent_sandboxes = d.pop("concurrentSandboxes")
55
+
56
+ sandbox_start_rate = d.pop("sandboxStartRate")
57
+
58
+ timestamp = isoparse(d.pop("timestamp"))
59
+
60
+ timestamp_unix = d.pop("timestampUnix")
61
+
62
+ team_metric = cls(
63
+ concurrent_sandboxes=concurrent_sandboxes,
64
+ sandbox_start_rate=sandbox_start_rate,
65
+ timestamp=timestamp,
66
+ timestamp_unix=timestamp_unix,
67
+ )
68
+
69
+ team_metric.additional_properties = d
70
+ return team_metric
71
+
72
+ @property
73
+ def additional_keys(self) -> list[str]:
74
+ return list(self.additional_properties.keys())
75
+
76
+ def __getitem__(self, key: str) -> Any:
77
+ return self.additional_properties[key]
78
+
79
+ def __setitem__(self, key: str, value: Any) -> None:
80
+ self.additional_properties[key] = value
81
+
82
+ def __delitem__(self, key: str) -> None:
83
+ del self.additional_properties[key]
84
+
85
+ def __contains__(self, key: str) -> bool:
86
+ return key in self.additional_properties