State Set Objects#

A State Set is a set of criteria that are used to identify groups of nodes in a given state. The states sets primitive is accessed through the /nodes/waitfor URL, but is otherwise analogous to the other endpoints. Several endpoints provide for the creation and modification of state sets.

Data Fields#

The state set fields are:

name
 Required: The name for the state set

api_state_set
 Required: A dictionary of state-names and their corresponding node-selector

For example, POST /nodes/waitfor allows creation of a new state set. To completely replace the list of states, use the PATCH /nodes/waitfor action with the “states” key.

Additional Endpoints#

Several additional endpoints are available:

GET /nodes/waitfor
    Returns a list of state sets (UIDs) that are currently defined

POST /nodes/waitfor
    Create a new state set with the posted parameters


GET /nodes/waitfor/<NAME>
    Returns detailed information for a given state set (by Name or UID)

PUT /nodes/waitfor/<NAME>
    Update the information for a given state set (by Name or UID)

DELETE /nodes/waitfor/<NAME>
    Deletes a given state set


GET /nodes/waitfor/<NAME>/nodes
    Returns a list of nodes currently in the given state set

Example#

Create a new state set:

curl -X POST https://head1.cluster.local/api/v1/nodes/waitfor \
  --data '{"name":"my_states", “states”: { “red_state”: “index > 10” } }' \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1Ni…"
  {"success": true, "data": "my_states"}

Get the detailed information on a state set:

curl -X GET https://head1.cluster.local/api/v1/nodes/waitfor/my_states \
 -H "Authorization: Bearer eyJhbGciOiJIUzI1Ni…"
 {"success": true, "data": {"red_state": "index>10"}}

Delete the state set:

curl -X DELETE https://head1.cluster.local/api/v1/nodes/waitfor/my_states \
 -H "Authorization: Bearer eyJhbGciOiJIUzI1Ni…"
 {"success": true}