Run manual diagnostic attachments in the background
This commit is contained in:
1 parent
d845a5e4b6
commit
89ac4d5bcd
40 files changed
+1560
-58
No files matched your search
@@ -684,3 +684,43 @@ func (c *client) PutSubnets(ctx context.Context, in subnetList) (subnetList, err
|
||||
err := c.do(ctx, http.MethodPut, "/api/v1/admin/config/subnets", in, &out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
func (c *client) ListDiagnostics(ctx context.Context) ([]diagnosticDTO, error) {
|
||||
var out []diagnosticDTO
|
||||
err := c.do(ctx, http.MethodGet, "/api/v1/admin/diagnostics", nil, &out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
func (c *client) DiagnosticAttach(ctx context.Context, items []diagnosticAttachItem, note string) ([]diagnosticResult, error) {
|
||||
body := map[string]interface{}{"items": items, "note": note}
|
||||
var out struct {
|
||||
Results []diagnosticResult `json:"results"`
|
||||
}
|
||||
err := c.doLong(ctx, http.MethodPost, "/api/v1/admin/diagnostics/attach", body, &out)
|
||||
return out.Results, err
|
||||
}
|
||||
|
||||
func (c *client) StartDiagnosticOperation(ctx context.Context, id string, items []diagnosticAttachItem, note string) error {
|
||||
body := map[string]interface{}{"id": id, "items": items, "note": note}
|
||||
return c.do(ctx, http.MethodPost, "/api/v1/admin/diagnostics/operations", body, nil)
|
||||
}
|
||||
|
||||
func (c *client) GetDiagnosticOperation(ctx context.Context, id string) (diagnosticOperation, error) {
|
||||
out := diagnosticOperation{ID: id}
|
||||
err := c.do(ctx, http.MethodGet, "/api/v1/admin/diagnostics/operations/"+url.PathEscape(id), nil, &out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
func (c *client) DiagnosticDetach(ctx context.Context, addresses []string, all bool) ([]diagnosticResult, error) {
|
||||
var body map[string]interface{}
|
||||
if all {
|
||||
body = map[string]interface{}{"all": true}
|
||||
} else {
|
||||
body = map[string]interface{}{"addresses": addresses}
|
||||
}
|
||||
var out struct {
|
||||
Results []diagnosticResult `json:"results"`
|
||||
}
|
||||
err := c.doLong(ctx, http.MethodPost, "/api/v1/admin/diagnostics/detach", body, &out)
|
||||
return out.Results, err
|
||||
}
|
||||
Reference in new issue
Block a user