diff options
Diffstat (limited to 'python-syneto-api.spec')
| -rw-r--r-- | python-syneto-api.spec | 211 |
1 files changed, 211 insertions, 0 deletions
diff --git a/python-syneto-api.spec b/python-syneto-api.spec new file mode 100644 index 0000000..5e54e18 --- /dev/null +++ b/python-syneto-api.spec @@ -0,0 +1,211 @@ +%global _empty_manifest_terminate_build 0 +Name: python-syneto-api +Version: 0.2.46 +Release: 1 +Summary: Syneto Client API library +License: Proprietary +URL: https://github.com/SynetoNet/syneto-api +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/b2/4c/0679a5e12adf55a9e3050d4ddbdeb79b37b10754a1a985f1456f74b4a4ff/syneto_api-0.2.46.tar.gz +BuildArch: noarch + +Requires: python3-dotenv +Requires: python3-requests[secure] +Requires: python3-inflection +Requires: python3-aiohttp +Requires: python3-aiodns +Requires: python3-cchardet +Requires: python3-tenacity + +%description +# Syneto API + +Syneto Client API library: authentication, storage, virtualization and protection + +# Installation + +``` +$ pip install syneto-api +``` + +# Basic Usage + +``` +from syneto_api import Authentication, Virtualization, Storage, Protection + +auth_api = Authentication(url_base="https://syneto-instance-ip-address/api/auth", insecure_ssl=True) +response = auth_api.login(username="admin", password="admin") +jwt = response['jwt'] + +virt_api = Virtualization(url_base="https://syneto-instance-ip-address/api/virtualization", insecure_ssl=True) +virt_api.set_auth_jwt(jwt) +print(virt_api.get_vms()) + +storage_api = Storage(url_base="https://syneto-instance-ip-address/api/storage", insecure_ssl=True) +storage_api.set_auth_jwt(jwt) +print(storage_api.get_pools()) +``` + +# Environment Variables + +For conveninence, the base urls for the api endpoints are also accepted as environment variables, please see below. + +``` +AUTH_SERVICE=https://syneto-instance-ip-address/api/auth +VIRTUALIZATION_SERVICE=https://syneto-instance-ip-address/api/virtualization +STORAGE_SERVICE=https://syneto-instance-ip-address/api/storage +PROTECTION_SERVICE=https://syneto-instance-ip-address/api/protection +``` + +If you are using self-signed SSL certificates, set the following env. so that the http request library does not perform ssl verification. + +``` +ALLOW_INSECURE_SSL=True +``` + + +%package -n python3-syneto-api +Summary: Syneto Client API library +Provides: python-syneto-api +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-syneto-api +# Syneto API + +Syneto Client API library: authentication, storage, virtualization and protection + +# Installation + +``` +$ pip install syneto-api +``` + +# Basic Usage + +``` +from syneto_api import Authentication, Virtualization, Storage, Protection + +auth_api = Authentication(url_base="https://syneto-instance-ip-address/api/auth", insecure_ssl=True) +response = auth_api.login(username="admin", password="admin") +jwt = response['jwt'] + +virt_api = Virtualization(url_base="https://syneto-instance-ip-address/api/virtualization", insecure_ssl=True) +virt_api.set_auth_jwt(jwt) +print(virt_api.get_vms()) + +storage_api = Storage(url_base="https://syneto-instance-ip-address/api/storage", insecure_ssl=True) +storage_api.set_auth_jwt(jwt) +print(storage_api.get_pools()) +``` + +# Environment Variables + +For conveninence, the base urls for the api endpoints are also accepted as environment variables, please see below. + +``` +AUTH_SERVICE=https://syneto-instance-ip-address/api/auth +VIRTUALIZATION_SERVICE=https://syneto-instance-ip-address/api/virtualization +STORAGE_SERVICE=https://syneto-instance-ip-address/api/storage +PROTECTION_SERVICE=https://syneto-instance-ip-address/api/protection +``` + +If you are using self-signed SSL certificates, set the following env. so that the http request library does not perform ssl verification. + +``` +ALLOW_INSECURE_SSL=True +``` + + +%package help +Summary: Development documents and examples for syneto-api +Provides: python3-syneto-api-doc +%description help +# Syneto API + +Syneto Client API library: authentication, storage, virtualization and protection + +# Installation + +``` +$ pip install syneto-api +``` + +# Basic Usage + +``` +from syneto_api import Authentication, Virtualization, Storage, Protection + +auth_api = Authentication(url_base="https://syneto-instance-ip-address/api/auth", insecure_ssl=True) +response = auth_api.login(username="admin", password="admin") +jwt = response['jwt'] + +virt_api = Virtualization(url_base="https://syneto-instance-ip-address/api/virtualization", insecure_ssl=True) +virt_api.set_auth_jwt(jwt) +print(virt_api.get_vms()) + +storage_api = Storage(url_base="https://syneto-instance-ip-address/api/storage", insecure_ssl=True) +storage_api.set_auth_jwt(jwt) +print(storage_api.get_pools()) +``` + +# Environment Variables + +For conveninence, the base urls for the api endpoints are also accepted as environment variables, please see below. + +``` +AUTH_SERVICE=https://syneto-instance-ip-address/api/auth +VIRTUALIZATION_SERVICE=https://syneto-instance-ip-address/api/virtualization +STORAGE_SERVICE=https://syneto-instance-ip-address/api/storage +PROTECTION_SERVICE=https://syneto-instance-ip-address/api/protection +``` + +If you are using self-signed SSL certificates, set the following env. so that the http request library does not perform ssl verification. + +``` +ALLOW_INSECURE_SSL=True +``` + + +%prep +%autosetup -n syneto-api-0.2.46 + +%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-syneto-api -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.46-1 +- Package Spec generated |
