2020-11-30 20:46:34 +00:00
|
|
|
package kms
|
|
|
|
|
2021-07-13 19:17:21 +00:00
|
|
|
// BaseSecret defines the base struct shared among all the secret providers
|
|
|
|
type BaseSecret struct {
|
2020-11-30 20:46:34 +00:00
|
|
|
Status SecretStatus `json:"status,omitempty"`
|
|
|
|
Payload string `json:"payload,omitempty"`
|
|
|
|
Key string `json:"key,omitempty"`
|
|
|
|
AdditionalData string `json:"additional_data,omitempty"`
|
2020-12-01 21:18:16 +00:00
|
|
|
// 1 means encrypted using a master key
|
|
|
|
Mode int `json:"mode,omitempty"`
|
2020-11-30 20:46:34 +00:00
|
|
|
}
|
|
|
|
|
2021-07-13 19:17:21 +00:00
|
|
|
func (s *BaseSecret) GetStatus() SecretStatus {
|
2020-11-30 20:46:34 +00:00
|
|
|
return s.Status
|
|
|
|
}
|
|
|
|
|
2021-07-13 19:17:21 +00:00
|
|
|
func (s *BaseSecret) GetPayload() string {
|
2020-11-30 20:46:34 +00:00
|
|
|
return s.Payload
|
|
|
|
}
|
|
|
|
|
2021-07-13 19:17:21 +00:00
|
|
|
func (s *BaseSecret) GetKey() string {
|
2020-11-30 20:46:34 +00:00
|
|
|
return s.Key
|
|
|
|
}
|
|
|
|
|
2021-07-13 19:17:21 +00:00
|
|
|
func (s *BaseSecret) GetMode() int {
|
2020-12-01 21:18:16 +00:00
|
|
|
return s.Mode
|
|
|
|
}
|
|
|
|
|
2021-07-13 19:17:21 +00:00
|
|
|
func (s *BaseSecret) GetAdditionalData() string {
|
2020-11-30 20:46:34 +00:00
|
|
|
return s.AdditionalData
|
|
|
|
}
|
|
|
|
|
2021-07-13 19:17:21 +00:00
|
|
|
func (s *BaseSecret) SetKey(value string) {
|
2020-11-30 20:46:34 +00:00
|
|
|
s.Key = value
|
|
|
|
}
|
|
|
|
|
2021-07-13 19:17:21 +00:00
|
|
|
func (s *BaseSecret) SetAdditionalData(value string) {
|
2020-11-30 20:46:34 +00:00
|
|
|
s.AdditionalData = value
|
|
|
|
}
|
|
|
|
|
2021-07-13 19:17:21 +00:00
|
|
|
func (s *BaseSecret) SetStatus(value SecretStatus) {
|
2020-11-30 20:46:34 +00:00
|
|
|
s.Status = value
|
|
|
|
}
|
|
|
|
|
2021-07-13 19:17:21 +00:00
|
|
|
func (s *BaseSecret) isEmpty() bool {
|
2020-11-30 20:46:34 +00:00
|
|
|
if s.Status != "" {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if s.Payload != "" {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if s.Key != "" {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if s.AdditionalData != "" {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|