-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbackend.go
More file actions
executable file
·49 lines (40 loc) · 988 Bytes
/
backend.go
File metadata and controls
executable file
·49 lines (40 loc) · 988 Bytes
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
package openstack
import (
"context"
"errors"
"strings"
"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/logical"
)
type backend struct {
*framework.Backend
}
var _ logical.Factory = Factory
// Factory configures and returns OpenStack backends.
func Factory(ctx context.Context, conf *logical.BackendConfig) (logical.Backend, error) {
if conf == nil {
return nil, errors.New("configuration passed into backend is nil")
}
b := &backend{}
b.Backend = &framework.Backend{
Help: strings.TrimSpace(openstackHelp),
BackendType: logical.TypeLogical,
Paths: []*framework.Path{
pathConfigAccess(b),
pathConfigLease(b),
pathListRoles(b),
pathRoles(b),
pathCreateCreds(b),
},
Secrets: []*framework.Secret{
secretToken(b),
},
}
if err := b.Setup(ctx, conf); err != nil {
return nil, err
}
return b, nil
}
const openstackHelp = `
The OpenStack secrets backend generates application credentials for OpenStack.
`