From 08c9e3258e736eda5734b14d78eef55aac325130 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Tue, 20 Jun 2023 05:02:52 +0000 Subject: automatic import of python-envoy-data-plane --- .gitignore | 1 + python-envoy-data-plane.spec | 467 +++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 469 insertions(+) create mode 100644 python-envoy-data-plane.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..8ef9e7d 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/envoy_data_plane-0.6.0.tar.gz diff --git a/python-envoy-data-plane.spec b/python-envoy-data-plane.spec new file mode 100644 index 0000000..9be810b --- /dev/null +++ b/python-envoy-data-plane.spec @@ -0,0 +1,467 @@ +%global _empty_manifest_terminate_build 0 +Name: python-envoy-data-plane +Version: 0.6.0 +Release: 1 +Summary: Python dataclasses for the Envoy Data-Plane-API +License: MIT +URL: https://pypi.org/project/envoy-data-plane/ +Source0: https://mirrors.aliyun.com/pypi/web/packages/aa/e0/53a591282cb4d55bbdf2598429080645b548fcf17b8ff281927f4f54e955/envoy_data_plane-0.6.0.tar.gz +BuildArch: noarch + +Requires: python3-betterproto +Requires: python3-grpcio-tools + +%description +# 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@ +``` + +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": [] + } + ] +} + +``` + + +%package -n python3-envoy-data-plane +Summary: Python dataclasses for the Envoy Data-Plane-API +Provides: python-envoy-data-plane +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-envoy-data-plane +# 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@ +``` + +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": [] + } + ] +} + +``` + + +%package help +Summary: Development documents and examples for envoy-data-plane +Provides: python3-envoy-data-plane-doc +%description help +# 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@ +``` + +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": [] + } + ] +} + +``` + + +%prep +%autosetup -n envoy_data_plane-0.6.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-envoy-data-plane -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Jun 20 2023 Python_Bot - 0.6.0-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..da9a2d2 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +3ee22a5fb931c0b895000b23e8e3c9e4 envoy_data_plane-0.6.0.tar.gz -- cgit v1.2.3