Skip to content
Snippets Groups Projects
Forked from DM / dm-docs
261 commits behind, 746 commits ahead of the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
getUsersCli.py 847 B
#!/usr/bin/env python

from dm.ds_web_service.api.userRestApi import UserRestApi
from dsWebServiceSessionCli import DsWebServiceSessionCli

class GetUsersCli(DsWebServiceSessionCli):
    def __init__(self):
        DsWebServiceSessionCli.__init__(self)

    def runCommand(self):
        self.parseArgs(usage="""
    dm-get-users 

Description:
    Retrieves list of registered users.
        """)
        api = UserRestApi(self.getLoginUsername(), self.getLoginPassword(), self.getServiceHost(), self.getServicePort(), self.getServiceProtocol())
        users = api.getUsers()
        for user in users:
            print user.getDisplayString(self.getDisplayKeys(), self.getDisplayFormat())


#######################################################################
# Run command.
if __name__ == '__main__':
    cli = GetUsersCli()
    cli.run()