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

Method TemplateVersionPresets

codersdk/presets.go:29–40  ·  view source on GitHub ↗

TemplateVersionPresets returns the presets associated with a template version.

(ctx context.Context, templateVersionID uuid.UUID)

Source from the content-addressed store, hash-verified

27
28// TemplateVersionPresets returns the presets associated with a template version.
29func (c *Client) TemplateVersionPresets(ctx context.Context, templateVersionID uuid.UUID) ([]Preset, error) {
30 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templateversions/%s/presets", templateVersionID), nil)
31 if err != nil {
32 return nil, xerrors.Errorf("do request: %w", err)
33 }
34 defer res.Body.Close()
35 if res.StatusCode != http.StatusOK {
36 return nil, ReadBodyAsError(res)
37 }
38 var presets []Preset
39 return presets, json.NewDecoder(res.Body).Decode(&presets)
40}

Callers 14

TestWorkspaceFunction · 0.80
TestPostWorkspaceBuildFunction · 0.80
toolsdk.goFile · 0.80
templatePresetsListMethod · 0.80
TestCreateWithPresetFunction · 0.80
taskCreateMethod · 0.80
CreateMethod · 0.80
TestPrebuildsAutobuildFunction · 0.80

Calls 4

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

Tested by 10

TestWorkspaceFunction · 0.64
TestPostWorkspaceBuildFunction · 0.64
TestCreateWithPresetFunction · 0.64
TestPrebuildsAutobuildFunction · 0.64
TestClaimPrebuildFunction · 0.64