Exchange.Label.User

This artifact watches for new client enrolments and automatically label the client with the required label if the user exists.

This artifact can be the starting point for automatically labeling a machine based on any other property - just change the artifact to watch and the result filter.

#server #event #labels


name: Exchange.Label.User
description: |
   This artifact watches for new client enrolments and automatically
   label the client with the required label if the user exists.

   This artifact can be the starting point for automatically labeling
   a machine based on any other property - just change the artifact to
   watch and the result filter.

   #server #event #labels

type: SERVER_EVENT

parameters:
  - name: Label
    default: MikesBox
  - name: NameRegex
    default: mike

sources:
  - precondition:
      SELECT OS From info() where OS = 'windows'

    query: |
        LET user_flows = SELECT *
        FROM watch_monitoring(artifact="System.Flow.Completion")
        WHERE Flow.artifacts_with_results =~ "Generic.Client.Info/Users"

        LET results = SELECT *,
           label(client_id=ClientId, labels=Label, op="set")
           FROM source(artifact="Generic.Client.Info/Users" ,
                       client_id=ClientId, flow_id=FlowId)
           WHERE Name =~ NameRegex

        SELECT * FROM foreach(row=user_flows, query=results)