def filter(self, haystack, where):
     result = []
     for item in haystack:
         for key, value in where.items():
             if item[key] == value:
                 result.append(item)
     return response(result, haystack.get_code())
 def filter(self, haystack, where):
     result = []
     for item in haystack:
         for key, value in where.items():
             if item[key] == value:
                 result.append(item)
     return response(result, haystack.get_code())
    def get(self, id, no_summary=False):
        """ List details for a specific tenant id """
        resp = self.client.accounts.get(id)
        if no_summary:
            return self.display(resp)

        results = []
        # Get a list of all volumes for this tenant id
        client = LunrClient(self.get_admin(), debug=self.debug)
        volumes = client.volumes.list(account_id=resp['id'])
        #volumes = self.client.volumes.list(resp['id'])
        for volume in volumes:
            if volume['status'] == 'DELETED':
                continue
            results.append(volume)

        self.display(resp, ['name', 'status', 'last_modified', 'created_at'])
        if results:
            return self.display(response(results, 200),
                                ['id', 'status', 'size'])
        else:
            print("-- This account has no active volumes --")
        print("\nThis is a summary, use --no-summary "
              "to see the entire response")
    def get(self, id, no_summary=False):
        """ List details for a specific tenant id """
        resp = self.client.accounts.get(id)
        if no_summary:
            return self.display(resp)

        results = []
        # Get a list of all volumes for this tenant id
        client = LunrClient(self.get_admin(), debug=self.debug)
        volumes = client.volumes.list(account_id=resp['id'])
        #volumes = self.client.volumes.list(resp['id'])
        for volume in volumes:
            if volume['status'] == 'DELETED':
                continue
            results.append(volume)

        self.display(resp, ['name', 'status', 'last_modified', 'created_at'])
        if results:
            return self.display(response(results, 200),
                                ['id', 'status', 'size'])
        else:
            print("-- This account has no active volumes --")
        print("\nThis is a summary, use --no-summary "
              "to see the entire response")