2017-02-23 06:12:16 +01:00
|
|
|
package db
|
2016-04-04 01:10:12 +02:00
|
|
|
|
2016-04-08 21:41:20 +02:00
|
|
|
import (
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
"github.com/ansible-semaphore/semaphore/util"
|
|
|
|
)
|
2016-04-07 14:49:34 +02:00
|
|
|
|
2018-03-27 22:12:47 +02:00
|
|
|
// AccessKey represents a key used to access a machine with ansible from semaphore
|
2016-04-04 01:10:12 +02:00
|
|
|
type AccessKey struct {
|
|
|
|
ID int `db:"id" json:"id"`
|
|
|
|
Name string `db:"name" json:"name" binding:"required"`
|
2018-04-11 20:05:38 +02:00
|
|
|
// 'aws/do/gcloud/ssh'
|
2016-04-04 01:10:12 +02:00
|
|
|
Type string `db:"type" json:"type" binding:"required"`
|
|
|
|
|
|
|
|
ProjectID *int `db:"project_id" json:"project_id"`
|
|
|
|
Key *string `db:"key" json:"key"`
|
|
|
|
Secret *string `db:"secret" json:"secret"`
|
2016-06-17 22:16:46 +02:00
|
|
|
|
|
|
|
Removed bool `db:"removed" json:"removed"`
|
2016-04-04 01:10:12 +02:00
|
|
|
}
|
2016-04-07 14:49:34 +02:00
|
|
|
|
2018-03-27 22:12:47 +02:00
|
|
|
// GetPath returns the location of the access key once written to disk
|
2016-04-08 21:41:20 +02:00
|
|
|
func (key AccessKey) GetPath() string {
|
|
|
|
return util.Config.TmpPath + "/access_key_" + strconv.Itoa(key.ID)
|
|
|
|
}
|