registry.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package types
  2. import "time"
  3. const (
  4. URLParamRegion URLParam = "region"
  5. )
  6. type Registry struct {
  7. ID uint `json:"id"`
  8. // The project that this integration belongs to
  9. ProjectID uint `json:"project_id"`
  10. // Name of the registry
  11. Name string `json:"name"`
  12. // URL of the registry
  13. URL string `json:"url"`
  14. // The integration service for this registry
  15. Service RegistryService `json:"service"`
  16. // The infra id, if registry was provisioned with Porter
  17. InfraID uint `json:"infra_id"`
  18. }
  19. type RegistryService string
  20. const (
  21. GCR RegistryService = "gcr"
  22. ECR RegistryService = "ecr"
  23. DOCR RegistryService = "docr"
  24. DockerHub RegistryService = "dockerhub"
  25. )
  26. type RegistryListResponse []Registry
  27. type CreateRegistryRequest struct {
  28. URL string `json:"url"`
  29. Name string `json:"name" form:"required"`
  30. GCPIntegrationID uint `json:"gcp_integration_id"`
  31. AWSIntegrationID uint `json:"aws_integration_id"`
  32. DOIntegrationID uint `json:"do_integration_id"`
  33. BasicIntegrationID uint `json:"basic_integration_id"`
  34. }
  35. type CreateRegistryRepositoryRequest struct {
  36. ImageRepoURI string `json:"image_repo_uri" form:"required"`
  37. }
  38. // UpdateRegistryRequest represents the accepted values for updating a
  39. // registry (only name for now)
  40. type UpdateRegistryRequest struct {
  41. Name string `json:"name" form:"required"`
  42. }
  43. type GetRegistryTokenResponse struct {
  44. Token string `json:"token"`
  45. ExpiresAt *time.Time `json:"expires_at"`
  46. }
  47. type GetRegistryGCRTokenRequest struct {
  48. ServerURL string `schema:"server_url"`
  49. }
  50. type GetRegistryECRTokenRequest struct {
  51. Region string `schema:"region"`
  52. }
  53. type GetRegistryDOCRTokenRequest struct {
  54. ServerURL string `schema:"server_url"`
  55. }