integration.go 3.2 KB

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