Last active
March 25, 2021 12:26
-
-
Save scudette/1ad7c6847e17e6e26a93664a92bfabd9 to your computer and use it in GitHub Desktop.
Label clients that contain a username.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Custom.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. | |
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment