integration.go 3.1 KB

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