Create python distribution for onap-sms-client 91/64891/4
authorDileep Ranganathan <dileep.ranganathan@intel.com>
Wed, 5 Sep 2018 13:43:30 +0000 (06:43 -0700)
committerDileep Ranganathan <dileep.ranganathan@intel.com>
Fri, 7 Sep 2018 10:24:33 +0000 (03:24 -0700)
Renamed to onap-sms-client to conform to standard packaging
Created and uploaded onap-sms-client python distribution to PyPI
This will allow onapsmsclient to be installed using pip.

Change-Id: I8ab1137fce5dbb022d54a2c96bc3acdc97d7e63d
Issue-ID: AAF-438
Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com>
sms-client/python/onap-sms-client/LICENSE [new file with mode: 0644]
sms-client/python/onap-sms-client/README.md [new file with mode: 0644]
sms-client/python/onap-sms-client/README.rst [new file with mode: 0644]
sms-client/python/onap-sms-client/onap-sms-client/__init__.py [moved from sms-client/python/sms/__init__.py with 95% similarity]
sms-client/python/onap-sms-client/setup.py [new file with mode: 0644]

diff --git a/sms-client/python/onap-sms-client/LICENSE b/sms-client/python/onap-sms-client/LICENSE
new file mode 100644 (file)
index 0000000..0bb81a6
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# -------------------------------------------------------------------------
+#   Copyright © 2018 Intel Corporation, Inc Intellectual Property
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+# -------------------------------------------------------------------------
+#
diff --git a/sms-client/python/onap-sms-client/README.md b/sms-client/python/onap-sms-client/README.md
new file mode 100644 (file)
index 0000000..d426144
--- /dev/null
@@ -0,0 +1,10 @@
+# ONAP python SMSClient package
+- python-package onap-sms-client client library for using Secret Management Service (SMS) inside ONAP. 
+- Refer https://wiki.onap.org/display/DW/Secret+Management+Service for more details.
+
+-----
+
+## install package
+```bash
+  pip install onap-sms-client
+```
diff --git a/sms-client/python/onap-sms-client/README.rst b/sms-client/python/onap-sms-client/README.rst
new file mode 100644 (file)
index 0000000..07fa8ba
--- /dev/null
@@ -0,0 +1,16 @@
+ONAP python SMSClient package
+=============================
+
+-  python-package onap-sms-client client library for using Secret
+   Management Service (SMS) inside ONAP.
+-  Refer https://wiki.onap.org/display/DW/Secret+Management+Service for
+   more details.
+
+--------------
+
+install package
+---------------
+
+.. code:: bash
+
+      pip install onap-sms-client
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import json
 import requests
 import requests.exceptions
 import urlparse
 
+name = "onap-sms-client"
+
+
 class InvalidRequestException(Exception):
     pass
 
+
 class InternalServerError(Exception):
     pass
 
+
 class UnexpectedError(Exception):
     pass
 
+
 class Client(object):
     """Python Client for Secret Management Service"""
 
@@ -99,7 +104,7 @@ class Client(object):
                 'Accept': "application/json"
             }
 
-        #Verify the server or not based on the cacert argument
+        # Verify the server or not based on the cacert argument
         if self.cacert is None:
             verify = False
         else:
@@ -108,11 +113,11 @@ class Client(object):
         url = urlparse.urljoin(self.base_url, url)
         response = self.session.request(method, url, headers=headers,
                                         allow_redirects=False, verify=verify,
-                                        timeout = self.timeout, **kwargs)
+                                        timeout=self.timeout, **kwargs)
 
         errors = None
         if response.status_code >= 400 and response.status_code < 600:
-            #Request Failed. Raise Exception.
+            # Request Failed. Raise Exception.
             errors = response.text
             self._raiseException(response.status_code, errors)
 
@@ -140,12 +145,11 @@ class Client(object):
             string: UUID of the created domain name
         """
 
-
         domainName = domainName.strip()
         data = {"name": domainName}
         url = self._urlJoin(self._base_api_url, 'domain')
 
-        response = self._request('post', url, json = data)
+        response = self._request('post', url, json=data)
         return response.json()['uuid']
 
     def deleteDomain(self, domainName):
@@ -182,7 +186,6 @@ class Client(object):
         response = self._request('get', url)
         return response.json()['secretnames']
 
-
     def storeSecret(self, domainName, secretName, values):
         """Store a Secret in given Domain
 
@@ -205,7 +208,7 @@ class Client(object):
             raise TypeError('Input values is not a dictionary')
 
         data = {"name": secretName, "values": values}
-        self._request('post', url, json = data)
+        self._request('post', url, json=data)
         return True
 
     def getSecret(self, domainName, secretName):
@@ -245,4 +248,4 @@ class Client(object):
                             'secret', secretName)
 
         self._request('delete', url)
-        return True
\ No newline at end of file
+        return True
diff --git a/sms-client/python/onap-sms-client/setup.py b/sms-client/python/onap-sms-client/setup.py
new file mode 100644 (file)
index 0000000..2adebc7
--- /dev/null
@@ -0,0 +1,36 @@
+# Copyright 2018 Intel Corporation, Inc
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+from setuptools import setup, find_packages
+
+setup(
+
+    name='onap-sms-client',
+    keywords=("secret", "consul", "onap"),
+    description="ONAP python SMS client library",
+    long_description="python-package onap-sms-client client library for using"
+                     " Secret Management Service (SMS) inside ONAP. Refer "
+                     "https://wiki.onap.org/display/DW/Secret+Management+Service for more details.",
+    version="0.0.1",
+    url="https://gerrit.onap.org/r/gitweb?p=aaf%2Fsms.git;a=summary",
+    license="Apache 2",
+    author="Kiran Kamineni",
+    packages=find_packages(),
+    platforms=["all"],
+    classifiers=[
+        "Intended Audience :: Developers",
+        "Programming Language :: Python :: 2.7"
+    ]
+)