示例#1
0
文件: client.py 项目: OakLabsInc/kama
 def list_entities(self, kind=None):
     '''
     Returns an iterable of Entities, optionally filtered by kind.
     '''
     query = kama_pb2.Entity()
     if kind:
         query.kind = kind
     return self.stub.ListEntities(query)
示例#2
0
文件: client.py 项目: OakLabsInc/kama
    def delete_entity(self, uuid):
        '''
        Delete an Entity

        Required permissions:
            entity.delete
        '''
        entity = kama_pb2.Entity()
        entity.uuid = uuid
        return self.stub.DeleteEntity(entity)
示例#3
0
文件: client.py 项目: OakLabsInc/kama
    def get_entity_by_uuid(self, uuid):
        '''
        Queries kama for an Entity with the given UUID

        Required permissions:
            entity.read_attribute
            entity.read_link
            entity.read_permission
        '''
        entity = kama_pb2.Entity()
        entity.uuid = uuid
        return self.stub.GetEntity(entity)
示例#4
0
文件: client.py 项目: OakLabsInc/kama
    def update_entity(self, uuid, name):
        '''
        Rename an existing Entity

        Required permissions:
            entity.set_name
        '''
        entity = kama_pb2.Entity()
        entity.uuid = uuid
        entity.name = name
        new_entity = self.stub.UpdateEntity(entity)
        return new_entity
示例#5
0
文件: client.py 项目: OakLabsInc/kama
    def get_entity(self, kind, name):
        '''
        Queries kama for an Entity with the given kind and name

        Required permissions:
            entity.read_attribute
            entity.read_link
            entity.read_permission
        '''
        entity = kama_pb2.Entity()
        entity.kind = kind
        entity.name = name
        return self.stub.GetEntity(entity)