forked from harness/harness
-
Notifications
You must be signed in to change notification settings - Fork 0
/
keys.go
36 lines (27 loc) · 793 Bytes
/
keys.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package store
import (
"github.com/drone/drone/model"
"golang.org/x/net/context"
)
type KeyStore interface {
// Get gets a key by unique repository ID.
Get(*model.Repo) (*model.Key, error)
// Create creates a new key.
Create(*model.Key) error
// Update updates a user key.
Update(*model.Key) error
// Delete deletes a user key.
Delete(*model.Key) error
}
func GetKey(c context.Context, repo *model.Repo) (*model.Key, error) {
return FromContext(c).Keys().Get(repo)
}
func CreateKey(c context.Context, key *model.Key) error {
return FromContext(c).Keys().Create(key)
}
func UpdateKey(c context.Context, key *model.Key) error {
return FromContext(c).Keys().Update(key)
}
func DeleteKey(c context.Context, key *model.Key) error {
return FromContext(c).Keys().Delete(key)
}