Skip to content

Commit ab68940

Browse files
committed
move logic to enterprise part
2 parents cd3cdcf + 1b75a3a commit ab68940

File tree

4 files changed

+141
-0
lines changed

4 files changed

+141
-0
lines changed

coderd/apidoc/docs.go

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/provisionerkeys.go

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package coderd
2+
3+
import (
4+
"net/http"
5+
6+
"github.com/go-chi/chi/v5"
7+
"github.com/google/uuid"
8+
9+
"github.com/coder/coder/v2/coderd/httpapi"
10+
"github.com/coder/coder/v2/codersdk"
11+
)
12+
13+
// Returns tags from a provisioner key.
14+
// The purpose of this function is to return the provisioner tags
15+
// associated with the provisioner key using the ID.
16+
// @Summary Get provisioner key tags by ID
17+
// @ID get-provisioner-key-tags-by-id
18+
// @Security CoderSessionToken
19+
// @Produce json
20+
// @Tags Provisioner-Keys
21+
// @Param provisionerkeyid path string true "Provisioner Key ID" format(uuid)
22+
// @Success 200 {object} codersdk.ProvisionerKeyTags
23+
// @Router /provisionerkeys/{provisionerkeyid}/tags [get]
24+
func (api *API) provisionerKeyTags(rw http.ResponseWriter, r *http.Request) {
25+
var (
26+
ctx = r.Context()
27+
keyID = chi.URLParam(r, "provisionerkeyid")
28+
)
29+
30+
parsedKeyID, err := uuid.Parse(keyID)
31+
if err != nil {
32+
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
33+
Message: "Invalid provisioner key.",
34+
Detail: err.Error(),
35+
})
36+
return
37+
}
38+
39+
key, err := api.Database.GetProvisionerKeyByID(ctx, parsedKeyID)
40+
if err != nil {
41+
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
42+
Message: "Internal error fetching provisioner tags.",
43+
Detail: err.Error(),
44+
})
45+
return
46+
}
47+
48+
httpapi.Write(ctx, rw, http.StatusOK, codersdk.ProvisionerKeyTags(key.Tags))
49+
}

docs/reference/api/provisioner-keys.md

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy