client.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. Copyright © The ESO Authors
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. https://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. // Package mysterybox provides a client interface and implementations for Nebius Mysterybox service.
  14. package mysterybox
  15. import "context"
  16. // Client is an interface that contains the main methods to interact with Secret Service.
  17. type Client interface {
  18. GetSecret(ctx context.Context, token, secretID, versionID string) (*Payload, error)
  19. GetSecretByKey(ctx context.Context, token, secretID, versionID, key string) (*PayloadEntry, error)
  20. Close() error
  21. }
  22. // Payload represents a secret version payload returned by the Nebius Mysterybox service.
  23. // It contains the version identifier and the list of key/value entries.
  24. type Payload struct {
  25. VersionID string
  26. Entries []Entry
  27. }
  28. // PayloadEntry represents a single entry from a secret version payload identified by key.
  29. type PayloadEntry struct {
  30. VersionID string
  31. Entry Entry
  32. }
  33. // Entry is a key/value item within a secret payload.
  34. // Only one of StringValue or BinaryValue is expected to be set depending on the secret's data type.
  35. type Entry struct {
  36. Key string
  37. StringValue string
  38. BinaryValue []byte
  39. }