Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(secret): use server API types for secret #1209

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/admin/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/database"
"github.com/go-vela/server/util"
"github.com/go-vela/types/library"
)

// swagger:operation PUT /api/v1/admin/secret admin AdminUpdateSecret
Expand Down Expand Up @@ -57,7 +57,7 @@ func UpdateSecret(c *gin.Context) {
l.Debug("platform admin: updating secret")

// capture body from API request
input := new(library.Secret)
input := new(types.Secret)

err := c.Bind(input)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions api/secret/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/api/types/actions"
"github.com/go-vela/server/router/middleware/user"
"github.com/go-vela/server/scm"
"github.com/go-vela/server/secret"
"github.com/go-vela/server/util"
"github.com/go-vela/types/constants"
"github.com/go-vela/types/library"
"github.com/go-vela/types/library/actions"
)

// swagger:operation POST /api/v1/secrets/{engine}/{type}/{org}/{name} secrets CreateSecret
Expand Down Expand Up @@ -175,7 +175,7 @@ func CreateSecret(c *gin.Context) {
logger.Debugf("creating new secret %s for %s service", entry, e)

// capture body from API request
input := new(library.Secret)
input := new(types.Secret)

err := c.Bind(input)
if err != nil {
Expand Down Expand Up @@ -211,7 +211,7 @@ func CreateSecret(c *gin.Context) {

// default event set for secrets
if input.GetAllowEvents().ToDatabase() == 0 {
e := new(library.Events)
e := new(types.Events)

push := new(actions.Push)
push.SetBranch(true)
Expand Down
4 changes: 2 additions & 2 deletions api/secret/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import (
"github.com/sirupsen/logrus"

"github.com/go-vela/server/api"
"github.com/go-vela/server/api/types"
"github.com/go-vela/server/router/middleware/user"
"github.com/go-vela/server/scm"
"github.com/go-vela/server/secret"
"github.com/go-vela/server/util"
"github.com/go-vela/types/constants"
"github.com/go-vela/types/library"
)

// swagger:operation GET /api/v1/secrets/{engine}/{type}/{org}/{name} secrets ListSecrets
Expand Down Expand Up @@ -195,7 +195,7 @@ func ListSecrets(c *gin.Context) {
pagination.SetHeaderLink(c)

// variable we want to return
secrets := []*library.Secret{}
secrets := []*types.Secret{}
// iterate through all secrets
for _, secret := range s {
// https://golang.org/doc/faq#closures_and_goroutines
Expand Down
4 changes: 2 additions & 2 deletions api/secret/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/router/middleware/user"
"github.com/go-vela/server/secret"
"github.com/go-vela/server/util"
"github.com/go-vela/types/constants"
"github.com/go-vela/types/library"
)

//
Expand Down Expand Up @@ -118,7 +118,7 @@ func UpdateSecret(c *gin.Context) {
l.WithFields(fields).Debugf("updating secret %s for %s service", entry, e)

// capture body from API request
input := new(library.Secret)
input := new(types.Secret)

err := c.Bind(input)
if err != nil {
Expand Down
Loading
Loading