Introduce separate module,state to work with v3 only
This patch introduce new keystonev3 module and state that uses
os_client_config library for authenticaion and raw client to send
requests directly to API.
Since v3 resource structure/resource relation are completely different
we introduce new pillar keystone:client:resources:v3 which will contain
all resources we manage via v3 client.
The module,state implements basic functionality to manage:
* users
* projects
* services
* endpoints
* roles
Other resources will be added in separate patches when needed.
Bootstrap of keystone is done via bootstrap script in server.sls in
Queens as admin token is removed.
Related-Prod: PROD-19148
Change-Id: I10a7cf720955437e3757a1c9699e4a60e1327ba3
diff --git a/_modules/keystonev3/users.py b/_modules/keystonev3/users.py
new file mode 100644
index 0000000..9582eef
--- /dev/null
+++ b/_modules/keystonev3/users.py
@@ -0,0 +1,44 @@
+from keystonev3.common import get_by_name_or_uuid, send
+try:
+ from urllib.parse import urlencode
+except ImportError:
+ from urllib import urlencode
+
+
+@send('get')
+def user_list(**kwargs):
+ url = '/users?{}'.format(urlencode(kwargs))
+ return url, None
+
+
+@get_by_name_or_uuid(user_list, 'users', 'user_id')
+@send('get')
+def user_get_details(user_id, **kwargs):
+ url = '/users/{}?{}'.format(user_id, urlencode(kwargs))
+ return url, None
+
+
+@get_by_name_or_uuid(user_list, 'users', 'user_id')
+@send('patch')
+def user_update(user_id, **kwargs):
+ url = '/users/{}'.format(user_id)
+ json = {
+ 'user': kwargs,
+ }
+ return url, json
+
+
+@get_by_name_or_uuid(user_list, 'users', 'user_id')
+@send('delete')
+def user_delete(user_id, **kwargs):
+ url = '/users/{}'.format(user_id)
+ return url, None
+
+
+@send('post')
+def user_create(**kwargs):
+ url = '/users'
+ json = {
+ 'user': kwargs,
+ }
+ return url, json