2015-03-19 22:11:42 +00:00
|
|
|
package logical
|
|
|
|
|
2015-04-09 19:14:04 +00:00
|
|
|
import "fmt"
|
2015-03-19 22:11:42 +00:00
|
|
|
|
|
|
|
// Secret represents the secret part of a response.
|
|
|
|
type Secret struct {
|
2015-04-09 19:14:04 +00:00
|
|
|
LeaseOptions
|
|
|
|
|
2015-03-19 22:11:42 +00:00
|
|
|
// 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"`
|
|
|
|
|
2015-04-08 20:35:32 +00:00
|
|
|
// LeaseID is the ID returned to the user to manage this secret.
|
2015-03-19 22:11:42 +00:00
|
|
|
// This is generated by Vault core. Any set value will be ignored.
|
|
|
|
// For requests, this will always be blank.
|
2015-04-08 20:35:32 +00:00
|
|
|
LeaseID string
|
2015-03-19 22:11:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Secret) Validate() error {
|
2015-08-21 00:47:17 +00:00
|
|
|
if s.TTL < 0 {
|
|
|
|
return fmt.Errorf("ttl duration must not be less than zero")
|
2015-03-19 22:11:42 +00:00
|
|
|
}
|
2015-08-21 00:47:17 +00:00
|
|
|
if s.GracePeriod < 0 {
|
|
|
|
return fmt.Errorf("grace period must not be less than zero")
|
2015-03-19 22:11:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Secret) GoString() string {
|
|
|
|
return fmt.Sprintf("*%#v", *s)
|
|
|
|
}
|