loopix-sdk 2.30.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.
- loopix/__init__.py +260 -0
- loopix/api/__init__.py +287 -0
- loopix/api/client/__init__.py +8 -0
- loopix/api/client/api/__init__.py +1 -0
- loopix/api/client/api/sandboxes/__init__.py +1 -0
- loopix/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py +161 -0
- loopix/api/client/api/sandboxes/get_sandboxes.py +176 -0
- loopix/api/client/api/sandboxes/get_sandboxes_metrics.py +173 -0
- loopix/api/client/api/sandboxes/get_sandboxes_sandbox_id.py +163 -0
- loopix/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py +199 -0
- loopix/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +212 -0
- loopix/api/client/api/sandboxes/get_v2_sandboxes.py +230 -0
- loopix/api/client/api/sandboxes/get_v_2_sandboxes_sandbox_id_logs.py +254 -0
- loopix/api/client/api/sandboxes/post_sandboxes.py +172 -0
- loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py +193 -0
- loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py +187 -0
- loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py +181 -0
- loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py +189 -0
- loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_snapshots.py +195 -0
- loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py +193 -0
- loopix/api/client/api/sandboxes/put_sandboxes_sandbox_id_network.py +199 -0
- loopix/api/client/api/snapshots/__init__.py +1 -0
- loopix/api/client/api/snapshots/get_snapshots.py +202 -0
- loopix/api/client/api/tags/__init__.py +1 -0
- loopix/api/client/api/tags/delete_templates_tags.py +174 -0
- loopix/api/client/api/tags/get_templates_template_id_tags.py +172 -0
- loopix/api/client/api/tags/post_templates_tags.py +176 -0
- loopix/api/client/api/templates/__init__.py +1 -0
- loopix/api/client/api/templates/delete_templates_template_id.py +157 -0
- loopix/api/client/api/templates/get_templates.py +172 -0
- loopix/api/client/api/templates/get_templates_aliases_alias.py +167 -0
- loopix/api/client/api/templates/get_templates_template_id.py +195 -0
- loopix/api/client/api/templates/get_templates_template_id_builds_build_id_logs.py +272 -0
- loopix/api/client/api/templates/get_templates_template_id_builds_build_id_status.py +232 -0
- loopix/api/client/api/templates/get_templates_template_id_files_hash.py +180 -0
- loopix/api/client/api/templates/patch_templates_template_id.py +183 -0
- loopix/api/client/api/templates/patch_v_2_templates_template_id.py +185 -0
- loopix/api/client/api/templates/post_templates.py +172 -0
- loopix/api/client/api/templates/post_templates_template_id.py +181 -0
- loopix/api/client/api/templates/post_templates_template_id_builds_build_id.py +170 -0
- loopix/api/client/api/templates/post_v2_templates.py +172 -0
- loopix/api/client/api/templates/post_v3_templates.py +176 -0
- loopix/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py +192 -0
- loopix/api/client/api/volumes/__init__.py +1 -0
- loopix/api/client/api/volumes/delete_volumes_volume_id.py +161 -0
- loopix/api/client/api/volumes/get_volumes.py +140 -0
- loopix/api/client/api/volumes/get_volumes_volume_id.py +163 -0
- loopix/api/client/api/volumes/post_volumes.py +172 -0
- loopix/api/client/client.py +286 -0
- loopix/api/client/errors.py +16 -0
- loopix/api/client/models/__init__.py +185 -0
- loopix/api/client/models/admin_build_cancel_result.py +67 -0
- loopix/api/client/models/admin_sandbox_kill_result.py +67 -0
- loopix/api/client/models/assign_template_tags_request.py +67 -0
- loopix/api/client/models/assigned_template_tags.py +68 -0
- loopix/api/client/models/aws_registry.py +85 -0
- loopix/api/client/models/aws_registry_type.py +8 -0
- loopix/api/client/models/build_log_entry.py +89 -0
- loopix/api/client/models/build_status_reason.py +95 -0
- loopix/api/client/models/connect_sandbox.py +59 -0
- loopix/api/client/models/created_access_token.py +100 -0
- loopix/api/client/models/created_team_api_key.py +166 -0
- loopix/api/client/models/delete_template_tags_request.py +67 -0
- loopix/api/client/models/disk_metrics.py +91 -0
- loopix/api/client/models/error.py +67 -0
- loopix/api/client/models/gcp_registry.py +69 -0
- loopix/api/client/models/gcp_registry_type.py +8 -0
- loopix/api/client/models/general_registry.py +77 -0
- loopix/api/client/models/general_registry_type.py +8 -0
- loopix/api/client/models/identifier_masking_details.py +83 -0
- loopix/api/client/models/listed_sandbox.py +179 -0
- loopix/api/client/models/log_level.py +11 -0
- loopix/api/client/models/logs_direction.py +9 -0
- loopix/api/client/models/logs_source.py +9 -0
- loopix/api/client/models/machine_info.py +83 -0
- loopix/api/client/models/max_team_metric.py +78 -0
- loopix/api/client/models/mcp_type_0.py +44 -0
- loopix/api/client/models/new_access_token.py +59 -0
- loopix/api/client/models/new_sandbox.py +224 -0
- loopix/api/client/models/new_team_api_key.py +59 -0
- loopix/api/client/models/new_volume.py +59 -0
- loopix/api/client/models/node.py +160 -0
- loopix/api/client/models/node_detail.py +160 -0
- loopix/api/client/models/node_metrics.py +122 -0
- loopix/api/client/models/node_status.py +12 -0
- loopix/api/client/models/node_status_change.py +82 -0
- loopix/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py +59 -0
- loopix/api/client/models/post_sandboxes_sandbox_id_snapshots_body.py +60 -0
- loopix/api/client/models/post_sandboxes_sandbox_id_timeout_body.py +59 -0
- loopix/api/client/models/resumed_sandbox.py +68 -0
- loopix/api/client/models/sandbox.py +145 -0
- loopix/api/client/models/sandbox_auto_resume_config.py +60 -0
- loopix/api/client/models/sandbox_detail.py +267 -0
- loopix/api/client/models/sandbox_lifecycle.py +70 -0
- loopix/api/client/models/sandbox_log.py +70 -0
- loopix/api/client/models/sandbox_log_entry.py +93 -0
- loopix/api/client/models/sandbox_log_entry_fields.py +44 -0
- loopix/api/client/models/sandbox_logs.py +91 -0
- loopix/api/client/models/sandbox_logs_v2_response.py +73 -0
- loopix/api/client/models/sandbox_metric.py +126 -0
- loopix/api/client/models/sandbox_network_config.py +118 -0
- loopix/api/client/models/sandbox_network_config_rules.py +72 -0
- loopix/api/client/models/sandbox_network_rule.py +74 -0
- loopix/api/client/models/sandbox_network_transform.py +79 -0
- loopix/api/client/models/sandbox_network_transform_headers.py +47 -0
- loopix/api/client/models/sandbox_network_update_config.py +114 -0
- loopix/api/client/models/sandbox_network_update_config_rules.py +71 -0
- loopix/api/client/models/sandbox_on_timeout.py +9 -0
- loopix/api/client/models/sandbox_pause_request.py +62 -0
- loopix/api/client/models/sandbox_state.py +9 -0
- loopix/api/client/models/sandbox_volume_mount.py +67 -0
- loopix/api/client/models/sandboxes_with_metrics.py +59 -0
- loopix/api/client/models/snapshot_info.py +70 -0
- loopix/api/client/models/team.py +83 -0
- loopix/api/client/models/team_api_key.py +158 -0
- loopix/api/client/models/team_metric.py +86 -0
- loopix/api/client/models/team_user.py +75 -0
- loopix/api/client/models/template.py +225 -0
- loopix/api/client/models/template_alias_response.py +67 -0
- loopix/api/client/models/template_build.py +139 -0
- loopix/api/client/models/template_build_file_upload.py +70 -0
- loopix/api/client/models/template_build_info.py +126 -0
- loopix/api/client/models/template_build_logs_response.py +73 -0
- loopix/api/client/models/template_build_request.py +115 -0
- loopix/api/client/models/template_build_request_v2.py +88 -0
- loopix/api/client/models/template_build_request_v3.py +107 -0
- loopix/api/client/models/template_build_start_v2.py +184 -0
- loopix/api/client/models/template_build_status.py +11 -0
- loopix/api/client/models/template_legacy.py +207 -0
- loopix/api/client/models/template_request_response_v3.py +99 -0
- loopix/api/client/models/template_step.py +91 -0
- loopix/api/client/models/template_tag.py +78 -0
- loopix/api/client/models/template_update_request.py +59 -0
- loopix/api/client/models/template_update_response.py +59 -0
- loopix/api/client/models/template_with_builds.py +156 -0
- loopix/api/client/models/update_team_api_key.py +59 -0
- loopix/api/client/models/volume.py +67 -0
- loopix/api/client/models/volume_and_token.py +75 -0
- loopix/api/client/models/volume_token.py +59 -0
- loopix/api/client/py.typed +1 -0
- loopix/api/client/types.py +54 -0
- loopix/api/client_async/__init__.py +74 -0
- loopix/api/client_sync/__init__.py +73 -0
- loopix/api/metadata.py +14 -0
- loopix/connection_config.py +309 -0
- loopix/envd/api.py +170 -0
- loopix/envd/filesystem/filesystem_connect.py +193 -0
- loopix/envd/filesystem/filesystem_pb2.py +80 -0
- loopix/envd/filesystem/filesystem_pb2.pyi +272 -0
- loopix/envd/process/process_connect.py +174 -0
- loopix/envd/process/process_pb2.py +96 -0
- loopix/envd/process/process_pb2.pyi +316 -0
- loopix/envd/rpc.py +139 -0
- loopix/envd/versions.py +11 -0
- loopix/exceptions.py +133 -0
- loopix/io_utils.py +57 -0
- loopix/paginator.py +52 -0
- loopix/py.typed +0 -0
- loopix/sandbox/_git/__init__.py +85 -0
- loopix/sandbox/_git/args.py +363 -0
- loopix/sandbox/_git/auth.py +132 -0
- loopix/sandbox/_git/config.py +32 -0
- loopix/sandbox/_git/parse.py +222 -0
- loopix/sandbox/_git/types.py +149 -0
- loopix/sandbox/commands/command_handle.py +69 -0
- loopix/sandbox/commands/main.py +39 -0
- loopix/sandbox/filesystem/filesystem.py +337 -0
- loopix/sandbox/filesystem/watch_handle.py +70 -0
- loopix/sandbox/main.py +227 -0
- loopix/sandbox/mcp.py +1949 -0
- loopix/sandbox/network.py +8 -0
- loopix/sandbox/sandbox_api.py +624 -0
- loopix/sandbox/signature.py +47 -0
- loopix/sandbox/utils.py +34 -0
- loopix/sandbox_async/commands/command.py +396 -0
- loopix/sandbox_async/commands/command_handle.py +298 -0
- loopix/sandbox_async/commands/pty.py +257 -0
- loopix/sandbox_async/filesystem/filesystem.py +720 -0
- loopix/sandbox_async/filesystem/watch_handle.py +97 -0
- loopix/sandbox_async/git.py +1100 -0
- loopix/sandbox_async/main.py +987 -0
- loopix/sandbox_async/paginator.py +140 -0
- loopix/sandbox_async/sandbox_api.py +504 -0
- loopix/sandbox_async/utils.py +7 -0
- loopix/sandbox_domains.py +5 -0
- loopix/sandbox_sync/commands/command.py +420 -0
- loopix/sandbox_sync/commands/command_handle.py +239 -0
- loopix/sandbox_sync/commands/pty.py +279 -0
- loopix/sandbox_sync/filesystem/filesystem.py +710 -0
- loopix/sandbox_sync/filesystem/watch_handle.py +102 -0
- loopix/sandbox_sync/git.py +1077 -0
- loopix/sandbox_sync/main.py +975 -0
- loopix/sandbox_sync/paginator.py +140 -0
- loopix/sandbox_sync/sandbox_api.py +491 -0
- loopix/template/consts.py +45 -0
- loopix/template/dockerfile_parser.py +286 -0
- loopix/template/logger.py +232 -0
- loopix/template/main.py +1368 -0
- loopix/template/readycmd.py +144 -0
- loopix/template/types.py +194 -0
- loopix/template/utils.py +426 -0
- loopix/template_async/build_api.py +419 -0
- loopix/template_async/main.py +528 -0
- loopix/template_sync/build_api.py +409 -0
- loopix/template_sync/main.py +529 -0
- loopix/volume/client/__init__.py +8 -0
- loopix/volume/client/api/__init__.py +1 -0
- loopix/volume/client/api/volumes/__init__.py +1 -0
- loopix/volume/client/api/volumes/delete_volumecontent_volume_id_path.py +174 -0
- loopix/volume/client/api/volumes/get_volumecontent_volume_id_dir.py +204 -0
- loopix/volume/client/api/volumes/get_volumecontent_volume_id_file.py +179 -0
- loopix/volume/client/api/volumes/get_volumecontent_volume_id_path.py +176 -0
- loopix/volume/client/api/volumes/patch_volumecontent_volume_id_path.py +203 -0
- loopix/volume/client/api/volumes/post_volumecontent_volume_id_dir.py +239 -0
- loopix/volume/client/api/volumes/put_volumecontent_volume_id_file.py +259 -0
- loopix/volume/client/client.py +286 -0
- loopix/volume/client/errors.py +16 -0
- loopix/volume/client/models/__init__.py +13 -0
- loopix/volume/client/models/error.py +67 -0
- loopix/volume/client/models/patch_volumecontent_volume_id_path_body.py +77 -0
- loopix/volume/client/models/volume_entry_stat.py +145 -0
- loopix/volume/client/models/volume_entry_stat_type.py +11 -0
- loopix/volume/client/py.typed +1 -0
- loopix/volume/client/types.py +54 -0
- loopix/volume/client_async/__init__.py +88 -0
- loopix/volume/client_sync/__init__.py +80 -0
- loopix/volume/connection_config.py +145 -0
- loopix/volume/types.py +62 -0
- loopix/volume/utils.py +52 -0
- loopix/volume/volume_async.py +639 -0
- loopix/volume/volume_sync.py +639 -0
- loopix_connect/__init__.py +1 -0
- loopix_connect/client.py +534 -0
- loopix_connect/py.typed +0 -0
- loopix_sdk-2.30.0.dist-info/METADATA +98 -0
- loopix_sdk-2.30.0.dist-info/RECORD +238 -0
- loopix_sdk-2.30.0.dist-info/WHEEL +4 -0
- loopix_sdk-2.30.0.dist-info/licenses/LICENSE +9 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import shlex
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ReadyCmd:
|
|
5
|
+
"""
|
|
6
|
+
Wrapper class for ready check commands.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
def __init__(self, cmd: str):
|
|
10
|
+
self.__cmd = cmd
|
|
11
|
+
|
|
12
|
+
def get_cmd(self):
|
|
13
|
+
return self.__cmd
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def wait_for_port(port: int):
|
|
17
|
+
"""
|
|
18
|
+
Wait for a port to be listening.
|
|
19
|
+
|
|
20
|
+
Uses `ss` command to check if a port is open and listening.
|
|
21
|
+
|
|
22
|
+
:param port: Port number to wait for
|
|
23
|
+
|
|
24
|
+
:return: ReadyCmd that checks for the port
|
|
25
|
+
|
|
26
|
+
Example
|
|
27
|
+
```python
|
|
28
|
+
from loopix import Template, wait_for_port
|
|
29
|
+
|
|
30
|
+
template = (
|
|
31
|
+
Template()
|
|
32
|
+
.from_python_image()
|
|
33
|
+
.set_start_cmd('python -m http.server 8000', wait_for_port(8000))
|
|
34
|
+
)
|
|
35
|
+
```
|
|
36
|
+
"""
|
|
37
|
+
# Match the exact listening port via ss's source-port filter (so e.g. port
|
|
38
|
+
# 80 doesn't match 8080). ss exits 0 regardless of matches, so test for
|
|
39
|
+
# non-empty output to signal readiness.
|
|
40
|
+
cmd = f'[ -n "$(ss -Htuln sport = :{port})" ]'
|
|
41
|
+
return ReadyCmd(cmd)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def wait_for_url(url: str, status_code: int = 200):
|
|
45
|
+
"""
|
|
46
|
+
Wait for a URL to return a specific HTTP status code.
|
|
47
|
+
|
|
48
|
+
Uses `curl` to make HTTP requests and check the response status.
|
|
49
|
+
|
|
50
|
+
:param url: URL to check (e.g., 'http://localhost:3000/health')
|
|
51
|
+
:param status_code: Expected HTTP status code (default: 200)
|
|
52
|
+
|
|
53
|
+
:return: ReadyCmd that checks the URL
|
|
54
|
+
|
|
55
|
+
Example
|
|
56
|
+
```python
|
|
57
|
+
from loopix import Template, wait_for_url
|
|
58
|
+
|
|
59
|
+
template = (
|
|
60
|
+
Template()
|
|
61
|
+
.from_node_image()
|
|
62
|
+
.set_start_cmd('npm start', wait_for_url('http://localhost:3000/health'))
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
"""
|
|
66
|
+
cmd = f'curl -s -o /dev/null -w "%{{http_code}}" {shlex.quote(url)} | grep -q "{status_code}"'
|
|
67
|
+
return ReadyCmd(cmd)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def wait_for_process(process_name: str):
|
|
71
|
+
"""
|
|
72
|
+
Wait for a process with a specific name to be running.
|
|
73
|
+
|
|
74
|
+
Uses `pgrep` to check if a process exists.
|
|
75
|
+
|
|
76
|
+
:param process_name: Name of the process to wait for
|
|
77
|
+
|
|
78
|
+
:return: ReadyCmd that checks for the process
|
|
79
|
+
|
|
80
|
+
Example
|
|
81
|
+
```python
|
|
82
|
+
from loopix import Template, wait_for_process
|
|
83
|
+
|
|
84
|
+
template = (
|
|
85
|
+
Template()
|
|
86
|
+
.from_base_image()
|
|
87
|
+
.set_start_cmd('./my-daemon', wait_for_process('my-daemon'))
|
|
88
|
+
)
|
|
89
|
+
```
|
|
90
|
+
"""
|
|
91
|
+
cmd = f"pgrep {shlex.quote(process_name)} > /dev/null"
|
|
92
|
+
return ReadyCmd(cmd)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def wait_for_file(filename: str):
|
|
96
|
+
"""
|
|
97
|
+
Wait for a file to exist.
|
|
98
|
+
|
|
99
|
+
Uses shell test command to check file existence.
|
|
100
|
+
|
|
101
|
+
:param filename: Path to the file to wait for
|
|
102
|
+
|
|
103
|
+
:return: ReadyCmd that checks for the file
|
|
104
|
+
|
|
105
|
+
Example
|
|
106
|
+
```python
|
|
107
|
+
from loopix import Template, wait_for_file
|
|
108
|
+
|
|
109
|
+
template = (
|
|
110
|
+
Template()
|
|
111
|
+
.from_base_image()
|
|
112
|
+
.set_start_cmd('./init.sh', wait_for_file('/tmp/ready'))
|
|
113
|
+
)
|
|
114
|
+
```
|
|
115
|
+
"""
|
|
116
|
+
cmd = f"[ -f {shlex.quote(filename)} ]"
|
|
117
|
+
return ReadyCmd(cmd)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def wait_for_timeout(timeout: int):
|
|
121
|
+
"""
|
|
122
|
+
Wait for a specified timeout before considering the sandbox ready.
|
|
123
|
+
|
|
124
|
+
Uses `sleep` command to wait for a fixed duration.
|
|
125
|
+
|
|
126
|
+
:param timeout: Time to wait in **milliseconds** (minimum: 1000ms / 1 second)
|
|
127
|
+
|
|
128
|
+
:return: ReadyCmd that waits for the specified duration
|
|
129
|
+
|
|
130
|
+
Example
|
|
131
|
+
```python
|
|
132
|
+
from loopix import Template, wait_for_timeout
|
|
133
|
+
|
|
134
|
+
template = (
|
|
135
|
+
Template()
|
|
136
|
+
.from_node_image()
|
|
137
|
+
.set_start_cmd('npm start', wait_for_timeout(5000)) # Wait 5 seconds
|
|
138
|
+
)
|
|
139
|
+
```
|
|
140
|
+
"""
|
|
141
|
+
# convert to seconds, but ensure minimum of 1 second
|
|
142
|
+
seconds = max(1, timeout // 1000)
|
|
143
|
+
cmd = f"sleep {seconds}"
|
|
144
|
+
return ReadyCmd(cmd)
|
loopix/template/types.py
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from enum import Enum
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import List, Literal, Optional, TypedDict, Union
|
|
6
|
+
|
|
7
|
+
from typing_extensions import NotRequired
|
|
8
|
+
|
|
9
|
+
from loopix.template.logger import LogEntry
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class TemplateBuildStatus(str, Enum):
|
|
13
|
+
"""
|
|
14
|
+
Status of a template build.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
BUILDING = "building"
|
|
18
|
+
WAITING = "waiting"
|
|
19
|
+
READY = "ready"
|
|
20
|
+
ERROR = "error"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass
|
|
24
|
+
class BuildStatusReason:
|
|
25
|
+
"""
|
|
26
|
+
Reason for the current build status (typically for errors).
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
message: str
|
|
30
|
+
"""Message with the status reason."""
|
|
31
|
+
|
|
32
|
+
step: Optional[str] = None
|
|
33
|
+
"""Step that failed."""
|
|
34
|
+
|
|
35
|
+
log_entries: List[LogEntry] = field(default_factory=list)
|
|
36
|
+
"""Log entries related to the status reason."""
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@dataclass
|
|
40
|
+
class TemplateBuildStatusResponse:
|
|
41
|
+
"""
|
|
42
|
+
Response from getting build status.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
build_id: str
|
|
46
|
+
"""Build identifier."""
|
|
47
|
+
|
|
48
|
+
template_id: str
|
|
49
|
+
"""Template identifier."""
|
|
50
|
+
|
|
51
|
+
status: TemplateBuildStatus
|
|
52
|
+
"""Current status of the build."""
|
|
53
|
+
|
|
54
|
+
log_entries: List[LogEntry]
|
|
55
|
+
"""Build log entries."""
|
|
56
|
+
|
|
57
|
+
logs: List[str]
|
|
58
|
+
"""Build logs (raw strings). Deprecated: use log_entries instead."""
|
|
59
|
+
|
|
60
|
+
reason: Optional[BuildStatusReason] = None
|
|
61
|
+
"""Reason for the current status (typically for errors)."""
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass
|
|
65
|
+
class TemplateTagInfo:
|
|
66
|
+
"""
|
|
67
|
+
Information about assigned template tags.
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
build_id: str
|
|
71
|
+
"""Build identifier associated with this tag."""
|
|
72
|
+
|
|
73
|
+
tags: List[str]
|
|
74
|
+
"""Assigned tags of the template."""
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@dataclass
|
|
78
|
+
class TemplateTag:
|
|
79
|
+
"""
|
|
80
|
+
Detailed information about a single template tag.
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
tag: str
|
|
84
|
+
"""Name of the tag."""
|
|
85
|
+
|
|
86
|
+
build_id: str
|
|
87
|
+
"""Build identifier associated with this tag."""
|
|
88
|
+
|
|
89
|
+
created_at: datetime
|
|
90
|
+
"""When this tag was assigned."""
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class InstructionType(str, Enum):
|
|
94
|
+
"""
|
|
95
|
+
Types of instructions that can be used in a template.
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
COPY = "COPY"
|
|
99
|
+
ENV = "ENV"
|
|
100
|
+
RUN = "RUN"
|
|
101
|
+
WORKDIR = "WORKDIR"
|
|
102
|
+
USER = "USER"
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class CopyItem(TypedDict):
|
|
106
|
+
"""
|
|
107
|
+
Configuration for a single file/directory copy operation.
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
src: Union[Union[str, Path], List[Union[str, Path]]]
|
|
111
|
+
dest: Union[str, Path]
|
|
112
|
+
forceUpload: NotRequired[Optional[Literal[True]]]
|
|
113
|
+
user: NotRequired[Optional[str]]
|
|
114
|
+
mode: NotRequired[Optional[int]]
|
|
115
|
+
resolveSymlinks: NotRequired[Optional[bool]]
|
|
116
|
+
gzip: NotRequired[Optional[bool]]
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class Instruction(TypedDict):
|
|
120
|
+
"""
|
|
121
|
+
Represents a single instruction in the template build process.
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
type: InstructionType
|
|
125
|
+
args: List[str]
|
|
126
|
+
force: bool
|
|
127
|
+
forceUpload: NotRequired[Optional[Literal[True]]]
|
|
128
|
+
filesHash: NotRequired[Optional[str]]
|
|
129
|
+
resolveSymlinks: NotRequired[Optional[bool]]
|
|
130
|
+
gzip: NotRequired[Optional[bool]]
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class GenericDockerRegistry(TypedDict):
|
|
134
|
+
"""
|
|
135
|
+
Configuration for a generic Docker registry with basic authentication.
|
|
136
|
+
"""
|
|
137
|
+
|
|
138
|
+
type: Literal["registry"]
|
|
139
|
+
username: str
|
|
140
|
+
password: str
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class AWSRegistry(TypedDict):
|
|
144
|
+
"""
|
|
145
|
+
Configuration for AWS Elastic Container Registry (ECR).
|
|
146
|
+
"""
|
|
147
|
+
|
|
148
|
+
type: Literal["aws"]
|
|
149
|
+
awsAccessKeyId: str
|
|
150
|
+
awsSecretAccessKey: str
|
|
151
|
+
awsRegion: str
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class GCPRegistry(TypedDict):
|
|
155
|
+
"""
|
|
156
|
+
Configuration for Google Container Registry (GCR) or Artifact Registry.
|
|
157
|
+
"""
|
|
158
|
+
|
|
159
|
+
type: Literal["gcp"]
|
|
160
|
+
serviceAccountJson: str
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
"""
|
|
164
|
+
Union type for all supported container registry configurations.
|
|
165
|
+
"""
|
|
166
|
+
RegistryConfig = Union[GenericDockerRegistry, AWSRegistry, GCPRegistry]
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class TemplateType(TypedDict):
|
|
170
|
+
"""
|
|
171
|
+
Internal representation of a template for the Loopix build API.
|
|
172
|
+
"""
|
|
173
|
+
|
|
174
|
+
fromImage: NotRequired[str]
|
|
175
|
+
fromTemplate: NotRequired[str]
|
|
176
|
+
fromImageRegistry: NotRequired[RegistryConfig]
|
|
177
|
+
startCmd: NotRequired[str]
|
|
178
|
+
readyCmd: NotRequired[str]
|
|
179
|
+
steps: List[Instruction]
|
|
180
|
+
force: bool
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@dataclass
|
|
184
|
+
class BuildInfo:
|
|
185
|
+
"""
|
|
186
|
+
Information about a built template.
|
|
187
|
+
"""
|
|
188
|
+
|
|
189
|
+
template_id: str
|
|
190
|
+
build_id: str
|
|
191
|
+
name: str
|
|
192
|
+
# Deprecated: use name instead
|
|
193
|
+
alias: str
|
|
194
|
+
tags: List[str] = field(default_factory=list)
|