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

Method DeleteTemplate

codersdk/templates.go:341–351  ·  view source on GitHub ↗
(ctx context.Context, template uuid.UUID)

Source from the content-addressed store, hash-verified

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)
343 if err != nil {
344 return err
345 }
346 defer res.Body.Close()
347 if res.StatusCode != http.StatusOK {
348 return ReadBodyAsError(res)
349 }
350 return nil
351}
352
353func (c *Client) UpdateTemplateMeta(ctx context.Context, templateID uuid.UUID, req UpdateTemplateMeta) (Template, error) {
354 res, err := c.Request(ctx, http.MethodPatch, fmt.Sprintf("/api/v2/templates/%s", templateID), req)

Callers 8

TestDeleteTemplateFunction · 0.80
toolsdk.goFile · 0.80
triggerNotificationsFunction · 0.80
templateDeleteMethod · 0.80
RunMethod · 0.80
CleanupMethod · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 3

TestDeleteTemplateFunction · 0.64