Name | envoy-data-plane JSON |
Version |
0.5.0
JSON |
| download |
home_page | |
Summary | Python dataclasses for the Envoy Data-Plane-API |
upload_time | 2023-01-24 05:30:23 |
maintainer | |
docs_url | None |
author | Vasili Syrakis |
requires_python | >=3.7,<4.0 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# envoy_data_plane
A conversion of envoyproxy/data-plane-api protocol buffers into Python dataclasses using betterproto
## Intended usage
This is a helper library that allows importing every type available in the envoy API.
One use-case might be generating Envoy configuration using a Python script.
In my case, I will use this library in my custom built control-plane,
so that I have autocompletion in my IDE, and a basic form of validation.
In future, this may also help with building an idiomatic GRPC control-plane in Python.
## Installation
This package is published to PyPI:
```shell script
python -m pip install envoy_data_plane
```
## Installing specific XDS revisions
There are branches available with compiled python protobuf files.
To install them, you can use the following syntax:
```shell script
pip install git+https://github.com/cetanu/envoy_data_plane@<BRANCH NAME>
```
Examples:
```
pip install git+https://github.com/cetanu/envoy_data_plane@envoy_v1.13.7
pip install git+https://github.com/cetanu/envoy_data_plane@envoy_v1.16.2
pip install git+https://github.com/cetanu/envoy_data_plane@envoy_v1.17.2
pip install git+https://github.com/cetanu/envoy_data_plane@envoy_v1.18.2
pip install git+https://github.com/cetanu/envoy_data_plane@envoy_v1.19.0
```
Not all versions may be available. Raise an issue if you need another one added.
## Example
```python
import stringcase
import json
import envoy_data_plane.envoy.api.v2 as envoy
route_config = envoy.RouteConfiguration(
name='MyRouteConfig',
virtual_hosts=[
envoy.route.VirtualHost(
name='SomeWebsite',
domains=['foobar.com'],
routes=[
envoy.route.Route(
name='catchall',
match=envoy.route.RouteMatch(
prefix='/'
),
direct_response=envoy.route.DirectResponseAction(
status=200,
body=envoy.core.DataSource(
inline_string='Hello there'
)
)
)
]
)
]
)
response = envoy.DiscoveryResponse(
version_info='0',
resources=[
route_config
],
)
print(
json.dumps(response.to_dict(casing=stringcase.snakecase), indent=2)
)
```
Result:
```
{
"version_info": "0",
"resources": [
{
"name": "MyRouteConfig",
"virtual_hosts": [
{
"name": "SomeWebsite",
"domains": [
"foobar.com"
],
"routes": [
{
"name": "catchall",
"match": {
"prefix": "/",
"headers": [],
"query_parameters": []
},
"direct_response": {
"status": 200,
"body": {
"inline_string": "Hello there"
}
},
"request_headers_to_add": [],
"response_headers_to_add": []
}
],
"virtual_clusters": [],
"rate_limits": [],
"request_headers_to_add": [],
"response_headers_to_add": []
}
],
"response_headers_to_add": [],
"request_headers_to_add": []
}
]
}
```
Raw data
{
"_id": null,
"home_page": "",
"name": "envoy-data-plane",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Vasili Syrakis",
"author_email": "vsyrakis@atlassian.com",
"download_url": "https://files.pythonhosted.org/packages/6f/e5/fc2669b01486e4cfb4bf599872c1450cc3995605fa270997a0d37a3a3dd9/envoy_data_plane-0.5.0.tar.gz",
"platform": null,
"description": "# envoy_data_plane\n\nA conversion of envoyproxy/data-plane-api protocol buffers into Python dataclasses using betterproto\n\n## Intended usage\n\nThis is a helper library that allows importing every type available in the envoy API.\n\nOne use-case might be generating Envoy configuration using a Python script.\n\nIn my case, I will use this library in my custom built control-plane, \nso that I have autocompletion in my IDE, and a basic form of validation.\n\nIn future, this may also help with building an idiomatic GRPC control-plane in Python.\n\n## Installation\n\nThis package is published to PyPI:\n\n```shell script\npython -m pip install envoy_data_plane\n```\n\n## Installing specific XDS revisions\n\nThere are branches available with compiled python protobuf files. \nTo install them, you can use the following syntax:\n\n```shell script\npip install git+https://github.com/cetanu/envoy_data_plane@<BRANCH NAME>\n```\n\nExamples:\n\n```\npip install git+https://github.com/cetanu/envoy_data_plane@envoy_v1.13.7\npip install git+https://github.com/cetanu/envoy_data_plane@envoy_v1.16.2\npip install git+https://github.com/cetanu/envoy_data_plane@envoy_v1.17.2\npip install git+https://github.com/cetanu/envoy_data_plane@envoy_v1.18.2\npip install git+https://github.com/cetanu/envoy_data_plane@envoy_v1.19.0\n```\n\nNot all versions may be available. Raise an issue if you need another one added.\n\n## Example\n\n```python\nimport stringcase\nimport json\nimport envoy_data_plane.envoy.api.v2 as envoy\n\nroute_config = envoy.RouteConfiguration(\n name='MyRouteConfig',\n virtual_hosts=[\n envoy.route.VirtualHost(\n name='SomeWebsite',\n domains=['foobar.com'],\n routes=[\n envoy.route.Route(\n name='catchall',\n match=envoy.route.RouteMatch(\n prefix='/'\n ),\n direct_response=envoy.route.DirectResponseAction(\n status=200,\n body=envoy.core.DataSource(\n inline_string='Hello there'\n )\n )\n )\n ]\n )\n ]\n)\n\nresponse = envoy.DiscoveryResponse(\n version_info='0',\n resources=[\n route_config\n ],\n)\n\nprint(\n json.dumps(response.to_dict(casing=stringcase.snakecase), indent=2)\n)\n```\n\nResult:\n```\n{\n \"version_info\": \"0\",\n \"resources\": [\n {\n \"name\": \"MyRouteConfig\",\n \"virtual_hosts\": [\n {\n \"name\": \"SomeWebsite\",\n \"domains\": [\n \"foobar.com\"\n ],\n \"routes\": [\n {\n \"name\": \"catchall\",\n \"match\": {\n \"prefix\": \"/\",\n \"headers\": [],\n \"query_parameters\": []\n },\n \"direct_response\": {\n \"status\": 200,\n \"body\": {\n \"inline_string\": \"Hello there\"\n }\n },\n \"request_headers_to_add\": [],\n \"response_headers_to_add\": []\n }\n ],\n \"virtual_clusters\": [],\n \"rate_limits\": [],\n \"request_headers_to_add\": [],\n \"response_headers_to_add\": []\n }\n ],\n \"response_headers_to_add\": [],\n \"request_headers_to_add\": []\n }\n ]\n}\n\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python dataclasses for the Envoy Data-Plane-API",
"version": "0.5.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "51dbfe73a7e52f872bb5e104fa1b1887e63ab3239b0be4a6592dd3d366d727f8",
"md5": "49f4bf5476202a732d699380eaf8a19d",
"sha256": "c0adc517ac138b5ad400ca56ec8a6cb3cb7ff76bdc2a037dd78c6a99a674abe0"
},
"downloads": -1,
"filename": "envoy_data_plane-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "49f4bf5476202a732d699380eaf8a19d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 837174,
"upload_time": "2023-01-24T05:30:21",
"upload_time_iso_8601": "2023-01-24T05:30:21.488886Z",
"url": "https://files.pythonhosted.org/packages/51/db/fe73a7e52f872bb5e104fa1b1887e63ab3239b0be4a6592dd3d366d727f8/envoy_data_plane-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6fe5fc2669b01486e4cfb4bf599872c1450cc3995605fa270997a0d37a3a3dd9",
"md5": "db1765f2ff99358a0a12a5c9cd5470b4",
"sha256": "f7518338621079e2a7a0e7e829d5ed27d9f8a57d6e450221873ec110611d78db"
},
"downloads": -1,
"filename": "envoy_data_plane-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "db1765f2ff99358a0a12a5c9cd5470b4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 534068,
"upload_time": "2023-01-24T05:30:23",
"upload_time_iso_8601": "2023-01-24T05:30:23.299384Z",
"url": "https://files.pythonhosted.org/packages/6f/e5/fc2669b01486e4cfb4bf599872c1450cc3995605fa270997a0d37a3a3dd9/envoy_data_plane-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-24 05:30:23",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "envoy-data-plane"
}