Name | envoy_data_plane JSON |
Version |
1.0.3
JSON |
| download |
home_page | None |
Summary | Python dataclasses for the Envoy Data-Plane-API |
upload_time | 2025-02-26 05:03:14 |
maintainer | None |
docs_url | None |
author | Vasili Syrakis |
requires_python | <4.0,>=3.11 |
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": null,
"name": "envoy_data_plane",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": null,
"author": "Vasili Syrakis",
"author_email": "cetanu@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/68/67/8be3ece97cdad070a04b9468e1eec1f6a7c7acaee553e6cba0d33660a264/envoy_data_plane-1.0.3.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": "1.0.3",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "095f4098bd839adb7277536b3ac06770bc60534845c39ae66161e33568d0105b",
"md5": "423ad16a99f9ef0d3a1342803c38c46f",
"sha256": "2eabfe0a98e3cf509c13c80798b93d94992a5ba436a4cdd3b5f805f50f40558f"
},
"downloads": -1,
"filename": "envoy_data_plane-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "423ad16a99f9ef0d3a1342803c38c46f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 959951,
"upload_time": "2025-02-26T05:03:12",
"upload_time_iso_8601": "2025-02-26T05:03:12.414784Z",
"url": "https://files.pythonhosted.org/packages/09/5f/4098bd839adb7277536b3ac06770bc60534845c39ae66161e33568d0105b/envoy_data_plane-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "68678be3ece97cdad070a04b9468e1eec1f6a7c7acaee553e6cba0d33660a264",
"md5": "4e3023691cd23260eb7806b04b95ca53",
"sha256": "5244abb443435e312dbc42657606795071e4c4adeb3aa5779a689facb1a8e77f"
},
"downloads": -1,
"filename": "envoy_data_plane-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "4e3023691cd23260eb7806b04b95ca53",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 1176572,
"upload_time": "2025-02-26T05:03:14",
"upload_time_iso_8601": "2025-02-26T05:03:14.576062Z",
"url": "https://files.pythonhosted.org/packages/68/67/8be3ece97cdad070a04b9468e1eec1f6a7c7acaee553e6cba0d33660a264/envoy_data_plane-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-26 05:03:14",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "envoy_data_plane"
}