# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['matrix42sdk', 'matrix42sdk.api_endpoints']

package_data = \
{'': ['*']}

install_requires = \
['mypy<1.0.0', 'pytest>=6.0.0,<7.0.0', 'requests>=2,<3']

setup_kwargs = {
    'name': 'matrix42sdk',
    'version': '3.0.1',
    'description': 'Python SDK for Matrix42 Enterprise Service Management CMBD',
    'long_description': '# Python 3 Matrix42 SDK for Enterprise Service Management (ESM) tool\n\n[![Quality gate](https://sonarcloud.io/api/project_badges/quality_gate?project=dmpe_matrix42sdk)](https://sonarcloud.io/dashboard?id=dmpe_matrix42sdk)\n\n"ERP for Software Asset Management"\n\n[![matrix42sdk package in my-feed feed in Azure Artifacts](https://feeds.dev.azure.com/johnmalc/2efa647f-e5a5-4720-835d-4fc45fde9432/_apis/public/Packaging/Feeds/0c65acb4-f8ae-4df6-9f17-9db0f7687350/Packages/313927f6-82a5-4f2b-9bb0-9b90bcf3cec2/Badge)](https://dev.azure.com/johnmalc/Matrix42SDK/_packaging?_a=package&feed=0c65acb4-f8ae-4df6-9f17-9db0f7687350&package=313927f6-82a5-4f2b-9bb0-9b90bcf3cec2&preferRelease=true)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=dmpe_matrix42sdk&metric=alert_status)](https://sonarcloud.io/dashboard?id=dmpe_matrix42sdk)\n[![Build Status](https://dev.azure.com/johnmalc/Matrix42SDK/_apis/build/status/dmpe.matrix42sdk?branchName=master)](https://dev.azure.com/johnmalc/Matrix42SDK/_build/latest?definitionId=10&branchName=master)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n![GitHub](https://img.shields.io/github/license/dmpe/matrix42sdk)\n![Pull Requests](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg)\n![LGTM Grade](https://img.shields.io/lgtm/grade/python/github/dmpe/matrix42sdk)\n![Requires.io](https://img.shields.io/requires/github/dmpe/matrix42sdk)\n[![Total alerts](https://img.shields.io/lgtm/alerts/g/dmpe/matrix42sdk.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/dmpe/matrix42sdk/alerts/)\n![GitHub repo size](https://img.shields.io/github/repo-size/dmpe/matrix42sdk)\n\n## The background story\n\nAs of July 2020, Matrix42 AG, a German company is offering a [Configuration Management Database (CMBD)](https://www.matrix42.com/en/digital-workspace-management/enterprise-service-management) - basically a competing product to ServiceNOW and many others like Microsoft Intune.\n\nTheir Angular based product can be installed on-prem and used as ITIL supporting tool for the company.\n\nIt provides a REST API which this Python3+ SDK tries to cover.\nUnfortunately, Swagger support is currently not available which has led me to write this client package myself - becoming my first python3 client SDK.\n\nIt shows - also due to learning Python OOP principles.\n\n### Documentation of Rest API\n\n- <https://help.matrix42.com/030_DWP/030_INT> Intro\n- <https://help.matrix42.com/030_DWP/030_INT/Business_Processes_and_API_Integrations> How to use the API\n- <https://help.matrix42.com/030_DWP/030_INT/Business_Processes_and_API_Integrations/Matrix42_Web_Services_API> Matrix42 Approach to the API\n- <https://help.matrix42.com/030_DWP/030_INT/Business_Processes_and_API_Integrations/Web_Services%3A_Authentication_types> Example of AuthN\n- <https://help.matrix42.com/030_DWP/030_INT/Business_Processes_and_API_Integrations/Web_Services_tokens%3A_Generate_API_Token> Generate API Token\n\nSetting up the Sphinx auto-generate documentation:\n\n- <https://samnicholls.net/2016/06/15/how-to-sphinx-readthedocs/>\n\n# What works and what does not?\n\nWorks:\n\n- get and put (i.e. update) fragment\n\nUse Cases:\n\n- updating CI version numbers\n\nSemi/or not working:\n\n- creating fragment was not tested, but is implemented as a Rest API call\n- get and put object -> here not tested extensively and one must expect bugs\n\n# Testing\n\nWithout having a Matrix42 ESM portal which allows API access and is publicly available for unlimited use,\nthe only option how to test this library is to use **your** own ESM portal installation (be it in public cloud or on prem).\nHence the need to use your own API keys, etc.\n\nFrom this follows that this library cannot - as of now - include more python tests, at least not publicly available.\nIt is my recommendation to write your `own, private tests` and report issues here.\n\nSorry for inconvenience!\n\n# Usage\n\n## Python 3 - Simple Testing\n\nUsing `requests` you can call\n\n```\nimport requests\n\nurl = "https://xxxx/m42Services/api/ApiToken/GenerateAccessTokenFromApiToken/"\n\npayload = {}\nheaders = {\n  \'Content-Type\': \'application/json\',\n  \'Authorization\': \'Bearer the \'short\' version of bearer token generated from Administration Panel in the GUI\'\n}\n\nresponse = requests.request("POST", url, headers=headers, data = payload, verify = False)\n\nprint(response.text.encode(\'utf8\'))\n\n# only then start using proper API requests\nimport requests\n\nurl = "https://xxxx/m42Services/api/data/fragments/Ud_SoftwareproduktVersionClassBase/775c82cf-d243-4bfb-a1b2-f3edad93c826"\n\npayload = {}\nheaders = {\n  \'Authorization\': \'Bearer "output of the previous requests "RawToken" \'\n}\n\nresponse = requests.request("GET", url, headers=headers, data = payload)\n\nprint(response.text.encode(\'utf8\'))\n```\n## Matrix42 SDK for Python\n\nTo use Matrix42 SDK, first decide which authN approach you are going to use.\n\nFor a **basic**, create a `Matrix42RestClient` object by using your (or any other matrix42 CMBD) account:\n\n```{python}\nimport matrix42sdk\nfrom matrix42sdk import AuthNClient\nfrom matrix42sdk.api_endpoints import matrix42_objects, matrix42_fragments\n```\n\nFor using `Access/API Tokens`, you can set your `MATRIX42SDK_API_TOKEN` via a shell (**higher priority**):\n\n```{shell}\nexport MATRIX42_URL="xxx"\nexport MATRIX42SDK_API_TOKEN="xxx"\n```\n\nand then:\n\n```{python3}\nmat = matrix42_fragments.GDSFragements()\n```\n\nThen to [get a fragment for a specific CI](https://help.matrix42.com/030_DWP/030_INT/Business_Processes_and_API_Integrations/Public_API_reference_documentation/Fragments_Data_Service%3A_Get_Fragment_data), insert correct parameters according to the documentation:\n\n```\nJUPYTERLAB_ID_FRAG = "8c51cfff-bf16-452e-8d2c-527cc25518c3"\nSYS_ENTITY = "SPSSoftwareType"\nfull_ci_frg = mat.get_fragement(SYS_FRAGEMENT, JUPYTERLAB_ID_FRAG)\n```\n\n## Documentation\n\nWe use <https://sphinx-rtd-theme.readthedocs.io/> and <https://www.sphinx-doc.org/en/master/>\n\n```\ncd docs\nsphinx-apidoc -o source ../matrix42sdk\nmake html\n```\n\n# Building this package yourself\n\nThis package is being build on Azure DevOps services:\n\n<https://dev.azure.com/johnmalc/Matrix42SDK/_build>\n\nand further uses SonarCloud:\n\n<https://sonarcloud.io/dashboard?id=dmpe_matrix42sdk>\n\nUse to install package from non-PyPI feed (the azure one):\n\n```\npip3 install --index https://pkgs.dev.azure.com/johnmalc/Matrix42SDK/_packaging/my-feed/pypi/simple/ matrix42sdk\n```\n\n## PyPI\n\n```\npoetry build\n```\n',
    'author': 'John Malc',
    'author_email': 'cincenko@outlook.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/dmpe/matrix42sdk',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.8,<4.0',
}


setup(**setup_kwargs)
