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.
- moru/__init__.py +174 -0
- moru/api/__init__.py +164 -0
- moru/api/client/__init__.py +8 -0
- moru/api/client/api/__init__.py +1 -0
- moru/api/client/api/sandboxes/__init__.py +1 -0
- moru/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py +161 -0
- moru/api/client/api/sandboxes/get_sandboxes.py +176 -0
- moru/api/client/api/sandboxes/get_sandboxes_metrics.py +173 -0
- moru/api/client/api/sandboxes/get_sandboxes_sandbox_id.py +163 -0
- moru/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py +199 -0
- moru/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +212 -0
- moru/api/client/api/sandboxes/get_v2_sandboxes.py +230 -0
- moru/api/client/api/sandboxes/post_sandboxes.py +172 -0
- moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py +193 -0
- moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py +165 -0
- moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py +181 -0
- moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py +189 -0
- moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py +193 -0
- moru/api/client/api/templates/__init__.py +1 -0
- moru/api/client/api/templates/delete_templates_template_id.py +157 -0
- moru/api/client/api/templates/get_templates.py +172 -0
- moru/api/client/api/templates/get_templates_template_id.py +195 -0
- moru/api/client/api/templates/get_templates_template_id_builds_build_id_status.py +217 -0
- moru/api/client/api/templates/get_templates_template_id_files_hash.py +180 -0
- moru/api/client/api/templates/patch_templates_template_id.py +183 -0
- moru/api/client/api/templates/post_templates.py +172 -0
- moru/api/client/api/templates/post_templates_template_id.py +181 -0
- moru/api/client/api/templates/post_templates_template_id_builds_build_id.py +170 -0
- moru/api/client/api/templates/post_v2_templates.py +172 -0
- moru/api/client/api/templates/post_v3_templates.py +172 -0
- moru/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py +192 -0
- moru/api/client/client.py +286 -0
- moru/api/client/errors.py +16 -0
- moru/api/client/models/__init__.py +123 -0
- moru/api/client/models/aws_registry.py +85 -0
- moru/api/client/models/aws_registry_type.py +8 -0
- moru/api/client/models/build_log_entry.py +89 -0
- moru/api/client/models/build_status_reason.py +95 -0
- moru/api/client/models/connect_sandbox.py +59 -0
- moru/api/client/models/created_access_token.py +100 -0
- moru/api/client/models/created_team_api_key.py +166 -0
- moru/api/client/models/disk_metrics.py +91 -0
- moru/api/client/models/error.py +67 -0
- moru/api/client/models/gcp_registry.py +69 -0
- moru/api/client/models/gcp_registry_type.py +8 -0
- moru/api/client/models/general_registry.py +77 -0
- moru/api/client/models/general_registry_type.py +8 -0
- moru/api/client/models/identifier_masking_details.py +83 -0
- moru/api/client/models/listed_sandbox.py +154 -0
- moru/api/client/models/log_level.py +11 -0
- moru/api/client/models/max_team_metric.py +78 -0
- moru/api/client/models/mcp_type_0.py +44 -0
- moru/api/client/models/new_access_token.py +59 -0
- moru/api/client/models/new_sandbox.py +172 -0
- moru/api/client/models/new_team_api_key.py +59 -0
- moru/api/client/models/node.py +155 -0
- moru/api/client/models/node_detail.py +165 -0
- moru/api/client/models/node_metrics.py +122 -0
- moru/api/client/models/node_status.py +11 -0
- moru/api/client/models/node_status_change.py +79 -0
- moru/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py +59 -0
- moru/api/client/models/post_sandboxes_sandbox_id_timeout_body.py +59 -0
- moru/api/client/models/resumed_sandbox.py +68 -0
- moru/api/client/models/sandbox.py +145 -0
- moru/api/client/models/sandbox_detail.py +183 -0
- moru/api/client/models/sandbox_log.py +70 -0
- moru/api/client/models/sandbox_log_entry.py +93 -0
- moru/api/client/models/sandbox_log_entry_fields.py +44 -0
- moru/api/client/models/sandbox_logs.py +91 -0
- moru/api/client/models/sandbox_metric.py +118 -0
- moru/api/client/models/sandbox_network_config.py +92 -0
- moru/api/client/models/sandbox_state.py +9 -0
- moru/api/client/models/sandboxes_with_metrics.py +59 -0
- moru/api/client/models/team.py +83 -0
- moru/api/client/models/team_api_key.py +158 -0
- moru/api/client/models/team_metric.py +86 -0
- moru/api/client/models/team_user.py +68 -0
- moru/api/client/models/template.py +217 -0
- moru/api/client/models/template_build.py +139 -0
- moru/api/client/models/template_build_file_upload.py +70 -0
- moru/api/client/models/template_build_info.py +126 -0
- moru/api/client/models/template_build_request.py +115 -0
- moru/api/client/models/template_build_request_v2.py +88 -0
- moru/api/client/models/template_build_request_v3.py +88 -0
- moru/api/client/models/template_build_start_v2.py +184 -0
- moru/api/client/models/template_build_status.py +11 -0
- moru/api/client/models/template_legacy.py +207 -0
- moru/api/client/models/template_request_response_v3.py +83 -0
- moru/api/client/models/template_step.py +91 -0
- moru/api/client/models/template_update_request.py +59 -0
- moru/api/client/models/template_with_builds.py +148 -0
- moru/api/client/models/update_team_api_key.py +59 -0
- moru/api/client/py.typed +1 -0
- moru/api/client/types.py +54 -0
- moru/api/client_async/__init__.py +50 -0
- moru/api/client_sync/__init__.py +52 -0
- moru/api/metadata.py +14 -0
- moru/connection_config.py +217 -0
- moru/envd/api.py +59 -0
- moru/envd/filesystem/filesystem_connect.py +193 -0
- moru/envd/filesystem/filesystem_pb2.py +76 -0
- moru/envd/filesystem/filesystem_pb2.pyi +233 -0
- moru/envd/process/process_connect.py +155 -0
- moru/envd/process/process_pb2.py +92 -0
- moru/envd/process/process_pb2.pyi +304 -0
- moru/envd/rpc.py +61 -0
- moru/envd/versions.py +6 -0
- moru/exceptions.py +95 -0
- moru/sandbox/commands/command_handle.py +69 -0
- moru/sandbox/commands/main.py +39 -0
- moru/sandbox/filesystem/filesystem.py +94 -0
- moru/sandbox/filesystem/watch_handle.py +60 -0
- moru/sandbox/main.py +210 -0
- moru/sandbox/mcp.py +1120 -0
- moru/sandbox/network.py +8 -0
- moru/sandbox/sandbox_api.py +210 -0
- moru/sandbox/signature.py +45 -0
- moru/sandbox/utils.py +34 -0
- moru/sandbox_async/commands/command.py +336 -0
- moru/sandbox_async/commands/command_handle.py +196 -0
- moru/sandbox_async/commands/pty.py +240 -0
- moru/sandbox_async/filesystem/filesystem.py +531 -0
- moru/sandbox_async/filesystem/watch_handle.py +62 -0
- moru/sandbox_async/main.py +734 -0
- moru/sandbox_async/paginator.py +69 -0
- moru/sandbox_async/sandbox_api.py +325 -0
- moru/sandbox_async/utils.py +7 -0
- moru/sandbox_sync/commands/command.py +328 -0
- moru/sandbox_sync/commands/command_handle.py +150 -0
- moru/sandbox_sync/commands/pty.py +230 -0
- moru/sandbox_sync/filesystem/filesystem.py +518 -0
- moru/sandbox_sync/filesystem/watch_handle.py +69 -0
- moru/sandbox_sync/main.py +726 -0
- moru/sandbox_sync/paginator.py +69 -0
- moru/sandbox_sync/sandbox_api.py +308 -0
- moru/template/consts.py +30 -0
- moru/template/dockerfile_parser.py +275 -0
- moru/template/logger.py +232 -0
- moru/template/main.py +1360 -0
- moru/template/readycmd.py +138 -0
- moru/template/types.py +105 -0
- moru/template/utils.py +320 -0
- moru/template_async/build_api.py +202 -0
- moru/template_async/main.py +366 -0
- moru/template_sync/build_api.py +199 -0
- moru/template_sync/main.py +371 -0
- moru-0.1.0.dist-info/METADATA +63 -0
- moru-0.1.0.dist-info/RECORD +152 -0
- moru-0.1.0.dist-info/WHEEL +4 -0
- moru-0.1.0.dist-info/licenses/LICENSE +9 -0
- moru_connect/__init__.py +1 -0
- moru_connect/client.py +493 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from typing import Optional, Dict, TypedDict
|
|
4
|
+
|
|
5
|
+
from httpx._types import ProxyTypes
|
|
6
|
+
from typing_extensions import Unpack
|
|
7
|
+
|
|
8
|
+
from moru.api.metadata import package_version
|
|
9
|
+
|
|
10
|
+
REQUEST_TIMEOUT: float = 60.0 # 60 seconds
|
|
11
|
+
|
|
12
|
+
KEEPALIVE_PING_INTERVAL_SEC = 50 # 50 seconds
|
|
13
|
+
KEEPALIVE_PING_HEADER = "Keepalive-Ping-Interval"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ApiParams(TypedDict, total=False):
|
|
17
|
+
"""
|
|
18
|
+
Parameters for a request.
|
|
19
|
+
|
|
20
|
+
In the case of a sandbox, it applies to all **requests made to the returned sandbox**.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
request_timeout: Optional[float]
|
|
24
|
+
"""Timeout for the request in **seconds**, defaults to 60 seconds."""
|
|
25
|
+
|
|
26
|
+
headers: Optional[Dict[str, str]]
|
|
27
|
+
"""Additional headers to send with the request."""
|
|
28
|
+
|
|
29
|
+
api_key: Optional[str]
|
|
30
|
+
"""Moru API Key to use for authentication, defaults to `MORU_API_KEY` environment variable."""
|
|
31
|
+
|
|
32
|
+
domain: Optional[str]
|
|
33
|
+
"""Moru domain to use, defaults to `MORU_DOMAIN` environment variable or `moru.io`."""
|
|
34
|
+
|
|
35
|
+
api_url: Optional[str]
|
|
36
|
+
"""URL to use for the API, defaults to `https://api.<domain>`. For internal use only."""
|
|
37
|
+
|
|
38
|
+
debug: Optional[bool]
|
|
39
|
+
"""Whether to use debug mode, defaults to `MORU_DEBUG` environment variable."""
|
|
40
|
+
|
|
41
|
+
proxy: Optional[ProxyTypes]
|
|
42
|
+
"""Proxy to use for the request. In case of a sandbox it applies to all **requests made to the returned sandbox**."""
|
|
43
|
+
|
|
44
|
+
sandbox_url: Optional[str]
|
|
45
|
+
"""URL to connect to sandbox, defaults to `MORU_SANDBOX_URL` environment variable."""
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class ConnectionConfig:
|
|
49
|
+
"""
|
|
50
|
+
Configuration for the connection to the API.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
envd_port = 49983
|
|
54
|
+
|
|
55
|
+
@staticmethod
|
|
56
|
+
def _domain():
|
|
57
|
+
return os.getenv("MORU_DOMAIN") or "moru.io"
|
|
58
|
+
|
|
59
|
+
@staticmethod
|
|
60
|
+
def _debug():
|
|
61
|
+
return os.getenv("MORU_DEBUG", "false").lower() == "true"
|
|
62
|
+
|
|
63
|
+
@staticmethod
|
|
64
|
+
def _api_key():
|
|
65
|
+
return os.getenv("MORU_API_KEY")
|
|
66
|
+
|
|
67
|
+
@staticmethod
|
|
68
|
+
def _api_url():
|
|
69
|
+
return os.getenv("MORU_API_URL")
|
|
70
|
+
|
|
71
|
+
@staticmethod
|
|
72
|
+
def _sandbox_url():
|
|
73
|
+
return os.getenv("MORU_SANDBOX_URL")
|
|
74
|
+
|
|
75
|
+
@staticmethod
|
|
76
|
+
def _access_token():
|
|
77
|
+
return os.getenv("MORU_ACCESS_TOKEN")
|
|
78
|
+
|
|
79
|
+
def __init__(
|
|
80
|
+
self,
|
|
81
|
+
domain: Optional[str] = None,
|
|
82
|
+
debug: Optional[bool] = None,
|
|
83
|
+
api_key: Optional[str] = None,
|
|
84
|
+
api_url: Optional[str] = None,
|
|
85
|
+
sandbox_url: Optional[str] = None,
|
|
86
|
+
access_token: Optional[str] = None,
|
|
87
|
+
request_timeout: Optional[float] = None,
|
|
88
|
+
headers: Optional[Dict[str, str]] = None,
|
|
89
|
+
extra_sandbox_headers: Optional[Dict[str, str]] = None,
|
|
90
|
+
proxy: Optional[ProxyTypes] = None,
|
|
91
|
+
):
|
|
92
|
+
self.domain = domain or ConnectionConfig._domain()
|
|
93
|
+
self.debug = debug or ConnectionConfig._debug()
|
|
94
|
+
self.api_key = api_key or ConnectionConfig._api_key()
|
|
95
|
+
self.access_token = access_token or ConnectionConfig._access_token()
|
|
96
|
+
self.headers = headers or {}
|
|
97
|
+
self.headers["User-Agent"] = f"moru-python-sdk/{package_version}"
|
|
98
|
+
self.__extra_sandbox_headers = extra_sandbox_headers or {}
|
|
99
|
+
|
|
100
|
+
self.proxy = proxy
|
|
101
|
+
|
|
102
|
+
self.request_timeout = ConnectionConfig._get_request_timeout(
|
|
103
|
+
REQUEST_TIMEOUT,
|
|
104
|
+
request_timeout,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
if request_timeout == 0:
|
|
108
|
+
self.request_timeout = None
|
|
109
|
+
elif request_timeout is not None:
|
|
110
|
+
self.request_timeout = request_timeout
|
|
111
|
+
else:
|
|
112
|
+
self.request_timeout = REQUEST_TIMEOUT
|
|
113
|
+
|
|
114
|
+
self.api_url = (
|
|
115
|
+
api_url
|
|
116
|
+
or ConnectionConfig._api_url()
|
|
117
|
+
or ("http://localhost:3000" if self.debug else f"https://api.{self.domain}")
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
self._sandbox_url = sandbox_url or ConnectionConfig._sandbox_url()
|
|
121
|
+
|
|
122
|
+
@staticmethod
|
|
123
|
+
def _get_request_timeout(
|
|
124
|
+
default_timeout: Optional[float],
|
|
125
|
+
request_timeout: Optional[float],
|
|
126
|
+
):
|
|
127
|
+
if request_timeout == 0:
|
|
128
|
+
return None
|
|
129
|
+
elif request_timeout is not None:
|
|
130
|
+
return request_timeout
|
|
131
|
+
else:
|
|
132
|
+
return default_timeout
|
|
133
|
+
|
|
134
|
+
def get_request_timeout(self, request_timeout: Optional[float] = None):
|
|
135
|
+
return self._get_request_timeout(self.request_timeout, request_timeout)
|
|
136
|
+
|
|
137
|
+
def get_sandbox_url(self, sandbox_id: str, sandbox_domain: str) -> str:
|
|
138
|
+
if self._sandbox_url:
|
|
139
|
+
return self._sandbox_url
|
|
140
|
+
|
|
141
|
+
return f"{'http' if self.debug else 'https'}://{self.get_host(sandbox_id, sandbox_domain, self.envd_port)}"
|
|
142
|
+
|
|
143
|
+
def get_host(self, sandbox_id: str, sandbox_domain: str, port: int) -> str:
|
|
144
|
+
"""
|
|
145
|
+
Get the host address to connect to the sandbox.
|
|
146
|
+
You can then use this address to connect to the sandbox port from outside the sandbox via HTTP or WebSocket.
|
|
147
|
+
|
|
148
|
+
:param port: Port to connect to
|
|
149
|
+
:param sandbox_domain: Domain to connect to
|
|
150
|
+
:param sandbox_id: Sandbox to connect to
|
|
151
|
+
|
|
152
|
+
:return: Host address to connect to
|
|
153
|
+
"""
|
|
154
|
+
if self.debug:
|
|
155
|
+
return f"localhost:{port}"
|
|
156
|
+
|
|
157
|
+
return f"{port}-{sandbox_id}.{sandbox_domain}"
|
|
158
|
+
|
|
159
|
+
def get_api_params(
|
|
160
|
+
self,
|
|
161
|
+
**opts: Unpack[ApiParams],
|
|
162
|
+
) -> dict:
|
|
163
|
+
"""
|
|
164
|
+
Get the parameters for the API call.
|
|
165
|
+
|
|
166
|
+
This is used to avoid passing the following attributes to the API call:
|
|
167
|
+
- access_token
|
|
168
|
+
- api_url
|
|
169
|
+
|
|
170
|
+
It also returns a copy, so the original object is not modified.
|
|
171
|
+
|
|
172
|
+
:return: Dictionary of parameters for the API call
|
|
173
|
+
"""
|
|
174
|
+
headers = opts.get("headers")
|
|
175
|
+
request_timeout = opts.get("request_timeout")
|
|
176
|
+
api_key = opts.get("api_key")
|
|
177
|
+
api_url = opts.get("api_url")
|
|
178
|
+
domain = opts.get("domain")
|
|
179
|
+
debug = opts.get("debug")
|
|
180
|
+
proxy = opts.get("proxy")
|
|
181
|
+
|
|
182
|
+
req_headers = self.headers.copy()
|
|
183
|
+
if headers is not None:
|
|
184
|
+
req_headers.update(headers)
|
|
185
|
+
|
|
186
|
+
return dict(
|
|
187
|
+
ApiParams(
|
|
188
|
+
api_key=api_key if api_key is not None else self.api_key,
|
|
189
|
+
api_url=api_url if api_url is not None else self.api_url,
|
|
190
|
+
domain=domain if domain is not None else self.domain,
|
|
191
|
+
debug=debug if debug is not None else self.debug,
|
|
192
|
+
request_timeout=self.get_request_timeout(request_timeout),
|
|
193
|
+
headers=req_headers,
|
|
194
|
+
proxy=proxy if proxy is not None else self.proxy,
|
|
195
|
+
)
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
@property
|
|
199
|
+
def sandbox_headers(self):
|
|
200
|
+
"""
|
|
201
|
+
We need this separate as we use the same header for Moru access token to API and envd access token to sandbox.
|
|
202
|
+
"""
|
|
203
|
+
return {
|
|
204
|
+
**self.headers,
|
|
205
|
+
**self.__extra_sandbox_headers,
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
Username = str
|
|
210
|
+
"""
|
|
211
|
+
User used for the operation in the sandbox.
|
|
212
|
+
"""
|
|
213
|
+
|
|
214
|
+
default_username: Username = "user"
|
|
215
|
+
"""
|
|
216
|
+
Default user used for the operation in the sandbox.
|
|
217
|
+
"""
|
moru/envd/api.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import httpx
|
|
2
|
+
import json
|
|
3
|
+
|
|
4
|
+
from moru.exceptions import (
|
|
5
|
+
SandboxException,
|
|
6
|
+
NotFoundException,
|
|
7
|
+
AuthenticationException,
|
|
8
|
+
InvalidArgumentException,
|
|
9
|
+
NotEnoughSpaceException,
|
|
10
|
+
format_sandbox_timeout_exception,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
ENVD_API_FILES_ROUTE = "/files"
|
|
15
|
+
ENVD_API_HEALTH_ROUTE = "/health"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def get_message(e: httpx.Response) -> str:
|
|
19
|
+
try:
|
|
20
|
+
message = e.json().get("message", e.text)
|
|
21
|
+
except json.JSONDecodeError:
|
|
22
|
+
message = e.text
|
|
23
|
+
|
|
24
|
+
return message
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def handle_envd_api_exception(res: httpx.Response):
|
|
28
|
+
if res.is_success:
|
|
29
|
+
return
|
|
30
|
+
|
|
31
|
+
res.read()
|
|
32
|
+
|
|
33
|
+
return format_envd_api_exception(res.status_code, get_message(res))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
async def ahandle_envd_api_exception(res: httpx.Response):
|
|
37
|
+
if res.is_success:
|
|
38
|
+
return
|
|
39
|
+
|
|
40
|
+
await res.aread()
|
|
41
|
+
|
|
42
|
+
return format_envd_api_exception(res.status_code, get_message(res))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def format_envd_api_exception(status_code: int, message: str):
|
|
46
|
+
if status_code == 400:
|
|
47
|
+
return InvalidArgumentException(message)
|
|
48
|
+
elif status_code == 401:
|
|
49
|
+
return AuthenticationException(message)
|
|
50
|
+
elif status_code == 404:
|
|
51
|
+
return NotFoundException(message)
|
|
52
|
+
elif status_code == 429:
|
|
53
|
+
return SandboxException(f"{message}: The requests are being rate limited.")
|
|
54
|
+
elif status_code == 502:
|
|
55
|
+
return format_sandbox_timeout_exception(message)
|
|
56
|
+
elif status_code == 507:
|
|
57
|
+
return NotEnoughSpaceException(message)
|
|
58
|
+
else:
|
|
59
|
+
return SandboxException(f"{status_code}: {message}")
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Code generated by protoc-gen-connect-python 0.1.0.dev2, DO NOT EDIT.
|
|
2
|
+
from typing import Any, Generator, Coroutine, AsyncGenerator, Optional
|
|
3
|
+
from httpcore import ConnectionPool, AsyncConnectionPool
|
|
4
|
+
|
|
5
|
+
import moru_connect as connect
|
|
6
|
+
|
|
7
|
+
from moru.envd.filesystem import filesystem_pb2 as filesystem_dot_filesystem__pb2
|
|
8
|
+
|
|
9
|
+
FilesystemName = "filesystem.Filesystem"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class FilesystemClient:
|
|
13
|
+
def __init__(
|
|
14
|
+
self,
|
|
15
|
+
base_url: str,
|
|
16
|
+
*,
|
|
17
|
+
pool: Optional[ConnectionPool] = None,
|
|
18
|
+
async_pool: Optional[AsyncConnectionPool] = None,
|
|
19
|
+
compressor=None,
|
|
20
|
+
json=False,
|
|
21
|
+
**opts,
|
|
22
|
+
):
|
|
23
|
+
self._stat = connect.Client(
|
|
24
|
+
pool=pool,
|
|
25
|
+
async_pool=async_pool,
|
|
26
|
+
url=f"{base_url}/{FilesystemName}/Stat",
|
|
27
|
+
response_type=filesystem_dot_filesystem__pb2.StatResponse,
|
|
28
|
+
compressor=compressor,
|
|
29
|
+
json=json,
|
|
30
|
+
**opts,
|
|
31
|
+
)
|
|
32
|
+
self._make_dir = connect.Client(
|
|
33
|
+
pool=pool,
|
|
34
|
+
async_pool=async_pool,
|
|
35
|
+
url=f"{base_url}/{FilesystemName}/MakeDir",
|
|
36
|
+
response_type=filesystem_dot_filesystem__pb2.MakeDirResponse,
|
|
37
|
+
compressor=compressor,
|
|
38
|
+
json=json,
|
|
39
|
+
**opts,
|
|
40
|
+
)
|
|
41
|
+
self._move = connect.Client(
|
|
42
|
+
pool=pool,
|
|
43
|
+
async_pool=async_pool,
|
|
44
|
+
url=f"{base_url}/{FilesystemName}/Move",
|
|
45
|
+
response_type=filesystem_dot_filesystem__pb2.MoveResponse,
|
|
46
|
+
compressor=compressor,
|
|
47
|
+
json=json,
|
|
48
|
+
**opts,
|
|
49
|
+
)
|
|
50
|
+
self._list_dir = connect.Client(
|
|
51
|
+
pool=pool,
|
|
52
|
+
async_pool=async_pool,
|
|
53
|
+
url=f"{base_url}/{FilesystemName}/ListDir",
|
|
54
|
+
response_type=filesystem_dot_filesystem__pb2.ListDirResponse,
|
|
55
|
+
compressor=compressor,
|
|
56
|
+
json=json,
|
|
57
|
+
**opts,
|
|
58
|
+
)
|
|
59
|
+
self._remove = connect.Client(
|
|
60
|
+
pool=pool,
|
|
61
|
+
async_pool=async_pool,
|
|
62
|
+
url=f"{base_url}/{FilesystemName}/Remove",
|
|
63
|
+
response_type=filesystem_dot_filesystem__pb2.RemoveResponse,
|
|
64
|
+
compressor=compressor,
|
|
65
|
+
json=json,
|
|
66
|
+
**opts,
|
|
67
|
+
)
|
|
68
|
+
self._watch_dir = connect.Client(
|
|
69
|
+
pool=pool,
|
|
70
|
+
async_pool=async_pool,
|
|
71
|
+
url=f"{base_url}/{FilesystemName}/WatchDir",
|
|
72
|
+
response_type=filesystem_dot_filesystem__pb2.WatchDirResponse,
|
|
73
|
+
compressor=compressor,
|
|
74
|
+
json=json,
|
|
75
|
+
**opts,
|
|
76
|
+
)
|
|
77
|
+
self._create_watcher = connect.Client(
|
|
78
|
+
pool=pool,
|
|
79
|
+
async_pool=async_pool,
|
|
80
|
+
url=f"{base_url}/{FilesystemName}/CreateWatcher",
|
|
81
|
+
response_type=filesystem_dot_filesystem__pb2.CreateWatcherResponse,
|
|
82
|
+
compressor=compressor,
|
|
83
|
+
json=json,
|
|
84
|
+
**opts,
|
|
85
|
+
)
|
|
86
|
+
self._get_watcher_events = connect.Client(
|
|
87
|
+
pool=pool,
|
|
88
|
+
async_pool=async_pool,
|
|
89
|
+
url=f"{base_url}/{FilesystemName}/GetWatcherEvents",
|
|
90
|
+
response_type=filesystem_dot_filesystem__pb2.GetWatcherEventsResponse,
|
|
91
|
+
compressor=compressor,
|
|
92
|
+
json=json,
|
|
93
|
+
**opts,
|
|
94
|
+
)
|
|
95
|
+
self._remove_watcher = connect.Client(
|
|
96
|
+
pool=pool,
|
|
97
|
+
async_pool=async_pool,
|
|
98
|
+
url=f"{base_url}/{FilesystemName}/RemoveWatcher",
|
|
99
|
+
response_type=filesystem_dot_filesystem__pb2.RemoveWatcherResponse,
|
|
100
|
+
compressor=compressor,
|
|
101
|
+
json=json,
|
|
102
|
+
**opts,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
def stat(
|
|
106
|
+
self, req: filesystem_dot_filesystem__pb2.StatRequest, **opts
|
|
107
|
+
) -> filesystem_dot_filesystem__pb2.StatResponse:
|
|
108
|
+
return self._stat.call_unary(req, **opts)
|
|
109
|
+
|
|
110
|
+
def astat(
|
|
111
|
+
self, req: filesystem_dot_filesystem__pb2.StatRequest, **opts
|
|
112
|
+
) -> Coroutine[Any, Any, filesystem_dot_filesystem__pb2.StatResponse]:
|
|
113
|
+
return self._stat.acall_unary(req, **opts)
|
|
114
|
+
|
|
115
|
+
def make_dir(
|
|
116
|
+
self, req: filesystem_dot_filesystem__pb2.MakeDirRequest, **opts
|
|
117
|
+
) -> filesystem_dot_filesystem__pb2.MakeDirResponse:
|
|
118
|
+
return self._make_dir.call_unary(req, **opts)
|
|
119
|
+
|
|
120
|
+
def amake_dir(
|
|
121
|
+
self, req: filesystem_dot_filesystem__pb2.MakeDirRequest, **opts
|
|
122
|
+
) -> Coroutine[Any, Any, filesystem_dot_filesystem__pb2.MakeDirResponse]:
|
|
123
|
+
return self._make_dir.acall_unary(req, **opts)
|
|
124
|
+
|
|
125
|
+
def move(
|
|
126
|
+
self, req: filesystem_dot_filesystem__pb2.MoveRequest, **opts
|
|
127
|
+
) -> filesystem_dot_filesystem__pb2.MoveResponse:
|
|
128
|
+
return self._move.call_unary(req, **opts)
|
|
129
|
+
|
|
130
|
+
def amove(
|
|
131
|
+
self, req: filesystem_dot_filesystem__pb2.MoveRequest, **opts
|
|
132
|
+
) -> Coroutine[Any, Any, filesystem_dot_filesystem__pb2.MoveResponse]:
|
|
133
|
+
return self._move.acall_unary(req, **opts)
|
|
134
|
+
|
|
135
|
+
def list_dir(
|
|
136
|
+
self, req: filesystem_dot_filesystem__pb2.ListDirRequest, **opts
|
|
137
|
+
) -> filesystem_dot_filesystem__pb2.ListDirResponse:
|
|
138
|
+
return self._list_dir.call_unary(req, **opts)
|
|
139
|
+
|
|
140
|
+
def alist_dir(
|
|
141
|
+
self, req: filesystem_dot_filesystem__pb2.ListDirRequest, **opts
|
|
142
|
+
) -> Coroutine[Any, Any, filesystem_dot_filesystem__pb2.ListDirResponse]:
|
|
143
|
+
return self._list_dir.acall_unary(req, **opts)
|
|
144
|
+
|
|
145
|
+
def remove(
|
|
146
|
+
self, req: filesystem_dot_filesystem__pb2.RemoveRequest, **opts
|
|
147
|
+
) -> filesystem_dot_filesystem__pb2.RemoveResponse:
|
|
148
|
+
return self._remove.call_unary(req, **opts)
|
|
149
|
+
|
|
150
|
+
def aremove(
|
|
151
|
+
self, req: filesystem_dot_filesystem__pb2.RemoveRequest, **opts
|
|
152
|
+
) -> Coroutine[Any, Any, filesystem_dot_filesystem__pb2.RemoveResponse]:
|
|
153
|
+
return self._remove.acall_unary(req, **opts)
|
|
154
|
+
|
|
155
|
+
def watch_dir(
|
|
156
|
+
self, req: filesystem_dot_filesystem__pb2.WatchDirRequest, **opts
|
|
157
|
+
) -> Generator[filesystem_dot_filesystem__pb2.WatchDirResponse, Any, None]:
|
|
158
|
+
return self._watch_dir.call_server_stream(req, **opts)
|
|
159
|
+
|
|
160
|
+
def awatch_dir(
|
|
161
|
+
self, req: filesystem_dot_filesystem__pb2.WatchDirRequest, **opts
|
|
162
|
+
) -> AsyncGenerator[filesystem_dot_filesystem__pb2.WatchDirResponse, Any]:
|
|
163
|
+
return self._watch_dir.acall_server_stream(req, **opts)
|
|
164
|
+
|
|
165
|
+
def create_watcher(
|
|
166
|
+
self, req: filesystem_dot_filesystem__pb2.CreateWatcherRequest, **opts
|
|
167
|
+
) -> filesystem_dot_filesystem__pb2.CreateWatcherResponse:
|
|
168
|
+
return self._create_watcher.call_unary(req, **opts)
|
|
169
|
+
|
|
170
|
+
def acreate_watcher(
|
|
171
|
+
self, req: filesystem_dot_filesystem__pb2.CreateWatcherRequest, **opts
|
|
172
|
+
) -> Coroutine[Any, Any, filesystem_dot_filesystem__pb2.CreateWatcherResponse]:
|
|
173
|
+
return self._create_watcher.acall_unary(req, **opts)
|
|
174
|
+
|
|
175
|
+
def get_watcher_events(
|
|
176
|
+
self, req: filesystem_dot_filesystem__pb2.GetWatcherEventsRequest, **opts
|
|
177
|
+
) -> filesystem_dot_filesystem__pb2.GetWatcherEventsResponse:
|
|
178
|
+
return self._get_watcher_events.call_unary(req, **opts)
|
|
179
|
+
|
|
180
|
+
def aget_watcher_events(
|
|
181
|
+
self, req: filesystem_dot_filesystem__pb2.GetWatcherEventsRequest, **opts
|
|
182
|
+
) -> Coroutine[Any, Any, filesystem_dot_filesystem__pb2.GetWatcherEventsResponse]:
|
|
183
|
+
return self._get_watcher_events.acall_unary(req, **opts)
|
|
184
|
+
|
|
185
|
+
def remove_watcher(
|
|
186
|
+
self, req: filesystem_dot_filesystem__pb2.RemoveWatcherRequest, **opts
|
|
187
|
+
) -> filesystem_dot_filesystem__pb2.RemoveWatcherResponse:
|
|
188
|
+
return self._remove_watcher.call_unary(req, **opts)
|
|
189
|
+
|
|
190
|
+
def aremove_watcher(
|
|
191
|
+
self, req: filesystem_dot_filesystem__pb2.RemoveWatcherRequest, **opts
|
|
192
|
+
) -> Coroutine[Any, Any, filesystem_dot_filesystem__pb2.RemoveWatcherResponse]:
|
|
193
|
+
return self._remove_watcher.acall_unary(req, **opts)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: filesystem/filesystem.proto
|
|
4
|
+
# Protobuf Python Version: 5.26.1
|
|
5
|
+
"""Generated protocol buffer code."""
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
from google.protobuf.internal import builder as _builder
|
|
10
|
+
# @@protoc_insertion_point(imports)
|
|
11
|
+
|
|
12
|
+
_sym_db = _symbol_database.Default()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1b\x66ilesystem/filesystem.proto\x12\nfilesystem\x1a\x1fgoogle/protobuf/timestamp.proto\"G\n\x0bMoveRequest\x12\x16\n\x06source\x18\x01 \x01(\tR\x06source\x12 \n\x0b\x64\x65stination\x18\x02 \x01(\tR\x0b\x64\x65stination\";\n\x0cMoveResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry\"$\n\x0eMakeDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\">\n\x0fMakeDirResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry\"#\n\rRemoveRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\"\x10\n\x0eRemoveResponse\"!\n\x0bStatRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\";\n\x0cStatResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry\"\xd3\x02\n\tEntryInfo\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12(\n\x04type\x18\x02 \x01(\x0e\x32\x14.filesystem.FileTypeR\x04type\x12\x12\n\x04path\x18\x03 \x01(\tR\x04path\x12\x12\n\x04size\x18\x04 \x01(\x03R\x04size\x12\x12\n\x04mode\x18\x05 \x01(\rR\x04mode\x12 \n\x0bpermissions\x18\x06 \x01(\tR\x0bpermissions\x12\x14\n\x05owner\x18\x07 \x01(\tR\x05owner\x12\x14\n\x05group\x18\x08 \x01(\tR\x05group\x12?\n\rmodified_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x0cmodifiedTime\x12*\n\x0esymlink_target\x18\n \x01(\tH\x00R\rsymlinkTarget\x88\x01\x01\x42\x11\n\x0f_symlink_target\":\n\x0eListDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12\x14\n\x05\x64\x65pth\x18\x02 \x01(\rR\x05\x64\x65pth\"B\n\x0fListDirResponse\x12/\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\x15.filesystem.EntryInfoR\x07\x65ntries\"C\n\x0fWatchDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12\x1c\n\trecursive\x18\x02 \x01(\x08R\trecursive\"P\n\x0f\x46ilesystemEvent\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12)\n\x04type\x18\x02 \x01(\x0e\x32\x15.filesystem.EventTypeR\x04type\"\xfe\x01\n\x10WatchDirResponse\x12?\n\x05start\x18\x01 \x01(\x0b\x32\'.filesystem.WatchDirResponse.StartEventH\x00R\x05start\x12=\n\nfilesystem\x18\x02 \x01(\x0b\x32\x1b.filesystem.FilesystemEventH\x00R\nfilesystem\x12\x46\n\tkeepalive\x18\x03 \x01(\x0b\x32&.filesystem.WatchDirResponse.KeepAliveH\x00R\tkeepalive\x1a\x0c\n\nStartEvent\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent\"H\n\x14\x43reateWatcherRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12\x1c\n\trecursive\x18\x02 \x01(\x08R\trecursive\"6\n\x15\x43reateWatcherResponse\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId\"8\n\x17GetWatcherEventsRequest\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId\"O\n\x18GetWatcherEventsResponse\x12\x33\n\x06\x65vents\x18\x01 \x03(\x0b\x32\x1b.filesystem.FilesystemEventR\x06\x65vents\"5\n\x14RemoveWatcherRequest\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId\"\x17\n\x15RemoveWatcherResponse*R\n\x08\x46ileType\x12\x19\n\x15\x46ILE_TYPE_UNSPECIFIED\x10\x00\x12\x12\n\x0e\x46ILE_TYPE_FILE\x10\x01\x12\x17\n\x13\x46ILE_TYPE_DIRECTORY\x10\x02*\x98\x01\n\tEventType\x12\x1a\n\x16\x45VENT_TYPE_UNSPECIFIED\x10\x00\x12\x15\n\x11\x45VENT_TYPE_CREATE\x10\x01\x12\x14\n\x10\x45VENT_TYPE_WRITE\x10\x02\x12\x15\n\x11\x45VENT_TYPE_REMOVE\x10\x03\x12\x15\n\x11\x45VENT_TYPE_RENAME\x10\x04\x12\x14\n\x10\x45VENT_TYPE_CHMOD\x10\x05\x32\x9f\x05\n\nFilesystem\x12\x39\n\x04Stat\x12\x17.filesystem.StatRequest\x1a\x18.filesystem.StatResponse\x12\x42\n\x07MakeDir\x12\x1a.filesystem.MakeDirRequest\x1a\x1b.filesystem.MakeDirResponse\x12\x39\n\x04Move\x12\x17.filesystem.MoveRequest\x1a\x18.filesystem.MoveResponse\x12\x42\n\x07ListDir\x12\x1a.filesystem.ListDirRequest\x1a\x1b.filesystem.ListDirResponse\x12?\n\x06Remove\x12\x19.filesystem.RemoveRequest\x1a\x1a.filesystem.RemoveResponse\x12G\n\x08WatchDir\x12\x1b.filesystem.WatchDirRequest\x1a\x1c.filesystem.WatchDirResponse0\x01\x12T\n\rCreateWatcher\x12 .filesystem.CreateWatcherRequest\x1a!.filesystem.CreateWatcherResponse\x12]\n\x10GetWatcherEvents\x12#.filesystem.GetWatcherEventsRequest\x1a$.filesystem.GetWatcherEventsResponse\x12T\n\rRemoveWatcher\x12 .filesystem.RemoveWatcherRequest\x1a!.filesystem.RemoveWatcherResponseBi\n\x0e\x63om.filesystemB\x0f\x46ilesystemProtoP\x01\xa2\x02\x03\x46XX\xaa\x02\nFilesystem\xca\x02\nFilesystem\xe2\x02\x16\x46ilesystem\\GPBMetadata\xea\x02\nFilesystemb\x06proto3')
|
|
19
|
+
|
|
20
|
+
_globals = globals()
|
|
21
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
22
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'filesystem.filesystem_pb2', _globals)
|
|
23
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
24
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
25
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\016com.filesystemB\017FilesystemProtoP\001\242\002\003FXX\252\002\nFilesystem\312\002\nFilesystem\342\002\026Filesystem\\GPBMetadata\352\002\nFilesystem'
|
|
26
|
+
_globals['_FILETYPE']._serialized_start=1690
|
|
27
|
+
_globals['_FILETYPE']._serialized_end=1772
|
|
28
|
+
_globals['_EVENTTYPE']._serialized_start=1775
|
|
29
|
+
_globals['_EVENTTYPE']._serialized_end=1927
|
|
30
|
+
_globals['_MOVEREQUEST']._serialized_start=76
|
|
31
|
+
_globals['_MOVEREQUEST']._serialized_end=147
|
|
32
|
+
_globals['_MOVERESPONSE']._serialized_start=149
|
|
33
|
+
_globals['_MOVERESPONSE']._serialized_end=208
|
|
34
|
+
_globals['_MAKEDIRREQUEST']._serialized_start=210
|
|
35
|
+
_globals['_MAKEDIRREQUEST']._serialized_end=246
|
|
36
|
+
_globals['_MAKEDIRRESPONSE']._serialized_start=248
|
|
37
|
+
_globals['_MAKEDIRRESPONSE']._serialized_end=310
|
|
38
|
+
_globals['_REMOVEREQUEST']._serialized_start=312
|
|
39
|
+
_globals['_REMOVEREQUEST']._serialized_end=347
|
|
40
|
+
_globals['_REMOVERESPONSE']._serialized_start=349
|
|
41
|
+
_globals['_REMOVERESPONSE']._serialized_end=365
|
|
42
|
+
_globals['_STATREQUEST']._serialized_start=367
|
|
43
|
+
_globals['_STATREQUEST']._serialized_end=400
|
|
44
|
+
_globals['_STATRESPONSE']._serialized_start=402
|
|
45
|
+
_globals['_STATRESPONSE']._serialized_end=461
|
|
46
|
+
_globals['_ENTRYINFO']._serialized_start=464
|
|
47
|
+
_globals['_ENTRYINFO']._serialized_end=803
|
|
48
|
+
_globals['_LISTDIRREQUEST']._serialized_start=805
|
|
49
|
+
_globals['_LISTDIRREQUEST']._serialized_end=863
|
|
50
|
+
_globals['_LISTDIRRESPONSE']._serialized_start=865
|
|
51
|
+
_globals['_LISTDIRRESPONSE']._serialized_end=931
|
|
52
|
+
_globals['_WATCHDIRREQUEST']._serialized_start=933
|
|
53
|
+
_globals['_WATCHDIRREQUEST']._serialized_end=1000
|
|
54
|
+
_globals['_FILESYSTEMEVENT']._serialized_start=1002
|
|
55
|
+
_globals['_FILESYSTEMEVENT']._serialized_end=1082
|
|
56
|
+
_globals['_WATCHDIRRESPONSE']._serialized_start=1085
|
|
57
|
+
_globals['_WATCHDIRRESPONSE']._serialized_end=1339
|
|
58
|
+
_globals['_WATCHDIRRESPONSE_STARTEVENT']._serialized_start=1305
|
|
59
|
+
_globals['_WATCHDIRRESPONSE_STARTEVENT']._serialized_end=1317
|
|
60
|
+
_globals['_WATCHDIRRESPONSE_KEEPALIVE']._serialized_start=1319
|
|
61
|
+
_globals['_WATCHDIRRESPONSE_KEEPALIVE']._serialized_end=1330
|
|
62
|
+
_globals['_CREATEWATCHERREQUEST']._serialized_start=1341
|
|
63
|
+
_globals['_CREATEWATCHERREQUEST']._serialized_end=1413
|
|
64
|
+
_globals['_CREATEWATCHERRESPONSE']._serialized_start=1415
|
|
65
|
+
_globals['_CREATEWATCHERRESPONSE']._serialized_end=1469
|
|
66
|
+
_globals['_GETWATCHEREVENTSREQUEST']._serialized_start=1471
|
|
67
|
+
_globals['_GETWATCHEREVENTSREQUEST']._serialized_end=1527
|
|
68
|
+
_globals['_GETWATCHEREVENTSRESPONSE']._serialized_start=1529
|
|
69
|
+
_globals['_GETWATCHEREVENTSRESPONSE']._serialized_end=1608
|
|
70
|
+
_globals['_REMOVEWATCHERREQUEST']._serialized_start=1610
|
|
71
|
+
_globals['_REMOVEWATCHERREQUEST']._serialized_end=1663
|
|
72
|
+
_globals['_REMOVEWATCHERRESPONSE']._serialized_start=1665
|
|
73
|
+
_globals['_REMOVEWATCHERRESPONSE']._serialized_end=1688
|
|
74
|
+
_globals['_FILESYSTEM']._serialized_start=1930
|
|
75
|
+
_globals['_FILESYSTEM']._serialized_end=2601
|
|
76
|
+
# @@protoc_insertion_point(module_scope)
|