MCPcopy Create free account
hub / github.com/coder/coder / InvalidateTemplatePresets

Method InvalidateTemplatePresets

codersdk/templates.go:542–558  ·  view source on GitHub ↗

InvalidateTemplatePresets invalidates all presets for the template's active version by setting last_invalidated_at timestamp. The reconciler will then mark these prebuilds as expired and create new ones.

(ctx context.Context, template uuid.UUID)

Source from the content-addressed store, hash-verified

540// template's active version by setting last_invalidated_at timestamp.
541// The reconciler will then mark these prebuilds as expired and create new ones.
542func (c *Client) InvalidateTemplatePresets(ctx context.Context, template uuid.UUID) (InvalidatePresetsResponse, error) {
543 res, err := c.Request(ctx, http.MethodPost,
544 fmt.Sprintf("/api/v2/templates/%s/prebuilds/invalidate", template),
545 nil,
546 )
547 if err != nil {
548 return InvalidatePresetsResponse{}, err
549 }
550 defer res.Body.Close()
551
552 if res.StatusCode != http.StatusOK {
553 return InvalidatePresetsResponse{}, ReadBodyAsError(res)
554 }
555
556 var response InvalidatePresetsResponse
557 return response, json.NewDecoder(res.Body).Decode(&response)
558}

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65