2
0

integration.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. DOKS IntegrationService = "doks"
  8. GCS IntegrationService = "gcs"
  9. S3 IntegrationService = "s3"
  10. HelmRepo IntegrationService = "helm"
  11. EKS IntegrationService = "eks"
  12. Kube IntegrationService = "kube"
  13. GCR IntegrationService = "gcr"
  14. ECR IntegrationService = "ecr"
  15. DOCR IntegrationService = "docr"
  16. Github IntegrationService = "github"
  17. DockerHub IntegrationService = "dockerhub"
  18. Docker IntegrationService = "docker"
  19. )
  20. // PorterIntegration is a supported integration service, specifying an auth
  21. // mechanism and the category of integration. A single service can have multiple
  22. // auth mechanisms. For example, a GKE integration can have both an "oauth" mechanism
  23. // and a "gcp" mechanism:
  24. //
  25. // PorterIntegration{
  26. // AuthMechanism: "oauth",
  27. // Category: "cluster",
  28. // Service: GKE,
  29. // }
  30. //
  31. // PorterIntegration{
  32. // AuthMechanism: "gcp",
  33. // Category: "cluster",
  34. // Service: GKE,
  35. // }
  36. type PorterIntegration struct {
  37. AuthMechanism string `json:"auth_mechanism"`
  38. Category string `json:"category"`
  39. Service IntegrationService `json:"service"`
  40. }
  41. // PorterClusterIntegrations are the supported cluster integrations
  42. var PorterClusterIntegrations = []PorterIntegration{
  43. PorterIntegration{
  44. AuthMechanism: "gcp",
  45. Category: "cluster",
  46. Service: GKE,
  47. },
  48. PorterIntegration{
  49. AuthMechanism: "aws",
  50. Category: "cluster",
  51. Service: EKS,
  52. },
  53. PorterIntegration{
  54. AuthMechanism: "kube",
  55. Category: "cluster",
  56. Service: Kube,
  57. },
  58. }
  59. // PorterRegistryIntegrations are the supported registry integrations
  60. var PorterRegistryIntegrations = []PorterIntegration{
  61. PorterIntegration{
  62. AuthMechanism: "gcp",
  63. Category: "registry",
  64. Service: GCR,
  65. },
  66. PorterIntegration{
  67. AuthMechanism: "aws",
  68. Category: "registry",
  69. Service: ECR,
  70. },
  71. PorterIntegration{
  72. AuthMechanism: "oauth",
  73. Category: "registry",
  74. Service: Docker,
  75. },
  76. }
  77. // PorterHelmRepoIntegrations are the supported helm repo integrations
  78. var PorterHelmRepoIntegrations = []PorterIntegration{
  79. PorterIntegration{
  80. AuthMechanism: "basic",
  81. Category: "helm",
  82. Service: HelmRepo,
  83. },
  84. PorterIntegration{
  85. AuthMechanism: "gcp",
  86. Category: "helm",
  87. Service: GCS,
  88. },
  89. PorterIntegration{
  90. AuthMechanism: "aws",
  91. Category: "helm",
  92. Service: S3,
  93. },
  94. }
  95. // PorterGitRepoIntegrations are the supported git repo integrations
  96. var PorterGitRepoIntegrations = []PorterIntegration{
  97. PorterIntegration{
  98. AuthMechanism: "oauth",
  99. Category: "repo",
  100. Service: Github,
  101. },
  102. }
  103. // ProjectIntegration is the top-level integration object for various integrations.
  104. // Although the integrations are stored in the DB by auth mechanism, the integrations
  105. // are cast to a ProjectIntegration for consolidation before passing on to the client.
  106. type ProjectIntegration struct {
  107. ID uint `json:"id"`
  108. ProjectID uint `json:"project_id"`
  109. AuthMechanism string `json:"auth_mechanism"`
  110. Category string `json:"category"`
  111. Service IntegrationService `json:"service"`
  112. }