diff options
Diffstat (limited to 'python-seven2one.spec')
| -rw-r--r-- | python-seven2one.spec | 300 |
1 files changed, 300 insertions, 0 deletions
diff --git a/python-seven2one.spec b/python-seven2one.spec new file mode 100644 index 0000000..66a78c3 --- /dev/null +++ b/python-seven2one.spec @@ -0,0 +1,300 @@ +%global _empty_manifest_terminate_build 0 +Name: python-seven2one +Version: 4.1.4 +Release: 1 +Summary: Functions to interact with the Seven2one TechStack +License: MIT +URL: http://www.seven2one.de +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ed/b9/a22f151f130a876594c8ff3bebea939ce311ea470a2ca27ec9a5ed580b71/seven2one-4.1.4.tar.gz +BuildArch: noarch + +Requires: python3-pandas +Requires: python3-gql +Requires: python3-pytz +Requires: python3-tzlocal +Requires: python3-pyperclip +Requires: python3-loguru +Requires: python3-requests +Requires: python3-requests-toolbelt +Requires: python3-rfc3339 + +%description +# Usage + +## Connect + +```python +from seven2one import * +client = TechStack(host, user, password) + +# More parameters +client = TechStack(host, user, password, copyGraphQLString=True) +``` + +## Logging + +By default the Python lib writes logs to console and to the server the use connects to. + +Configure log levels and server endpoint by environment variables if needed: + +| Variable | Description | Default | +| -------------- | ----------- | ------- | +|LOGLEVEL | Set the log level for console output | 'INFO' | +|LOGLEVEL_SERVER | Set the log level for logs sent to the server (Loki). Log levels are 'ERROR', 'WARNING', 'INFO' and 'DEBUG'. | 'ERROR' | +|LOG_TO_SERVER | Disable logging to Loki server | 'TRUE' | +|LOG_SERVER | Overwrite the log server endpoint if e.g. running inside the same cluster | 'https://{host}/logging/loki/api/v1/push' | + +## Basic read operations + +```python +client.inventories() +client.items('appartments', references=True) +client.inventoryProperties('appartments') +client.propertyList('appartments', references=True, dataTypes=True) +``` + +## Write operations + +### Create inventory + +```python +properties = [ + { + 'dataType': 'DATE_TIME_OFFSET', + 'name': 'fieldDATETIMEOFFSET', + 'nullable': True + }, + { + 'dataType': 'BOOLEAN', + 'name': 'fieldBOOLEAN', + 'nullable': True + } +] + +client.createInventory('testInventory', properties) +``` + +### Add (basic) items + +```python +items = [ + { + "fieldSTRING": "bla", + "fieldDECIMAL": 0, + "fieldLONG": 0, + "fieldINT": 0, + "fieldBOOLEAN": True, + "fieldDATETIME": "2021-09-14T00:00:00.000Z", + "fieldDATETIMEOFFSET": "2021-09-14T00:00:00.000Z" + } +] + +addBasicItems('testInventory', items) + +``` + + +%package -n python3-seven2one +Summary: Functions to interact with the Seven2one TechStack +Provides: python-seven2one +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-seven2one +# Usage + +## Connect + +```python +from seven2one import * +client = TechStack(host, user, password) + +# More parameters +client = TechStack(host, user, password, copyGraphQLString=True) +``` + +## Logging + +By default the Python lib writes logs to console and to the server the use connects to. + +Configure log levels and server endpoint by environment variables if needed: + +| Variable | Description | Default | +| -------------- | ----------- | ------- | +|LOGLEVEL | Set the log level for console output | 'INFO' | +|LOGLEVEL_SERVER | Set the log level for logs sent to the server (Loki). Log levels are 'ERROR', 'WARNING', 'INFO' and 'DEBUG'. | 'ERROR' | +|LOG_TO_SERVER | Disable logging to Loki server | 'TRUE' | +|LOG_SERVER | Overwrite the log server endpoint if e.g. running inside the same cluster | 'https://{host}/logging/loki/api/v1/push' | + +## Basic read operations + +```python +client.inventories() +client.items('appartments', references=True) +client.inventoryProperties('appartments') +client.propertyList('appartments', references=True, dataTypes=True) +``` + +## Write operations + +### Create inventory + +```python +properties = [ + { + 'dataType': 'DATE_TIME_OFFSET', + 'name': 'fieldDATETIMEOFFSET', + 'nullable': True + }, + { + 'dataType': 'BOOLEAN', + 'name': 'fieldBOOLEAN', + 'nullable': True + } +] + +client.createInventory('testInventory', properties) +``` + +### Add (basic) items + +```python +items = [ + { + "fieldSTRING": "bla", + "fieldDECIMAL": 0, + "fieldLONG": 0, + "fieldINT": 0, + "fieldBOOLEAN": True, + "fieldDATETIME": "2021-09-14T00:00:00.000Z", + "fieldDATETIMEOFFSET": "2021-09-14T00:00:00.000Z" + } +] + +addBasicItems('testInventory', items) + +``` + + +%package help +Summary: Development documents and examples for seven2one +Provides: python3-seven2one-doc +%description help +# Usage + +## Connect + +```python +from seven2one import * +client = TechStack(host, user, password) + +# More parameters +client = TechStack(host, user, password, copyGraphQLString=True) +``` + +## Logging + +By default the Python lib writes logs to console and to the server the use connects to. + +Configure log levels and server endpoint by environment variables if needed: + +| Variable | Description | Default | +| -------------- | ----------- | ------- | +|LOGLEVEL | Set the log level for console output | 'INFO' | +|LOGLEVEL_SERVER | Set the log level for logs sent to the server (Loki). Log levels are 'ERROR', 'WARNING', 'INFO' and 'DEBUG'. | 'ERROR' | +|LOG_TO_SERVER | Disable logging to Loki server | 'TRUE' | +|LOG_SERVER | Overwrite the log server endpoint if e.g. running inside the same cluster | 'https://{host}/logging/loki/api/v1/push' | + +## Basic read operations + +```python +client.inventories() +client.items('appartments', references=True) +client.inventoryProperties('appartments') +client.propertyList('appartments', references=True, dataTypes=True) +``` + +## Write operations + +### Create inventory + +```python +properties = [ + { + 'dataType': 'DATE_TIME_OFFSET', + 'name': 'fieldDATETIMEOFFSET', + 'nullable': True + }, + { + 'dataType': 'BOOLEAN', + 'name': 'fieldBOOLEAN', + 'nullable': True + } +] + +client.createInventory('testInventory', properties) +``` + +### Add (basic) items + +```python +items = [ + { + "fieldSTRING": "bla", + "fieldDECIMAL": 0, + "fieldLONG": 0, + "fieldINT": 0, + "fieldBOOLEAN": True, + "fieldDATETIME": "2021-09-14T00:00:00.000Z", + "fieldDATETIMEOFFSET": "2021-09-14T00:00:00.000Z" + } +] + +addBasicItems('testInventory', items) + +``` + + +%prep +%autosetup -n seven2one-4.1.4 + +%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-seven2one -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 4.1.4-1 +- Package Spec generated |
