mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 20:35:24 +01:00
62 lines
2.0 KiB
Go
62 lines
2.0 KiB
Go
package bolt
|
|
|
|
import (
|
|
"github.com/ansible-semaphore/semaphore/db"
|
|
)
|
|
|
|
func (d *BoltDb) GetAccessKey(projectID int, accessKeyID int) (db.AccessKey, error) {
|
|
var key db.AccessKey
|
|
err := d.getObject(projectID, db.AccessKeyProps, intObjectID(accessKeyID), &key)
|
|
return key, err
|
|
}
|
|
|
|
func (d *BoltDb) GetAccessKeys(projectID int, params db.RetrieveQueryParams) ([]db.AccessKey, error) {
|
|
var keys []db.AccessKey
|
|
err := d.getObjects(projectID, db.AccessKeyProps, params, nil, &keys)
|
|
return keys, err
|
|
}
|
|
|
|
func (d *BoltDb) UpdateAccessKey(key db.AccessKey) error {
|
|
return d.updateObject(*key.ProjectID, db.AccessKeyProps, key)
|
|
}
|
|
|
|
func (d *BoltDb) CreateAccessKey(key db.AccessKey) (db.AccessKey, error) {
|
|
newKey, err := d.createObject(*key.ProjectID, db.GlobalAccessKeyProps, key)
|
|
return newKey.(db.AccessKey), err
|
|
}
|
|
|
|
func (d *BoltDb) DeleteAccessKey(projectID int, accessKeyID int) error {
|
|
return d.deleteObject(projectID, db.AccessKeyProps, intObjectID(accessKeyID))
|
|
}
|
|
|
|
func (d *BoltDb) DeleteAccessKeySoft(projectID int, accessKeyID int) error {
|
|
return d.deleteObjectSoft(projectID, db.AccessKeyProps, intObjectID(accessKeyID))
|
|
}
|
|
|
|
func (d *BoltDb) GetGlobalAccessKey(accessKeyID int) (key db.AccessKey, err error) {
|
|
err = d.getObject(0, db.GlobalAccessKeyProps, intObjectID(accessKeyID), &key)
|
|
return
|
|
}
|
|
|
|
func (d *BoltDb) GetGlobalAccessKeys(params db.RetrieveQueryParams) (keys []db.AccessKey, err error) {
|
|
err = d.getObjects(0, db.GlobalAccessKeyProps, params, nil, &keys)
|
|
return
|
|
}
|
|
|
|
func (d *BoltDb) UpdateGlobalAccessKey(key db.AccessKey) error {
|
|
return d.updateObject(0, db.AccessKeyProps, key)
|
|
}
|
|
|
|
func (d *BoltDb) CreateGlobalAccessKey(key db.AccessKey) (db.AccessKey, error) {
|
|
newKey, err := d.createObject(0, db.GlobalAccessKeyProps, key)
|
|
return newKey.(db.AccessKey), err
|
|
}
|
|
|
|
func (d *BoltDb) DeleteGlobalAccessKey(accessKeyID int) error {
|
|
return d.deleteObject(0, db.GlobalAccessKeyProps, intObjectID(accessKeyID))
|
|
}
|
|
|
|
func (d *BoltDb) DeleteGlobalAccessKeySoft(accessKeyID int) error {
|
|
return d.deleteObjectSoft(0, db.GlobalAccessKeyProps, intObjectID(accessKeyID))
|
|
}
|