Skip to content

Commit

Permalink
refactor(secret): use server API types for secret
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed Oct 17, 2024
1 parent b0e091f commit 9f7086c
Show file tree
Hide file tree
Showing 62 changed files with 2,152 additions and 473 deletions.
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

0 comments on commit 9f7086c

Please sign in to comment.