user.py 1020 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # pylint: skip-file
  2. # flake8: noqa
  3. class UserConfig(object):
  4. ''' Handle user options '''
  5. def __init__(self,
  6. kubeconfig,
  7. username,
  8. full_name):
  9. ''' constructor for handling user options '''
  10. self.kubeconfig = kubeconfig
  11. self.username = username
  12. self.full_name = full_name
  13. self.data = {}
  14. self.create_dict()
  15. def create_dict(self):
  16. ''' return a user as a dict '''
  17. self.data['apiVersion'] = 'v1'
  18. self.data['fullName'] = self.full_name
  19. self.data['groups'] = None
  20. self.data['identities'] = None
  21. self.data['kind'] = 'User'
  22. self.data['metadata'] = {}
  23. self.data['metadata']['name'] = self.username
  24. # pylint: disable=too-many-instance-attributes
  25. class User(Yedit):
  26. ''' Class to wrap the oc command line tools '''
  27. kind = 'user'
  28. def __init__(self, content):
  29. '''User constructor'''
  30. super(User, self).__init__(content=content)