appmesh 1.5.3__py3-none-any.whl → 1.5.5__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 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.
@@ -876,12 +877,13 @@ class AppMeshClient(metaclass=abc.ABCMeta):
876
877
  ########################################
877
878
  # User Management
878
879
  ########################################
879
- def update_user_password(self, new_password: str, user_name: str = "self") -> bool:
880
+ def update_user_password(self, old_password: str, new_password: str, user_name: str = "self") -> bool:
880
881
  """Change the password of a user.
881
882
 
882
883
  Args:
883
884
  user_name (str): the user name.
884
- new_password (str):the new password string
885
+ old_password (str): the old password string.
886
+ new_password (str):the new password string.
885
887
 
886
888
  Returns:
887
889
  bool: success
@@ -889,7 +891,10 @@ class AppMeshClient(metaclass=abc.ABCMeta):
889
891
  resp = self._request_http(
890
892
  method=AppMeshClient.Method.POST,
891
893
  path=f"/appmesh/user/{user_name}/passwd",
892
- body={"new_password": base64.b64encode(new_password.encode()).decode()},
894
+ body={
895
+ "old_password": base64.b64encode(old_password.encode()).decode(),
896
+ "new_password": base64.b64encode(new_password.encode()).decode(),
897
+ },
893
898
  )
894
899
  if resp.status_code != HTTPStatus.OK:
895
900
  raise Exception(resp.text)
@@ -1204,6 +1209,73 @@ class AppMeshClient(metaclass=abc.ABCMeta):
1204
1209
  else:
1205
1210
  raise TypeError(f"Invalid timeout type: {str(timeout)}")
1206
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
+
1207
1279
  def run_app_async(
1208
1280
  self,
1209
1281
  app: Union[App, str],
@@ -1375,7 +1447,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
1375
1447
  elif method is AppMeshClient.Method.DELETE:
1376
1448
  return self.session.delete(url=rest_url, headers=header, cert=self.ssl_client_cert, verify=self.ssl_verify, timeout=self.rest_timeout)
1377
1449
  elif method is AppMeshClient.Method.PUT:
1378
- return self.session.put(url=rest_url, params=query, headers=header, json=body, cert=self.ssl_client_cert, verify=self.ssl_verify, timeout=self.rest_timeout)
1450
+ 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)
1379
1451
  else:
1380
1452
  raise Exception("Invalid http method", method)
1381
1453
  except requests.exceptions.RequestException as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: appmesh
3
- Version: 1.5.3
3
+ Version: 1.5.5
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 | 1. Manage independent applications with flexible process control (long/short running, periodic, cron schedule, custom timings, error handling) and comprehensive monitoring (start counts, return codes, error messages, health checks) for both native and Docker applications. <br> 2. Run applications on remote hosts using SDK/CLI with sync/async modes and fetch results to the client. <br> 3. Full control over application lifecycle (cgroup resource limitation, specific OS user for execution). <br> 4. Support interactive application start with specific input data via pipe and environment variables. <br> 5. Access all functionalities 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) and [WebGUI](https://github.com/laoshanxi/app-mesh-ui) interface.<br>
52
- Security | ⚡️ [JWT authentication](https://app-mesh.readthedocs.io/en/latest/JWT.html) for CLI and REST interface <br> ⚡️ [LDAP support](https://app-mesh.readthedocs.io/en/latest/LDAP.html) <br> ⚡️ [Role based permission control](https://app-mesh.readthedocs.io/en/latest/USER_ROLE.html) <br> ⚡️ [Multi-factor authentication](https://app-mesh.readthedocs.io/en/latest/MFA.html)<br> SSL support (ECDH and secure ciphers) for REST http connection <br> Multi-tenant support
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)
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
+ | Task invoke | √ | |
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=BMnzxZE2N-P3tLGkf0LKrqCJRWCPYciw-gXj5z_YTbE,55783
6
+ appmesh/http_client.py,sha256=T2HjNtFo20gEh949NorOXRR5FWm2oBbXfIDw0fFJ9t8,58962
7
7
  appmesh/tcp_client.py,sha256=Id1aIKVWncTSZiKRVa4sgwo1tFX2wRqOLiTnI9-dNkE,11001
8
8
  appmesh/tcp_messages.py,sha256=w1Kehz_aX4X2CYAUsy9mFVJRhxnLQwwc6L58W4YkQqs,969
9
9
  appmesh/tcp_transport.py,sha256=-XDTQbsKL3yCbguHeW2jNqXpYgnCyHsH4rwcaJ46AS8,8645
10
- appmesh-1.5.3.dist-info/METADATA,sha256=9dWHetQBFMlX98d67VRoF53fkxxbpLju97uPoudjADs,11684
11
- appmesh-1.5.3.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
12
- appmesh-1.5.3.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
13
- appmesh-1.5.3.dist-info/RECORD,,
10
+ appmesh-1.5.5.dist-info/METADATA,sha256=1DSsHqL41rkoTMOBTJOVBxd7kyjSJvJEPGiKY2Tsc20,11707
11
+ appmesh-1.5.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
+ appmesh-1.5.5.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
13
+ appmesh-1.5.5.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (79.0.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5