summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/src/lib/user.py
blob: a14d5fc910e08d9fde2bfc71f13b02b7a7010e22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# pylint: skip-file
# flake8: noqa


class UserConfig(object):
    ''' Handle user options '''
    def __init__(self,
                 kubeconfig,
                 username,
                 full_name):
        ''' constructor for handling user options '''
        self.kubeconfig = kubeconfig
        self.username = username
        self.full_name = full_name

        self.data = {}
        self.create_dict()

    def create_dict(self):
        ''' return a user as a dict '''
        self.data['apiVersion'] = 'v1'
        self.data['fullName'] = self.full_name
        self.data['groups'] = None
        self.data['identities'] = None
        self.data['kind'] = 'User'
        self.data['metadata'] = {}
        self.data['metadata']['name'] = self.username


# pylint: disable=too-many-instance-attributes
class User(Yedit):
    ''' Class to wrap the oc command line tools '''
    kind = 'user'

    def __init__(self, content):
        '''User constructor'''
        super(User, self).__init__(content=content)