mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-17 17:45:03 +02:00
remove unused code
This commit is contained in:
parent
f2d4cf7be5
commit
754b36d131
@ -1,45 +0,0 @@
|
|||||||
package plugins
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/drone/drone/model"
|
|
||||||
)
|
|
||||||
|
|
||||||
type registryPlugin struct {
|
|
||||||
endpoint string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewRegistry returns a new registry plugin.
|
|
||||||
func NewRegistry(endpoint string) interface{} {
|
|
||||||
return registryPlugin{endpoint}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *registryPlugin) RegistryFind(repo *model.Repo, name string) (*model.Registry, error) {
|
|
||||||
path := fmt.Sprintf("%s/registry/%s/%s/%s", r.endpoint, repo.Owner, repo.Name, name)
|
|
||||||
out := new(model.Registry)
|
|
||||||
err := do("GET", path, nil, out)
|
|
||||||
return out, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *registryPlugin) RegistryList(repo *model.Repo) ([]*model.Registry, error) {
|
|
||||||
path := fmt.Sprintf("%s/registry/%s/%s", r.endpoint, repo.Owner, repo.Name)
|
|
||||||
out := []*model.Registry{}
|
|
||||||
err := do("GET", path, nil, out)
|
|
||||||
return out, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *registryPlugin) RegistryCreate(repo *model.Repo, in *model.Registry) error {
|
|
||||||
path := fmt.Sprintf("%s/registry/%s/%s", r.endpoint, repo.Owner, repo.Name)
|
|
||||||
return do("PATCH", path, in, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *registryPlugin) RegistryUpdate(repo *model.Repo, in *model.Registry) error {
|
|
||||||
path := fmt.Sprintf("%s/registry/%s/%s/%s", r.endpoint, repo.Owner, repo.Name, in.Address)
|
|
||||||
return do("PATCH", path, in, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *registryPlugin) RegistryDelete(repo *model.Repo, name string) error {
|
|
||||||
path := fmt.Sprintf("%s/registry/%s/%s/%s", r.endpoint, repo.Owner, repo.Name, name)
|
|
||||||
return do("DELETE", path, nil, nil)
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
package plugins
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/drone/drone/model"
|
|
||||||
)
|
|
||||||
|
|
||||||
type secretPlugin struct {
|
|
||||||
endpoint string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewSecret returns a new secret plugin.
|
|
||||||
func NewSecret(endpoint string) interface{} {
|
|
||||||
return secretPlugin{endpoint}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *secretPlugin) SecretFind(repo *model.Repo, name string) (*model.Secret, error) {
|
|
||||||
path := fmt.Sprintf("%s/secrets/%s/%s/%s", s.endpoint, repo.Owner, repo.Name, name)
|
|
||||||
out := new(model.Secret)
|
|
||||||
err := do("GET", path, nil, out)
|
|
||||||
return out, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *secretPlugin) SecretList(repo *model.Repo) ([]*model.Secret, error) {
|
|
||||||
path := fmt.Sprintf("%s/secrets/%s/%s", s.endpoint, repo.Owner, repo.Name)
|
|
||||||
out := []*model.Secret{}
|
|
||||||
err := do("GET", path, nil, out)
|
|
||||||
return out, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *secretPlugin) SecretCreate(repo *model.Repo, in *model.Secret) error {
|
|
||||||
path := fmt.Sprintf("%s/secrets/%s/%s", s.endpoint, repo.Owner, repo.Name)
|
|
||||||
return do("POST", path, in, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *secretPlugin) SecretUpdate(repo *model.Repo, in *model.Secret) error {
|
|
||||||
path := fmt.Sprintf("%s/secrets/%s/%s/%s", s.endpoint, repo.Owner, repo.Name, in.Name)
|
|
||||||
return do("PATCH", path, in, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *secretPlugin) SecretDelete(repo *model.Repo, name string) error {
|
|
||||||
path := fmt.Sprintf("%s/secrets/%s/%s/%s", s.endpoint, repo.Owner, repo.Name, name)
|
|
||||||
return do("DELETE", path, nil, nil)
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user