Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab68940

Browse files
committed
move logic to enterprise part
2 parentscd3cdcf +1b75a3a commitab68940

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 aboutcustomizing 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 aboutcustomizing 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+
iferr!=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+
iferr!=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 aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp