def index(self, keystone_id, **kw): LOG.debug('Start orders on_get ' 'for tenant-ID {0}:'.format(keystone_id)) result = self.order_repo \ .get_by_create_date(keystone_id, offset_arg=kw.get('offset', 0), limit_arg=kw.get('limit', None), suppress_exception=True) orders, offset, limit, total = result if not orders: orders_resp_overall = {'orders': [], 'total': total} else: orders_resp = [ hrefs.convert_to_hrefs(keystone_id, o.to_dict_fields()) for o in orders ] orders_resp_overall = hrefs.add_nav_hrefs('orders', keystone_id, offset, limit, total, {'orders': orders_resp}) orders_resp_overall.update({'total': total}) return orders_resp_overall
def index(self, keystone_id, **kw): LOG.debug('Start transport_keys on_get') plugin_name = kw.get('plugin_name', None) if plugin_name is not None: plugin_name = urllib.unquote_plus(plugin_name) result = self.repo.get_by_create_date( plugin_name=plugin_name, offset_arg=kw.get('offset', 0), limit_arg=kw.get('limit', None), suppress_exception=True ) transport_keys, offset, limit, total = result if not transport_keys: transport_keys_resp_overall = {'transport_keys': [], 'total': total} else: transport_keys_resp = [ hrefs.convert_transport_key_to_href(keystone_id, s.id) for s in transport_keys ] transport_keys_resp_overall = hrefs.add_nav_hrefs( 'transport_keys', keystone_id, offset, limit, total, {'transport_keys': transport_keys_resp} ) transport_keys_resp_overall.update({'total': total}) return transport_keys_resp_overall
def index(self, keystone_id, **kw): LOG.debug('Start transport_keys on_get') plugin_name = kw.get('plugin_name', None) if plugin_name is not None: plugin_name = urllib.unquote_plus(plugin_name) result = self.repo.get_by_create_date(plugin_name=plugin_name, offset_arg=kw.get('offset', 0), limit_arg=kw.get('limit', None), suppress_exception=True) transport_keys, offset, limit, total = result if not transport_keys: transport_keys_resp_overall = { 'transport_keys': [], 'total': total } else: transport_keys_resp = [ hrefs.convert_transport_key_to_href(keystone_id, s.id) for s in transport_keys ] transport_keys_resp_overall = hrefs.add_nav_hrefs( 'transport_keys', keystone_id, offset, limit, total, {'transport_keys': transport_keys_resp}) transport_keys_resp_overall.update({'total': total}) return transport_keys_resp_overall
def index(self, keystone_id, **kw): LOG.debug('Start secrets on_get ' 'for tenant-ID {0}:'.format(keystone_id)) name = kw.get('name', '') if name: name = urllib.unquote_plus(name) bits = kw.get('bits', 0) try: bits = int(bits) except ValueError: # as per Github issue 171, if bits is invalid then # the default should be used. bits = 0 result = self.secret_repo.get_by_create_date( keystone_id, offset_arg=kw.get('offset', 0), limit_arg=kw.get('limit', None), name=name, alg=kw.get('alg'), mode=kw.get('mode'), bits=bits, suppress_exception=True ) secrets, offset, limit, total = result if not secrets: secrets_resp_overall = {'secrets': [], 'total': total} else: secret_fields = lambda s: mime_types\ .augment_fields_with_content_types(s) secrets_resp = [ hrefs.convert_to_hrefs(keystone_id, secret_fields(s)) for s in secrets ] secrets_resp_overall = hrefs.add_nav_hrefs( 'secrets', keystone_id, offset, limit, total, {'secrets': secrets_resp} ) secrets_resp_overall.update({'total': total}) return secrets_resp_overall