appmesh 1.2.3__py3-none-any.whl → 1.2.4__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/appmesh_client.py +32 -3
- {appmesh-1.2.3.dist-info → appmesh-1.2.4.dist-info}/METADATA +2 -2
- appmesh-1.2.4.dist-info/RECORD +6 -0
- {appmesh-1.2.3.dist-info → appmesh-1.2.4.dist-info}/WHEEL +1 -1
- appmesh-1.2.3.dist-info/RECORD +0 -6
- {appmesh-1.2.3.dist-info → appmesh-1.2.4.dist-info}/top_level.txt +0 -0
appmesh/appmesh_client.py
CHANGED
@@ -359,10 +359,11 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
359
359
|
"""
|
360
360
|
|
361
361
|
self.server_url = rest_url
|
362
|
-
self.
|
362
|
+
self._jwt_token = jwt_token
|
363
363
|
self.ssl_verify = rest_ssl_verify
|
364
364
|
self.ssl_client_cert = rest_ssl_client_cert
|
365
365
|
self.rest_timeout = rest_timeout
|
366
|
+
self._delegate_host = None
|
366
367
|
|
367
368
|
@property
|
368
369
|
def jwt_token(self) -> str:
|
@@ -371,7 +372,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
371
372
|
Returns:
|
372
373
|
str: _description_
|
373
374
|
"""
|
374
|
-
return self.
|
375
|
+
return self._jwt_token
|
375
376
|
|
376
377
|
@jwt_token.setter
|
377
378
|
def jwt_token(self, token: str) -> None:
|
@@ -380,7 +381,25 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
380
381
|
Args:
|
381
382
|
token (str): _description_
|
382
383
|
"""
|
383
|
-
self.
|
384
|
+
self._jwt_token = token
|
385
|
+
|
386
|
+
@property
|
387
|
+
def delegate_host(self) -> str:
|
388
|
+
"""property for delegate_host
|
389
|
+
|
390
|
+
Returns:
|
391
|
+
str: delegate request to target host (host:port)
|
392
|
+
"""
|
393
|
+
return self._delegate_host
|
394
|
+
|
395
|
+
@delegate_host.setter
|
396
|
+
def delegate_host(self, host: str) -> None:
|
397
|
+
"""setter for delegate_host
|
398
|
+
|
399
|
+
Args:
|
400
|
+
host (str): delegate request to target host (host:port)
|
401
|
+
"""
|
402
|
+
self._delegate_host = host
|
384
403
|
|
385
404
|
########################################
|
386
405
|
# Security
|
@@ -1298,6 +1317,11 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1298
1317
|
header = {} if header is None else header
|
1299
1318
|
if self.jwt_token:
|
1300
1319
|
header["Authorization"] = "Bearer " + self.jwt_token
|
1320
|
+
if self.delegate_host and len(self.delegate_host) > 0:
|
1321
|
+
if ":" in self.delegate_host:
|
1322
|
+
header["X-Target-Host"] = self.delegate_host
|
1323
|
+
else:
|
1324
|
+
header["X-Target-Host"] = self.delegate_host + ":" + str(parse.urlsplit(self.server_url).port)
|
1301
1325
|
header[HTTP_USER_AGENT_HEADER_NAME] = HTTP_USER_AGENT
|
1302
1326
|
|
1303
1327
|
if method is AppMeshClient.Method.GET:
|
@@ -1461,6 +1485,11 @@ class AppMeshClientTCP(AppMeshClient):
|
|
1461
1485
|
appmesh_requst = RequestMsg()
|
1462
1486
|
if super().jwt_token:
|
1463
1487
|
appmesh_requst.headers["Authorization"] = "Bearer " + super().jwt_token
|
1488
|
+
if super().delegate_host and len(super().delegate_host) > 0:
|
1489
|
+
if ":" in super().delegate_host:
|
1490
|
+
appmesh_requst.headers["X-Target-Host"] = super().delegate_host
|
1491
|
+
else:
|
1492
|
+
appmesh_requst.headers["X-Target-Host"] = super().delegate_host + ":" + str(parse.urlsplit(self.server_url).port)
|
1464
1493
|
appmesh_requst.headers[HTTP_USER_AGENT_HEADER_NAME] = HTTP_USER_AGENT
|
1465
1494
|
appmesh_requst.uuid = str(uuid.uuid1())
|
1466
1495
|
appmesh_requst.http_method = method.value
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: appmesh
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.4
|
4
4
|
Summary: Client SDK for App Mesh
|
5
5
|
Home-page: https://github.com/laoshanxi/app-mesh
|
6
6
|
Author: laoshanxi
|
@@ -43,7 +43,7 @@ Cloud native | Schedule cloud-level applications to run on multiple hosts with r
|
|
43
43
|
Micro service application | ⚡️ [Consul micro-service cluster management](https://app-mesh.readthedocs.io/en/latest/CONSUL.html)
|
44
44
|
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)
|
45
45
|
Platform support | X86_64 <br> ARM32 <br> ARM64
|
46
|
-
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> Swagger
|
46
|
+
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> [Swagger OpenAPI Specification](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/laoshanxi/app-mesh/main/src/daemon/rest/openapi.yaml)
|
47
47
|
|
48
48
|
## Getting started
|
49
49
|
|
@@ -0,0 +1,6 @@
|
|
1
|
+
appmesh/__init__.py,sha256=xRdXeFHEieRauuJZElbEBASgXG0ZzU1a5_0isAhM7Gw,11
|
2
|
+
appmesh/appmesh_client.py,sha256=HBAjO77YIsBCLwKl9oM2ajtlR6BuW1ctKBPxvNrZq0w,61947
|
3
|
+
appmesh-1.2.4.dist-info/METADATA,sha256=218Garru27v7El3OqdpKSc94pi4SXr9bxOI-G8IdxuY,10927
|
4
|
+
appmesh-1.2.4.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
5
|
+
appmesh-1.2.4.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
6
|
+
appmesh-1.2.4.dist-info/RECORD,,
|
appmesh-1.2.3.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
appmesh/__init__.py,sha256=xRdXeFHEieRauuJZElbEBASgXG0ZzU1a5_0isAhM7Gw,11
|
2
|
-
appmesh/appmesh_client.py,sha256=T4UxSIrQDc9sLC4wqNXveYhBl_g1-pC9FHNdAzqFvgo,60822
|
3
|
-
appmesh-1.2.3.dist-info/METADATA,sha256=ChudplkmAbMyqjZ6mzGaEytKBfkvcxHpUVyJTaI50vM,10928
|
4
|
-
appmesh-1.2.3.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
|
5
|
-
appmesh-1.2.3.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
6
|
-
appmesh-1.2.3.dist-info/RECORD,,
|
File without changes
|