summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Freudberg <jeremyfreudberg@gmail.com>2018-07-02 16:18:43 -0400
committerJeremy Freudberg <jeremyfreudberg@gmail.com>2018-07-10 11:41:59 -0400
commit90d7d3f369f55413460830a916cf70c60850c6ef (patch)
tree76df8a6c14b51620a2408144bede6f524935f5db
parent296c1833889eea294e53e81774624ea65a399254 (diff)
downloadpython-saharaclient-90d7d3f369f55413460830a916cf70c60850c6ef.tar.gz
Allow S3 credentials in data source create
Do so, in a backwards-compatible way, and not in a way with good UX. Change-Id: I31b53c2e63ec9c28aba45aabab70a6abed1969f3
-rw-r--r--saharaclient/api/data_sources.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/saharaclient/api/data_sources.py b/saharaclient/api/data_sources.py
index d5b8328..93a1efb 100644
--- a/saharaclient/api/data_sources.py
+++ b/saharaclient/api/data_sources.py
@@ -26,7 +26,7 @@ class DataSourceManagerV1(base.ResourceManager):
def create(self, name, description, data_source_type,
url, credential_user=None, credential_pass=None,
- is_public=None, is_protected=None):
+ is_public=None, is_protected=None, s3_credentials=None):
"""Create a Data Source."""
data = {
@@ -34,14 +34,15 @@ class DataSourceManagerV1(base.ResourceManager):
'description': description,
'type': data_source_type,
'url': url,
- 'credentials': {}
}
- self._copy_if_defined(data['credentials'],
+ credentials = {}
+ self._copy_if_defined(credentials,
user=credential_user,
password=credential_pass)
-
+ credentials = credentials or s3_credentials
self._copy_if_defined(data, is_public=is_public,
- is_protected=is_protected)
+ is_protected=is_protected,
+ credentials=credentials)
return self._create('/data-sources', data, 'data_source')