summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDileep Ranganathan <dileep.ranganathan@intel.com>2018-09-05 06:43:30 -0700
committerDileep Ranganathan <dileep.ranganathan@intel.com>2018-09-07 03:24:33 -0700
commit65a823163f1e59d6dedd812da3782423f93c20fa (patch)
tree71abe38270ed3eec424119e901657786beb9de5d
parent6546bbac701bdff45adb11c7e93236e6736898f6 (diff)
Create python distribution for onap-sms-client
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>
-rw-r--r--sms-client/python/onap-sms-client/LICENSE17
-rw-r--r--sms-client/python/onap-sms-client/README.md10
-rw-r--r--sms-client/python/onap-sms-client/README.rst16
-rw-r--r--sms-client/python/onap-sms-client/onap-sms-client/__init__.py (renamed from sms-client/python/sms/__init__.py)21
-rw-r--r--sms-client/python/onap-sms-client/setup.py36
5 files changed, 91 insertions, 9 deletions
diff --git a/sms-client/python/onap-sms-client/LICENSE b/sms-client/python/onap-sms-client/LICENSE
new file mode 100644
index 0000000..0bb81a6
--- /dev/null
+++ b/sms-client/python/onap-sms-client/LICENSE
@@ -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
index 0000000..d426144
--- /dev/null
+++ b/sms-client/python/onap-sms-client/README.md
@@ -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
index 0000000..07fa8ba
--- /dev/null
+++ b/sms-client/python/onap-sms-client/README.rst
@@ -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
diff --git a/sms-client/python/sms/__init__.py b/sms-client/python/onap-sms-client/onap-sms-client/__init__.py
index 88a7621..6f44006 100644
--- a/sms-client/python/sms/__init__.py
+++ b/sms-client/python/onap-sms-client/onap-sms-client/__init__.py
@@ -12,20 +12,25 @@
# 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
index 0000000..2adebc7
--- /dev/null
+++ b/sms-client/python/onap-sms-client/setup.py
@@ -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"
+ ]
+)