integration.go 3.2 KB

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