appmesh 1.5.4__py3-none-any.whl → 1.5.6__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.
- appmesh/http_client.py +76 -2
- appmesh/tcp_client.py +1 -1
- {appmesh-1.5.4.dist-info → appmesh-1.5.6.dist-info}/METADATA +7 -6
- {appmesh-1.5.4.dist-info → appmesh-1.5.6.dist-info}/RECORD +6 -6
- {appmesh-1.5.4.dist-info → appmesh-1.5.6.dist-info}/WHEEL +1 -1
- {appmesh-1.5.4.dist-info → appmesh-1.5.6.dist-info}/top_level.txt +0 -0
appmesh/http_client.py
CHANGED
@@ -150,6 +150,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
150
150
|
- `False`: Disables SSL verification (insecure, use cautiously for development).
|
151
151
|
- `str`: Path to a custom CA certificate or directory for verification. This option allows custom CA configuration,
|
152
152
|
which may be necessary in environments requiring specific CA chains that differ from the default system CAs.
|
153
|
+
To use both a custom CA and the system's default CAs, create a combined CA bundle by concatenating them into a single file. (e.g., `cat custom_ca.pem /etc/ssl/certs/ca-certificates.crt > combined_ca.pem`).
|
153
154
|
|
154
155
|
ssl_client_cert (Union[str, Tuple[str, str]], optional): Path to the SSL client certificate and key. Can be:
|
155
156
|
- `str`: A path to a single PEM file containing both the client certificate and private key.
|
@@ -1208,6 +1209,73 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1208
1209
|
else:
|
1209
1210
|
raise TypeError(f"Invalid timeout type: {str(timeout)}")
|
1210
1211
|
|
1212
|
+
def run_task(self, app_name: str, data: str) -> str:
|
1213
|
+
"""Client send an invocation message to a running App Mesh application and wait for result.
|
1214
|
+
|
1215
|
+
This method posts the provided `data` to the App Mesh service which will
|
1216
|
+
forward it to the specified running application instance.
|
1217
|
+
|
1218
|
+
Args:
|
1219
|
+
app_name (str): Name of the target application (as registered in App Mesh).
|
1220
|
+
data (str): Payload to deliver to the application. Typically a string.
|
1221
|
+
|
1222
|
+
Returns:
|
1223
|
+
str: The HTTP response body returned by the remote application/service.
|
1224
|
+
"""
|
1225
|
+
resp = self._request_http(AppMeshClient.Method.POST, path=f"/appmesh/app/{app_name}/task", body=data)
|
1226
|
+
if resp.status_code != HTTPStatus.OK:
|
1227
|
+
raise Exception(resp.text)
|
1228
|
+
|
1229
|
+
return resp.text
|
1230
|
+
|
1231
|
+
def task_fetch(self) -> str:
|
1232
|
+
"""Fetch invocation data in the currently running App Mesh application process.
|
1233
|
+
|
1234
|
+
This helper is intended to be called by an application process running from App Mesh
|
1235
|
+
to obtain the payload that a client pushed to it. It reads two required
|
1236
|
+
environment variables set by the runtime:
|
1237
|
+
|
1238
|
+
- APP_MESH_PROCESS_ID: the process UUID for this invocation
|
1239
|
+
- APP_MESH_APPLICATION_NAME: the application name
|
1240
|
+
|
1241
|
+
Returns:
|
1242
|
+
str: The payload provided by the client as returned by the service.
|
1243
|
+
"""
|
1244
|
+
process_uuid = os.environ["APP_MESH_PROCESS_ID"]
|
1245
|
+
app_name = os.environ["APP_MESH_APPLICATION_NAME"]
|
1246
|
+
while True:
|
1247
|
+
resp = self._request_http(
|
1248
|
+
AppMeshClient.Method.GET,
|
1249
|
+
path=f"/appmesh/app/{app_name}/task",
|
1250
|
+
query={"process_uuid": process_uuid},
|
1251
|
+
)
|
1252
|
+
if resp.status_code != HTTPStatus.OK:
|
1253
|
+
time.sleep(0.1)
|
1254
|
+
continue
|
1255
|
+
|
1256
|
+
return resp.text
|
1257
|
+
|
1258
|
+
def task_return(self, result: str) -> None:
|
1259
|
+
"""Return the result of a server-side invocation back to the original client.
|
1260
|
+
|
1261
|
+
The method posts the `result` associated with the current process UUID so
|
1262
|
+
the invoking client can retrieve it. The same environment variables used by
|
1263
|
+
`task_fetch` are required to identify the target process.
|
1264
|
+
|
1265
|
+
Args:
|
1266
|
+
result (str): Result payload to be delivered back to the client.
|
1267
|
+
"""
|
1268
|
+
process_uuid = os.environ["APP_MESH_PROCESS_ID"]
|
1269
|
+
app_name = os.environ["APP_MESH_APPLICATION_NAME"]
|
1270
|
+
resp = self._request_http(
|
1271
|
+
AppMeshClient.Method.PUT,
|
1272
|
+
path=f"/appmesh/app/{app_name}/task",
|
1273
|
+
query={"process_uuid": process_uuid},
|
1274
|
+
body=result,
|
1275
|
+
)
|
1276
|
+
if resp.status_code != HTTPStatus.OK:
|
1277
|
+
raise Exception(resp.text)
|
1278
|
+
|
1211
1279
|
def run_app_async(
|
1212
1280
|
self,
|
1213
1281
|
app: Union[App, str],
|
@@ -1350,6 +1418,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1350
1418
|
"""
|
1351
1419
|
rest_url = parse.urljoin(self.auth_server_url, path)
|
1352
1420
|
|
1421
|
+
# Prepare headers
|
1353
1422
|
header = {} if header is None else header
|
1354
1423
|
if self.jwt_token:
|
1355
1424
|
token = self.jwt_token["access_token"] if isinstance(self.jwt_token, dict) and "access_token" in self.jwt_token else self.jwt_token
|
@@ -1361,6 +1430,11 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1361
1430
|
header[self.HTTP_HEADER_KEY_X_TARGET_HOST] = self.forward_to + ":" + str(parse.urlsplit(self.auth_server_url).port)
|
1362
1431
|
header[self.HTTP_HEADER_KEY_USER_AGENT] = self.HTTP_USER_AGENT
|
1363
1432
|
|
1433
|
+
# Convert body to JSON string if it's a dict or list
|
1434
|
+
if isinstance(body, (dict, list)):
|
1435
|
+
body = json.dumps(body)
|
1436
|
+
header.setdefault("Content-Type", "application/json")
|
1437
|
+
|
1364
1438
|
try:
|
1365
1439
|
if method is AppMeshClient.Method.GET:
|
1366
1440
|
return self.session.get(url=rest_url, params=query, headers=header, cert=self.ssl_client_cert, verify=self.ssl_verify, timeout=self.rest_timeout)
|
@@ -1369,7 +1443,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1369
1443
|
url=rest_url,
|
1370
1444
|
params=query,
|
1371
1445
|
headers=header,
|
1372
|
-
data=
|
1446
|
+
data=body,
|
1373
1447
|
cert=self.ssl_client_cert,
|
1374
1448
|
verify=self.ssl_verify,
|
1375
1449
|
timeout=self.rest_timeout,
|
@@ -1379,7 +1453,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1379
1453
|
elif method is AppMeshClient.Method.DELETE:
|
1380
1454
|
return self.session.delete(url=rest_url, headers=header, cert=self.ssl_client_cert, verify=self.ssl_verify, timeout=self.rest_timeout)
|
1381
1455
|
elif method is AppMeshClient.Method.PUT:
|
1382
|
-
return self.session.put(url=rest_url, params=query, headers=header,
|
1456
|
+
return self.session.put(url=rest_url, params=query, headers=header, data=body, cert=self.ssl_client_cert, verify=self.ssl_verify, timeout=self.rest_timeout)
|
1383
1457
|
else:
|
1384
1458
|
raise Exception("Invalid http method", method)
|
1385
1459
|
except requests.exceptions.RequestException as e:
|
appmesh/tcp_client.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# TCP-based App Mesh Client
|
2
|
-
# pylint: disable=line-too-long,broad-exception-raised,
|
2
|
+
# pylint: disable=line-too-long,broad-exception-raised,broad-exception-caught,import-outside-toplevel,protected-access
|
3
3
|
|
4
4
|
import json
|
5
5
|
import os
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: appmesh
|
3
|
-
Version: 1.5.
|
3
|
+
Version: 1.5.6
|
4
4
|
Summary: Client SDK for App Mesh
|
5
5
|
Home-page: https://github.com/laoshanxi/app-mesh
|
6
6
|
Author: laoshanxi
|
@@ -48,11 +48,11 @@ App Mesh is an open-source, multi-tenant application management platform designe
|
|
48
48
|
|
49
49
|
Feature | Description
|
50
50
|
---|---
|
51
|
-
Application management |
|
52
|
-
Security |
|
53
|
-
Cloud native | Schedule cloud-level applications to run on multiple hosts with resource size requests. <br>
|
54
|
-
Micro service application |
|
55
|
-
Extra Features | Collect host/app resource usage <br> Remote shell command execution <br> File upload/download interface <br> Hot-update support `systemctl reload appmesh` <br> Bash completion <br> Reverse proxy <br> [Web GUI](https://github.com/laoshanxi/app-mesh-ui)
|
51
|
+
Application management | 🧩 <b>Application Management (CURD) with Full Remote Control</b> – including cgroup, OS user, environment variables, Docker, stdin, and stdout – along with comprehensive monitoring (start counts, exit codes, error messages, health checks). <br> 🧩 <b>Fine-Grained Application Behavior Control & Scheduling</b> – supports long- and short-running tasks, periodic jobs, cron schedules, custom timings, and robust error handling. <br> 🧩 <b>Multi-Tenancy</b> – built-in user ownership model and access controls. <br> 🧩 <b>Unified Access Interface</b> – interact via [CLI](https://app-mesh.readthedocs.io/en/latest/CLI.html), [REST](https://app-mesh.readthedocs.io/en/latest/Development.html#rest-apis), [SDK](https://github.com/laoshanxi/app-mesh/tree/main/src/sdk) or [WebGUI](https://github.com/laoshanxi/app-mesh-ui).<br>
|
52
|
+
Security | 🔐 Authentication: [LDAP](https://app-mesh.readthedocs.io/en/latest/LDAP.html), [OAuth](src/sdk/python/test/test_oauth2.py), [2FA](https://app-mesh.readthedocs.io/en/latest/MFA.html), YAML-based storage (local file or Consul for clustering) <br> 🔐 Authorization: [JWT](https://app-mesh.readthedocs.io/en/latest/JWT.html), [RBAC](https://app-mesh.readthedocs.io/en/latest/USER_ROLE.html), multi-tenant isolation <br> 🔐 Protection: SSL/TLS for TCP/HTTP, CSRF tokens, HMAC with PSK for non-token verification
|
53
|
+
Cloud native | Schedule cloud-level applications to run on multiple hosts with resource size requests. <br> 🌩️ [Prometheus Exporter (build-in)](https://app-mesh.readthedocs.io/en/latest/PROMETHEUS.html) <br> 🌩️ [Grafana SimpleJson datasource](https://app-mesh.readthedocs.io/en/latest/GrafanaDataSource.html) <br> 🌩️ [Grafana Loki](https://app-mesh.readthedocs.io/en/latest/Loki.html) <br>🌩️ [Dockerfile](https://github.com/laoshanxi/app-mesh/blob/main/Dockerfile)
|
54
|
+
Micro service application | 🧱 [Consul micro-service cluster management](https://app-mesh.readthedocs.io/en/latest/CONSUL.html)
|
55
|
+
Extra Features | Collect host/app resource usage <br> Remote shell command execution <br> File upload/download interface <br> Hot-update support `systemctl reload appmesh` <br> Bash completion <br> Reverse proxy <br> 🌐[Web GUI](https://github.com/laoshanxi/app-mesh-ui)
|
56
56
|
Platform support | X86_64 <br> ARM32 <br> ARM64
|
57
57
|
SDK | [Python](https://app-mesh.readthedocs.io/en/latest/api/appmesh_client.html) <br> [Golang](https://github.com/laoshanxi/app-mesh/blob/main/src/sdk/go/appmesh_client.go) <br> [JavaScript](https://www.npmjs.com/package/appmesh) <br> [Java](https://github.com/laoshanxi/app-mesh/packages/2227502) <br> [Swagger OpenAPI Specification](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/laoshanxi/app-mesh/main/src/daemon/rest/openapi.yaml)
|
58
58
|
|
@@ -102,6 +102,7 @@ Refer to the [Installation doc](https://app-mesh.readthedocs.io/en/latest/Instal
|
|
102
102
|
| GUI | √ | √ |
|
103
103
|
| Virtual Network | | √ |
|
104
104
|
| Monitor tools | √ | √ |
|
105
|
+
| [Remote API call](https://app-mesh.readthedocs.io/en/latest/RemoteTask.html) | √ | |
|
105
106
|
|
106
107
|
---
|
107
108
|
|
@@ -3,11 +3,11 @@ appmesh/app.py,sha256=9Q-SOOej-MH13BU5Dv2iTa-p-sECCJQp6ZX9DjWWmwE,10526
|
|
3
3
|
appmesh/app_output.py,sha256=JK_TMKgjvaw4n_ys_vmN5S4MyWVZpmD7NlKz_UyMIM8,1015
|
4
4
|
appmesh/app_run.py,sha256=9ISKGZ3k3kkbQvSsPfRfkOLqD9xhbqNOM7ork9F4w9c,1712
|
5
5
|
appmesh/appmesh_client.py,sha256=0ltkqHZUq094gKneYmC0bEZCP0X9kHTp9fccKdWFWP0,339
|
6
|
-
appmesh/http_client.py,sha256=
|
7
|
-
appmesh/tcp_client.py,sha256=
|
6
|
+
appmesh/http_client.py,sha256=9PUGuo2YCv1KYVeDhYxFegeEGSBqoSim3UK9OJHEsnU,59143
|
7
|
+
appmesh/tcp_client.py,sha256=yi0n2NpBBCA-JHYWQPPE_1euE7Oz6JHBe1op7lypTXY,10999
|
8
8
|
appmesh/tcp_messages.py,sha256=w1Kehz_aX4X2CYAUsy9mFVJRhxnLQwwc6L58W4YkQqs,969
|
9
9
|
appmesh/tcp_transport.py,sha256=-XDTQbsKL3yCbguHeW2jNqXpYgnCyHsH4rwcaJ46AS8,8645
|
10
|
-
appmesh-1.5.
|
11
|
-
appmesh-1.5.
|
12
|
-
appmesh-1.5.
|
13
|
-
appmesh-1.5.
|
10
|
+
appmesh-1.5.6.dist-info/METADATA,sha256=k241QBT0-fxg36SOh4Y3qHLkYwTkjUgXPRJxYHZ38oY,11768
|
11
|
+
appmesh-1.5.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
12
|
+
appmesh-1.5.6.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
13
|
+
appmesh-1.5.6.dist-info/RECORD,,
|
File without changes
|