Name | envoy_data_plane JSON |
Version |
0.8.1
JSON |
| download |
home_page | None |
Summary | Python dataclasses for the Envoy Data-Plane-API |
upload_time | 2024-08-23 02:46:57 |
maintainer | None |
docs_url | None |
author | Vasili Syrakis |
requires_python | <4.0,>=3.7 |
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.7",
"maintainer_email": null,
"keywords": null,
"author": "Vasili Syrakis",
"author_email": "cetanu@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/69/fe/29195b48174f90135361215bd1c9bb8099fb26160ccaefd8843025404920/envoy_data_plane-0.8.1.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.8.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9edf1bca1d25c0b2d95dd67b2ecd1e16c533ffb0c73fec97db800db9d31673af",
"md5": "ba78acbcf4b1af71ac839c7761c9841d",
"sha256": "a8a64196124c4bf5ede3455b946142b88283db5bf77ef69d51e9ad6d2a7a2ad7"
},
"downloads": -1,
"filename": "envoy_data_plane-0.8.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ba78acbcf4b1af71ac839c7761c9841d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.7",
"size": 937717,
"upload_time": "2024-08-23T02:46:55",
"upload_time_iso_8601": "2024-08-23T02:46:55.610227Z",
"url": "https://files.pythonhosted.org/packages/9e/df/1bca1d25c0b2d95dd67b2ecd1e16c533ffb0c73fec97db800db9d31673af/envoy_data_plane-0.8.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "69fe29195b48174f90135361215bd1c9bb8099fb26160ccaefd8843025404920",
"md5": "67855ae398ba9101c83eb43836d2a850",
"sha256": "366ce025c035ea6f9f306b7c3cd3a7072db546fab1d6fb98202e8532354cd0cf"
},
"downloads": -1,
"filename": "envoy_data_plane-0.8.1.tar.gz",
"has_sig": false,
"md5_digest": "67855ae398ba9101c83eb43836d2a850",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.7",
"size": 590269,
"upload_time": "2024-08-23T02:46:57",
"upload_time_iso_8601": "2024-08-23T02:46:57.487222Z",
"url": "https://files.pythonhosted.org/packages/69/fe/29195b48174f90135361215bd1c9bb8099fb26160ccaefd8843025404920/envoy_data_plane-0.8.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-23 02:46:57",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "envoy_data_plane"
}