Validation endpoint
Use the validation
endpoint to validate groups in the
node classifier.
POST /v1/validate/group
Validate groups in the node classifier.
Request format
Key | Definition |
---|---|
name |
The name of the node group, as a string. |
environment |
The
name of the node group's environment. This is optional. If omitted, the default value is
|
environment_trumps |
When a node belongs to two or more groups, this Boolean indicates whether this node
group's environment overrides environments defined by other node groups. This is
optional. If omitted, the default value is |
description |
A string describing the node group. This is optional. If omitted, the node group has no description. |
parent |
The ID of the node group's parent. This is required. |
rule |
The condition that must be satisfied for a node to be classified into this node group. For rule formatting assistance, refer to Forming node classifier API requests. |
variables |
An optional object that defines the names and values
of any top-level variables set by the node group. Supply key-value pairs of variable
names and corresponding variable values. Variable values can be any type of JSON value.
The |
classes |
A required object that
defines the classes to be used by nodes in the node group. The |
type_header='Content-Type: application/json'
cert="$(puppet config print hostcert)"
cacert="$(puppet config print localcacert)"
key="$(puppet config print hostprivkey)"
uri="https://$(puppet config print server):4433/classifier-api/v1/validate/group"
data='{ "name": "My Nodes",
"parent": "00000000-0000-4000-8000-000000000000",
"environment": "production",
"classes": {}
}'
curl --header "$type_header" --cert "$cert" --cacert "$cacert" --key "$key" --request POST "$uri" --data "$data"
Response format
If the group is valid, the service returns a 200 OK
response with
the validated group's information in the body.
Error responses
kind
key. There are several errors you might
encounter with the /v1/validate/group
endpoint:Response code | Message | Description |
---|---|---|
400 Bad Request | schema-violation |
Required keys are missing or the value of any supplied key does not match the required type. |
400 Bad Request | malformed-request |
The request's body could not be parsed as JSON. |
422 Unprocessable Entity | uniqueness-violation |
The request content violates uniqueness constraints. For example, each node group name must be unique within distinct environments. The error response describes the invalid field. |
422 Unprocessable Entity | missing-referents |
Classes or class parameters declared on the node group, or
inherited by the node group from its parent, do not exist in the
specified environment. The error response lists the missing
classes or parameters. The details contains an array of objects, where each
object uses these keys to describe a single missing referent:
|
422 Unprocessable Entity | missing-parent |
The specified parent node group does not exist. |
422 Unprocessable Entity | inheritance-cycle |
The request causes an inheritance cycle. The error response contains a description of the cycle, including a list of the node group names, where each node group is followed by its parent until the first node group is repeated. |