Commands endpoint
Use the commands
endpoint to unpin specified nodes
from all node groups they’re pinned to.
If you want to unpin one or more nodes from a single node group, use the POST /v1/groups/<id>/unpin endpoint.
To re-pin nodes you've unpinned, use the POST /v1/groups/<id>/pin endpoint.
POST /v1/commands/unpin-from-all
Unpin one or more specific nodes from all node groups they’re pinned to. Unpinning has no effect on nodes that are assigned to node groups via dynamic rules.
Request format
/v1/commands/unpin-from-all
endpoint, the endpoint only removes the specified nodes from groups that you have permission to
view and edit. Because group permissions are applied hierarchically, you must have one of the
following permissions for the parent groups of each group you want to unpin nodes from:- Create, edit, and delete child groups
- Edit child group rules
{"nodes": "foo"}
And this body unpins three
nodes:{"nodes": ["foo", "bar", "baz"]}
type_header= 'Content-Type: application/json'
auth_header="X-Authentication: $(puppet-access show)"
uri="https://$(puppet config print server):4433/classifier-api/v1/commands/unpin-from-all"
data='{"nodes": ["host1.example", "host2.example"]}'
curl --insecure --header "$type_header" --header "$auth_header"--request POST "$uri" --data "$data"
Response format
{"nodes": [{"name": "foo",
"groups": [{"id": "8310b045-c244-4008-88d0-b49573c84d2d",
"name": "Webservers",
"environment": "production"},
{"id": "84b19b51-6db5-4897-9409-a4a3a94b7f09",
"name": "Test",
"environment": "test"}]},
{"name": "bar",
"groups": [{"id": "84b19b51-6db5-4897-9409-a4a3a94b7f09",
"name": "Test",
"environment": "test"}]}]}
{"nodes":
[{"name":"host1.example",
"groups":[{"id":"2d83d860-19b4-4f7b-8b70-e5ee4d8646db","name":"test","environment":"production"}]},
{"name":"host2.example",
"groups":[{"id":"2d83d860-19b4-4f7b-8b70-e5ee4d8646db","name":"test","environment":"production"}]}]}
Error responses
If there is an error, Node classifier API errors provide error information in
the kind
key.
If your request doesn't specify any nodes to unpin, the service returns a 400 Malformed Request response.
If the request body is invalid JSON, is missing the nodes
key,
or contains any keys other than nodes
, the service returns a
400 Malformed Request response.