Server.Utils.DeleteClient

This artifact completely removes a client from the data store.

Be careful with this one: there is no way to recover old data. However, if the client still exists, it will just automatically re-enrol when it next connects. You will still be able to talk to it, it is just that old collected data is deleted.


name: Server.Utils.DeleteClient
description: |
  This artifact completely removes a client from the data store.

  Be careful with this one: there is no way to recover old
  data. However, if the client still exists, it will just
  automatically re-enrol when it next connects. You will still be able
  to talk to it, it is just that old collected data is deleted.

type: SERVER

parameters:
  - name: ClientIdList
    description: A list of client ids to delete.
    default:

  - name: ReallyDoIt
    description: If you really want to delete the client, check this.
    type: bool

sources:
  - query: |
      let clients_list = SELECT ClientId
      FROM parse_records_with_regex(
          accessor="data", file=ClientIdList,
          regex="(?P<ClientId>C\\.[0-9a-z-]+)")
      WHERE log(message="Deleting client " + ClientId)

      SELECT * FROM foreach(row=clients_list,
      query={
         SELECT * FROM client_delete(client_id=ClientId,
            really_do_it=ReallyDoIt)
      })