Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
    def delete_entity(self, uuid):
        '''
        Delete an Entity

        Required permissions:
            entity.delete
        '''
        entity = kama_pb2.Entity()
        entity.uuid = uuid
        return self.stub.DeleteEntity(entity)
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
    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)