forked from hashicorp/vault
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsecret.go
33 lines (26 loc) · 866 Bytes
/
secret.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
package logical
import "fmt"
// Secret represents the secret part of a response.
type Secret struct {
LeaseOptions
// InternalData is JSON-encodable data that is stored with the secret.
// This will be sent back during a Renew/Revoke for storing internal data
// used for those operations.
InternalData map[string]interface{} `json:"internal_data"`
// LeaseID is the ID returned to the user to manage this secret.
// This is generated by Vault core. Any set value will be ignored.
// For requests, this will always be blank.
LeaseID string
}
func (s *Secret) Validate() error {
if s.Lease < 0 {
return fmt.Errorf("lease duration must not be less than zero")
}
if s.LeaseGracePeriod < 0 {
return fmt.Errorf("lease grace period must not be less than zero")
}
return nil
}
func (s *Secret) GoString() string {
return fmt.Sprintf("*%#v", *s)
}