forked from concourse/concourse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manager.go
50 lines (37 loc) · 1.04 KB
/
manager.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package dummy
import (
"encoding/json"
"code.cloudfoundry.org/lager"
"github.com/pf-qiu/concourse/v6/atc/creds"
)
type Manager struct {
Vars []VarFlag `long:"var" description:"A YAML value to expose via credential management. Can be prefixed with a team and/or pipeline to limit scope." value-name:"[TEAM/[PIPELINE/]]VAR=VALUE"`
}
func (manager *Manager) Init(log lager.Logger) error {
return nil
}
func (manager *Manager) MarshalJSON() ([]byte, error) {
health, err := manager.Health()
if err != nil {
return nil, err
}
return json.Marshal(&map[string]interface{}{
"health": health,
})
}
func (manager Manager) IsConfigured() bool {
return len(manager.Vars) > 0
}
func (manager Manager) Validate() error {
return nil
}
func (manager Manager) Health() (*creds.HealthResponse, error) {
return &creds.HealthResponse{
Method: "noop",
}, nil
}
func (manager Manager) Close(logger lager.Logger) {
}
func (manager Manager) NewSecretsFactory(logger lager.Logger) (creds.SecretsFactory, error) {
return NewSecretsFactory(manager.Vars), nil
}