integration.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. package integrations
  2. // IntegrationService is the name of a third-party service
  3. type IntegrationService string
  4. // The list of supported third-party services
  5. const (
  6. GKE IntegrationService = "gke"
  7. EKS IntegrationService = "eks"
  8. Kube IntegrationService = "kube"
  9. GCR IntegrationService = "gcr"
  10. ECR IntegrationService = "ecr"
  11. Github IntegrationService = "github"
  12. Docker IntegrationService = "docker"
  13. )
  14. // PorterIntegration is a supported integration service, specifying an auth
  15. // mechanism and the category of integration. A single service can have multiple
  16. // auth mechanisms. For example, a GKE integration can have both an "oauth" mechanism
  17. // and a "gcp" mechanism:
  18. //
  19. // PorterIntegration{
  20. // AuthMechanism: "oauth",
  21. // Category: "cluster",
  22. // Service: GKE,
  23. // }
  24. //
  25. // PorterIntegration{
  26. // AuthMechanism: "gcp",
  27. // Category: "cluster",
  28. // Service: GKE,
  29. // }
  30. type PorterIntegration struct {
  31. AuthMechanism string `json:"auth_mechanism"`
  32. Category string `json:"category"`
  33. Service IntegrationService `json:"service"`
  34. }
  35. // PorterClusterIntegrations are the supported cluster integrations
  36. var PorterClusterIntegrations = []PorterIntegration{
  37. PorterIntegration{
  38. AuthMechanism: "gcp",
  39. Category: "cluster",
  40. Service: GKE,
  41. },
  42. PorterIntegration{
  43. AuthMechanism: "aws",
  44. Category: "cluster",
  45. Service: EKS,
  46. },
  47. PorterIntegration{
  48. AuthMechanism: "kube",
  49. Category: "cluster",
  50. Service: Kube,
  51. },
  52. }
  53. // PorterRegistryIntegrations are the supported registry integrations
  54. var PorterRegistryIntegrations = []PorterIntegration{
  55. PorterIntegration{
  56. AuthMechanism: "gcp",
  57. Category: "registry",
  58. Service: GCR,
  59. },
  60. PorterIntegration{
  61. AuthMechanism: "aws",
  62. Category: "registry",
  63. Service: ECR,
  64. },
  65. PorterIntegration{
  66. AuthMechanism: "oauth",
  67. Category: "registry",
  68. Service: Docker,
  69. },
  70. }
  71. // PorterRepoIntegrations are the supported repo integrations
  72. var PorterRepoIntegrations = []PorterIntegration{
  73. PorterIntegration{
  74. AuthMechanism: "oauth",
  75. Category: "repo",
  76. Service: Github,
  77. },
  78. }
  79. // ProjectIntegration is the top-level integration object for various integrations.
  80. // Although the integrations are stored in the DB by auth mechanism, the integrations
  81. // are cast to a ProjectIntegration for consolidation before passing on to the client.
  82. type ProjectIntegration struct {
  83. ID uint `json:"id"`
  84. ProjectID uint `json:"project_id"`
  85. AuthMechanism string `json:"auth_mechanism"`
  86. Category string `json:"category"`
  87. Service IntegrationService `json:"service"`
  88. }