MCPcopy Index your code
hub / github.com/coder/coder / SetArchiveTemplateVersion

Method SetArchiveTemplateVersion

codersdk/templates.go:322–339  ·  view source on GitHub ↗

nolint:revive

(ctx context.Context, templateVersion uuid.UUID, archive bool)

Source from the content-addressed store, hash-verified

320
321//nolint:revive
322func (c *Client) SetArchiveTemplateVersion(ctx context.Context, templateVersion uuid.UUID, archive bool) error {
323 u := fmt.Sprintf("/api/v2/templateversions/%s", templateVersion.String())
324 if archive {
325 u += "/archive"
326 } else {
327 u += "/unarchive"
328 }
329 res, err := c.Request(ctx, http.MethodPost, u, nil)
330 if err != nil {
331 return err
332 }
333 defer res.Body.Close()
334 if res.StatusCode != http.StatusOK {
335 return ReadBodyAsError(res)
336 }
337
338 return nil
339}
340
341func (c *Client) DeleteTemplate(ctx context.Context, template uuid.UUID) error {
342 res, err := c.Request(ctx, http.MethodDelete, fmt.Sprintf("/api/v2/templates/%s", template), nil)

Callers 4

TestWorkspaceFunction · 0.80

Calls 4

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65
StringMethod · 0.45

Tested by 3

TestWorkspaceFunction · 0.64