envoy_data_plane


Nameenvoy_data_plane JSON
Version 0.7.0 PyPI version JSON
download
home_page
SummaryPython dataclasses for the Envoy Data-Plane-API
upload_time2023-11-13 07:21:41
maintainer
docs_urlNone
authorVasili Syrakis
requires_python>=3.7,<4.0
licenseMIT
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": "cetanu@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/de/32/9a2482611eb404e20d8783ffa8f4572d8a39bf5f6e872f126601a7db8358/envoy_data_plane-0.7.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.7.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1f413cf8f9a27f64f5e2e94173dee12c19fea946c898de0e1caa83987b1dbdce",
                "md5": "9b11dd40a4800ad144813e75ecc44f96",
                "sha256": "2d18dc298eb92dd9d4648a084b5308b092bef6818fe9a5e2f4ca8ce493aa5931"
            },
            "downloads": -1,
            "filename": "envoy_data_plane-0.7.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9b11dd40a4800ad144813e75ecc44f96",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 895603,
            "upload_time": "2023-11-13T07:21:39",
            "upload_time_iso_8601": "2023-11-13T07:21:39.413362Z",
            "url": "https://files.pythonhosted.org/packages/1f/41/3cf8f9a27f64f5e2e94173dee12c19fea946c898de0e1caa83987b1dbdce/envoy_data_plane-0.7.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "de329a2482611eb404e20d8783ffa8f4572d8a39bf5f6e872f126601a7db8358",
                "md5": "e05be22957e4401e68fb41635cebdc7e",
                "sha256": "38f5a71b9648d0cea484c35b12ce26f21e50470c4a41dd4a9b09fea05728847e"
            },
            "downloads": -1,
            "filename": "envoy_data_plane-0.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e05be22957e4401e68fb41635cebdc7e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 562225,
            "upload_time": "2023-11-13T07:21:41",
            "upload_time_iso_8601": "2023-11-13T07:21:41.839836Z",
            "url": "https://files.pythonhosted.org/packages/de/32/9a2482611eb404e20d8783ffa8f4572d8a39bf5f6e872f126601a7db8358/envoy_data_plane-0.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-13 07:21:41",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "envoy_data_plane"
}
        
Elapsed time: 0.13583s