Beispiel #1
0
 def get_groups():
     """
     Returns a list of all Groups
     """
     groups = DataList({'object': Group,
                        'data': DataList.select.GUIDS,
                        'query': {'type': DataList.where_operator.AND,
                                  'items': []}}).data
     return DataObjectList(groups, Group)
Beispiel #2
0
 def get_brandings():
     """
     Returns a list of all brandings
     """
     brandings = DataList({'object': Branding,
                           'data': DataList.select.GUIDS,
                           'query': {'type': DataList.where_operator.AND,
                                     'items': []}}).data
     return DataObjectList(brandings, Branding)
Beispiel #3
0
 def get_licenses():
     """
     Returns a list of all Licenses
     """
     licenses = DataList({'object': License,
                          'data': DataList.select.GUIDS,
                          'query': {'type': DataList.where_operator.AND,
                                    'items': []}}).data
     return DataObjectList(licenses, License)
Beispiel #4
0
 def get_backend_types():
     """
     Returns a list of all Backends
     """
     backendtypes = DataList({'object': BackendType,
                              'data': DataList.select.GUIDS,
                              'query': {'type': DataList.where_operator.AND,
                                        'items': []}}).data
     return DataObjectList(backendtypes, BackendType)
Beispiel #5
0
 def get_logs():
     """
     Returns a list of all Logs
     """
     logs = DataList({
         'object': Log,
         'data': DataList.select.GUIDS,
         'query': {
             'type': DataList.where_operator.AND,
             'items': []
         }
     }).data
     return DataObjectList(logs, Log)
Beispiel #6
0
 def get_users():
     """
     Returns a list of all Users
     """
     users = DataList({
         'object': User,
         'data': DataList.select.GUIDS,
         'query': {
             'type': DataList.where_operator.AND,
             'items': []
         }
     }).data
     return DataObjectList(users, User)
Beispiel #7
0
 def get_servicetypes():
     """
     Returns a list of all ServiceTypes
     """
     servicetypes = DataList({
         'object': ServiceType,
         'data': DataList.select.GUIDS,
         'query': {
             'type': DataList.where_operator.AND,
             'items': []
         }
     }).data
     return DataObjectList(servicetypes, ServiceType)
 def get_failure_domains():
     """
     Returns a list of all failure domains
     """
     failure_domains = DataList({
         'object': FailureDomain,
         'data': DataList.select.GUIDS,
         'query': {
             'type': DataList.where_operator.AND,
             'items': []
         }
     }).data
     return DataObjectList(failure_domains, FailureDomain)
Beispiel #9
0
 def get_roles_by_codes(codes):
     """
     Returns a list of Roles for a list of codes
     """
     roles = DataList({
         'object': Role,
         'data': DataList.select.GUIDS,
         'query': {
             'type': DataList.where_operator.AND,
             'items': [('code', DataList.operator.IN, codes)]
         }
     }).data  # noqa
     return DataObjectList(roles, Role)
Beispiel #10
0
 def get_roles():
     """
     Returns a list of all Roles
     """
     roles = DataList({
         'object': Role,
         'data': DataList.select.GUIDS,
         'query': {
             'type': DataList.where_operator.AND,
             'items': []
         }
     }).data
     return DataObjectList(roles, Role)
Beispiel #11
0
 def get_by_access_token(access_token):
     """
     Returns a single BearerToken for the given token. Returns None if no BearerToken was found
     """
     tokens = DataList({
         'object': BearerToken,
         'data': DataList.select.GUIDS,
         'query': {
             'type': DataList.where_operator.AND,
             'items':
             [('access_token', DataList.operator.EQUALS, access_token)]
         }
     }).data
     return DataObjectList(tokens, BearerToken)
Beispiel #12
0
 def get_clients():
     """
     Returns a list of all Clients, except internal types
     """
     clients = DataList({
         'object': Client,
         'data': DataList.select.GUIDS,
         'query': {
             'type': DataList.where_operator.AND,
             'items':
             [('ovs_type', DataList.operator.NOT_EQUALS, 'INTERNAL')]
         }
     }).data
     return DataObjectList(clients, Client)
Beispiel #13
0
 def get_by_types(ovs_type, grant_type):
     """
     Returns a list of all internal Clients
     """
     clients = DataList({
         'object': Client,
         'data': DataList.select.GUIDS,
         'query': {
             'type':
             DataList.where_operator.AND,
             'items': [('ovs_type', DataList.operator.EQUALS, ovs_type),
                       ('grant_type', DataList.operator.EQUALS, grant_type)]
         }
     }).data
     return DataObjectList(clients, Client)
Beispiel #14
0
 def get_by_component(component, return_as_list=False):
     """
     Returns a single License for the given name. Returns None if no license was found
     """
     # pylint: disable=line-too-long
     licenses = DataList({'object': License,
                          'data': DataList.select.GUIDS,
                          'query': {'type': DataList.where_operator.AND,
                                    'items': [('component', DataList.operator.EQUALS, component)]}}).data  # noqa
     # pylint: enable=line-too-long
     if return_as_list is True:
         return DataObjectList(licenses, License)
     if len(licenses) == 1:
         return Descriptor(License, licenses[0]).get_object(True)
     return None
Beispiel #15
0
 def get_by_name(name):
     backends = DataList({
         'object': Backend,
         'data': DataList.select.GUIDS,
         'query': {
             'type': DataList.where_operator.AND,
             'items': [('name', DataList.operator.EQUALS, name)]
         }
     }).data
     if backends:
         if len(backends) != 1:
             raise RuntimeError(
                 'Invalid amount of Backends found: {0}'.format(
                     len(backends)))
         return DataObjectList(backends, Backend)[0]
     return None