X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/29437a08213a7f295b95d9a14226ab41d98c5148..33f8bec994716df827b07bbddb88e5944ff201c1:/sdk/go/arvados/keep_service.go diff --git a/sdk/go/arvados/keep_service.go b/sdk/go/arvados/keep_service.go index a2263d1791..3af7479202 100644 --- a/sdk/go/arvados/keep_service.go +++ b/sdk/go/arvados/keep_service.go @@ -104,6 +104,24 @@ func (s *KeepService) Mounts(c *Client) ([]KeepMount, error) { return mounts, nil } +// Touch updates the timestamp on the given block. +func (s *KeepService) Touch(ctx context.Context, c *Client, blk string) error { + req, err := http.NewRequest("TOUCH", s.url(blk), nil) + if err != nil { + return err + } + resp, err := c.Do(req.WithContext(ctx)) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + body, _ := ioutil.ReadAll(resp.Body) + return fmt.Errorf("%s %s: %s", resp.Proto, resp.Status, body) + } + return nil +} + // Untrash moves/copies the given block out of trash. func (s *KeepService) Untrash(ctx context.Context, c *Client, blk string) error { req, err := http.NewRequest("PUT", s.url("untrash/"+blk), nil)