Updating Server Group Memberships

To change server group membership, use the PUT /pools/default/serverGroups HTTP method and URI.

HTTP method and URI

PUT /pools/default/serverGroups?rev=<:number>

PUT /pools/default/serverGroups?rev=<:number> updates the server’s group memberships. In the following examples, the group name is optional. If the group name is provided, it must match the current group name. All servers must be mentioned and all groups must be mentioned. The URI is used to identify the group.

This request moves servers from one server group to another. This request does not permit server group renaming or removal. In this example, the servers for Group 2 are moved to Group 1.

The following is the group information that is needed to update the server and server group memberships:

{
   "groups": [( { ("name": <groupName:string>,)?
   "uri": "/pools/default/serverGroups/"<uuid>,
   "nodes": [(<otpNode>)*]
}
The PUT request is transactional. The request either succeeds completely or fails without impact. If all nodes or groups are not passed, a generic error message: "Bad input" occurs and the server group is removed.

Syntax

curl -d @<inputFile> -X PUT
  -u <administrator>:<password>
  http://<host>:<port>/pools/default/serverGroups?rev=<number>

Example

In this example, a JSON file is used.

curl -d@file.json -X PUT \
  http://Administrator:asdasd@192.168.0.1:8091/pools/default/serverGroups?rev=120137811

In this example, the JSON data is provided on the command line.

curl -v -X PUT \
  -u Administrator:password \
  http://192.168.171.144:8091/pools/default/serverGroups?rev=28418649 \
  -d '{"groups": \
      [{"nodes": [{"otpNode": "ns_1@192.168.171.144"}, \
                  {"otpNode": "ns_1@192.168.171.145"}], \
        "name": "Group 1", \
        "uri": "/pools/default/serverGroups/0"}, \
       {"nodes": [], \
        "name": "Group 2", \
        "uri": "/pools/default/serverGroups/3ca074a8456e1d4940cfa3b7badc1e22"}] }'