basesecret.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package kms
  2. // baseSecret defines the base struct shared among all the secret providers
  3. type baseSecret struct {
  4. Status SecretStatus `json:"status,omitempty"`
  5. Payload string `json:"payload,omitempty"`
  6. Key string `json:"key,omitempty"`
  7. AdditionalData string `json:"additional_data,omitempty"`
  8. // 1 means encrypted using a master key
  9. Mode int `json:"mode,omitempty"`
  10. }
  11. func (s *baseSecret) GetStatus() SecretStatus {
  12. return s.Status
  13. }
  14. func (s *baseSecret) GetPayload() string {
  15. return s.Payload
  16. }
  17. func (s *baseSecret) GetKey() string {
  18. return s.Key
  19. }
  20. func (s *baseSecret) GetMode() int {
  21. return s.Mode
  22. }
  23. func (s *baseSecret) GetAdditionalData() string {
  24. return s.AdditionalData
  25. }
  26. func (s *baseSecret) SetKey(value string) {
  27. s.Key = value
  28. }
  29. func (s *baseSecret) SetAdditionalData(value string) {
  30. s.AdditionalData = value
  31. }
  32. func (s *baseSecret) SetStatus(value SecretStatus) {
  33. s.Status = value
  34. }
  35. func (s *baseSecret) isEmpty() bool {
  36. if s.Status != "" {
  37. return false
  38. }
  39. if s.Payload != "" {
  40. return false
  41. }
  42. if s.Key != "" {
  43. return false
  44. }
  45. if s.AdditionalData != "" {
  46. return false
  47. }
  48. return true
  49. }