types.go 703 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package resource
  2. const DefaultTag = "latest"
  3. type Source struct {
  4. Repository string `json:"repository"`
  5. RawTag string `json:"tag"`
  6. Username string `json:"username"`
  7. Password string `json:"password"`
  8. Debug bool `json:"debug"`
  9. }
  10. func (s Source) Tag() string {
  11. if s.RawTag == "" {
  12. return DefaultTag
  13. }
  14. return s.RawTag
  15. }
  16. type Version struct {
  17. Digest string `json:"digest"`
  18. }
  19. type MetadataField struct {
  20. Name string `json:"name"`
  21. Value string `json:"value"`
  22. }
  23. type GetParams struct {
  24. RawFormat string `json:"format"`
  25. }
  26. func (p GetParams) Format() string {
  27. if p.RawFormat == "" {
  28. return "rootfs"
  29. }
  30. return p.RawFormat
  31. }
  32. type PutParams struct {
  33. Image string `json:"image"`
  34. }