SetDaemonConfig, given key value pairs, sets the configuration accordingly for a specific node.
(baseParams BaseParams, nodeID string, nvs cos.SimpleKVs, transient ...bool)
| 216 | |
| 217 | // SetDaemonConfig, given key value pairs, sets the configuration accordingly for a specific node. |
| 218 | func SetDaemonConfig(baseParams BaseParams, nodeID string, nvs cos.SimpleKVs, transient ...bool) error { |
| 219 | baseParams.Method = http.MethodPut |
| 220 | query := url.Values{} |
| 221 | for key, val := range nvs { |
| 222 | query.Add(key, val) |
| 223 | } |
| 224 | if len(transient) > 0 { |
| 225 | query.Add(apc.ActTransient, strconv.FormatBool(transient[0])) |
| 226 | } |
| 227 | reqParams := AllocRp() |
| 228 | { |
| 229 | reqParams.BaseParams = baseParams |
| 230 | reqParams.Path = apc.URLPathReverseDaemon.Join(apc.ActSetConfig) |
| 231 | reqParams.Query = query |
| 232 | reqParams.Header = http.Header{apc.HdrNodeID: []string{nodeID}} |
| 233 | } |
| 234 | err := reqParams.DoHTTPRequest() |
| 235 | FreeRp(reqParams) |
| 236 | return err |
| 237 | } |
| 238 | |
| 239 | // ResetDaemonConfig resets the configuration for a specific node to the cluster configuration. |
| 240 | func ResetDaemonConfig(baseParams BaseParams, nodeID string) error { |