How to add user to openstack project in keystoneclient api v3 using python -


i using openstack keystoneclient api v3 python bindings way add existing user project role.

you can add user project role below:

from keystoneauth1.identity import v3 keystoneauth1 import session keystoneclient.v3 import client  # admin credentials auth_url = 'http://192.0.0.10:35357/v3' user_id = 'abd78a0b166e47eb8fe40381853f3d90' password = 'password' project_id = '5a56b817ec7342a9a6c0eea26f591621'  auth = v3.password(auth_url=auth_url,  user_id=user_id, password=password, project_id=project_id) sess = session.session(auth=auth) keystone = client.client(session=sess)   # user, role , project details role_id = '7836dac8513745a6be2c9cf5df4640c9' user_id = '7b96131d69b141be8d8d6749ef0e0168' project_id = '121088df9f364c8a92541f969c971b3e'  keystone.roles.grant(role_id, user_id, project_id) 

reference link - https://docs.openstack.org/python-keystoneclient/latest/api/keystoneclient.v3.html#module-keystoneclient.v3.roles


Comments

Popular posts from this blog

Add new key value to json node in java -

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

javascript - Highcharts Synchronized charts with missing data points -