Client Groups
RRort client group can be created by:
- adding single clients to it;
- dynamic criteria using wildcards.
Managing client groups is done via the API.
The /client-groups
endpoints allow you to create, update, delete and list them.
As listed in the API docs Client Group is defined by:
id
- unique group identifierdescription
- group descriptionparams
- parameters that define which clients belong to a current group.client_ids
- read-only field that is populated on GET requests with IDs of active clients that belong to this group.
Each parameter can be specified by:
exact match of the property (ignoring case). For example,
"params": { "client_id": ["test-win2019-tk01", "qa-lin-ubuntu16"] }
Means only clients with
id
equals totest-win2019-tk01
orqa-lin-ubuntu16
belong to a current group.dynamic criteria using wildcards (ignoring case). For example,
"params": { "os_family": ["linux*", "*win*"] }
Means all clients with
os_family
that starts withlinux
OR that containswin
belong to a current group.NOTE: if few different parameters are given then a client belongs to this group only if client properties match all the given group parameters. If client parameter has multiple values (like
tags
,ipv4
,ipv6
, etc. ) then it belongs to a group if at least one client param matches one of group parameters. For example:"params": { "tag": ["QA", "my-tag*"], "os_family": ["linux*", "ubuntu*"] "labels": { "and": [ "zone:EU", "env:prod1" ] } }
Means clients belong to this group only if all conditions are met:
- has
tag
equals toQA
ORtag
that starts withmy-tag
- its
os_family
starts withlinux
orubuntu
- has a
label
equals tozone:EU
AND alabel
that equals toenv:prod1
Example specifying logical operators:
"params": { "tag": { "and": [ "Linux", "Datacenter 3" ] } }
Means clients belong to this group only if following condition is met: Has a
tag
that equals toLinux
AND atag
that equals toDatacenter 3
. The OR operator can be specified in the same wayTo build a group based on labels use:
"params": { "label": { "and": [ "city:london", "country:UK" ] } }
Matching is case-insensitive on label key and value. Blank spaces around the colon are stripped. Wildcards are supported on the label values only.
Group definitions by labels apply only to labels that don’t have colons in either the key or the value. To avoid unexpected results, it’s recommended not to use colons in label keys and values.
- has
Here are some examples how to manage client groups.
curl -X POST 'http://localhost:3000/api/v1/client-groups' \
-u admin:foobaz \
-H 'Content-Type: application/json' \
--data-raw '{
"id": "group-1",
"description": "This is my super client group.",
"params":
{
"tag": ["QA"],
"os_family": ["linux*", "ubuntu*"]
}
}'
Note all the parameters will be overridden.
curl -X PUT 'http://localhost:3000/api/v1/client-groups/group-1' \
-u admin:foobaz \
-H 'Content-Type: application/json' \
--data-raw '{
"id": "group-1",
"description": "This is my super client group.",
"params":
{
"tag": ["QA", "my-tag*"],
"os_family": ["linux*", "ubuntu*"]
}
}'
curl -s -u admin:foobaz http://localhost:3000/api/v1/client-groups/group-1|jq
{
"data": {
"id": "group-1",
"description": "This is my super client group.",
"params": {
"client_id": null,
"name": null,
"os": null,
"os_arch": null,
"os_family": [
"linux*",
"ubuntu*"
],
"os_kernel": null,
"hostname": null,
"ipv4": null,
"ipv6": null,
"tag": [
"QA",
"my-tag*"
],
"version": null,
"address": null,
"client_auth_id": null
},
"client_ids": [
"qa-lin-ubuntu16",
"qa-lin-ubuntu19",
"qa-lin-ubuntu23"
]
}
}
curl -u admin:foobaz -X DELETE 'http://localhost:3000/api/v1/client-groups/group-1'