| 1213 | } |
| 1214 | |
| 1215 | func (h *httpAPI) Snapshot(ctx context.Context, skipHead bool) (SnapshotResult, error) { |
| 1216 | u := h.client.URL(epSnapshot, nil) |
| 1217 | q := u.Query() |
| 1218 | |
| 1219 | q.Set("skip_head", strconv.FormatBool(skipHead)) |
| 1220 | |
| 1221 | u.RawQuery = q.Encode() |
| 1222 | |
| 1223 | req, err := http.NewRequest(http.MethodPost, u.String(), nil) |
| 1224 | if err != nil { |
| 1225 | return SnapshotResult{}, err |
| 1226 | } |
| 1227 | |
| 1228 | _, body, _, err := h.client.Do(ctx, req) |
| 1229 | if err != nil { |
| 1230 | return SnapshotResult{}, err |
| 1231 | } |
| 1232 | |
| 1233 | var res SnapshotResult |
| 1234 | err = json.Unmarshal(body, &res) |
| 1235 | return res, err |
| 1236 | } |
| 1237 | |
| 1238 | func (h *httpAPI) Rules(ctx context.Context) (RulesResult, error) { |
| 1239 | u := h.client.URL(epRules, nil) |