2
0

integrations.go 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. package repository
  2. import (
  3. ints "github.com/porter-dev/porter/internal/models/integrations"
  4. )
  5. // KubeIntegrationRepository represents the set of queries on the OIDC auth
  6. // mechanism
  7. type KubeIntegrationRepository interface {
  8. CreateKubeIntegration(am *ints.KubeIntegration) (*ints.KubeIntegration, error)
  9. ReadKubeIntegration(projectID, id uint) (*ints.KubeIntegration, error)
  10. ListKubeIntegrationsByProjectID(projectID uint) ([]*ints.KubeIntegration, error)
  11. }
  12. // BasicIntegrationRepository represents the set of queries on the "basic" auth
  13. // mechanism
  14. type BasicIntegrationRepository interface {
  15. CreateBasicIntegration(am *ints.BasicIntegration) (*ints.BasicIntegration, error)
  16. ReadBasicIntegration(projectID, id uint) (*ints.BasicIntegration, error)
  17. ListBasicIntegrationsByProjectID(projectID uint) ([]*ints.BasicIntegration, error)
  18. DeleteBasicIntegration(am *ints.BasicIntegration) (*ints.BasicIntegration, error)
  19. }
  20. // OIDCIntegrationRepository represents the set of queries on the OIDC auth
  21. // mechanism
  22. type OIDCIntegrationRepository interface {
  23. CreateOIDCIntegration(am *ints.OIDCIntegration) (*ints.OIDCIntegration, error)
  24. ReadOIDCIntegration(projectID, id uint) (*ints.OIDCIntegration, error)
  25. ListOIDCIntegrationsByProjectID(projectID uint) ([]*ints.OIDCIntegration, error)
  26. }
  27. // OAuthIntegrationRepository represents the set of queries on the oauth
  28. // mechanism
  29. type OAuthIntegrationRepository interface {
  30. CreateOAuthIntegration(am *ints.OAuthIntegration) (*ints.OAuthIntegration, error)
  31. ReadOAuthIntegration(projectID, id uint) (*ints.OAuthIntegration, error)
  32. ListOAuthIntegrationsByProjectID(projectID uint) ([]*ints.OAuthIntegration, error)
  33. UpdateOAuthIntegration(am *ints.OAuthIntegration) (*ints.OAuthIntegration, error)
  34. }
  35. // GithubAppOAuthIntegrationRepository represents the set of queries on the oauth
  36. // mechanism
  37. type GithubAppOAuthIntegrationRepository interface {
  38. CreateGithubAppOAuthIntegration(am *ints.GithubAppOAuthIntegration) (*ints.GithubAppOAuthIntegration, error)
  39. ReadGithubAppOauthIntegration(id uint) (*ints.GithubAppOAuthIntegration, error)
  40. UpdateGithubAppOauthIntegration(am *ints.GithubAppOAuthIntegration) (*ints.GithubAppOAuthIntegration, error)
  41. }
  42. // SlackIntegrationRepository represents the set of queries on a Slack integration
  43. type SlackIntegrationRepository interface {
  44. CreateSlackIntegration(slackInt *ints.SlackIntegration) (*ints.SlackIntegration, error)
  45. ListSlackIntegrationsByProjectID(projectID uint) ([]*ints.SlackIntegration, error)
  46. DeleteSlackIntegration(integrationID uint) error
  47. }
  48. // AWSIntegrationRepository represents the set of queries on the AWS auth
  49. // mechanism
  50. type AWSIntegrationRepository interface {
  51. CreateAWSIntegration(am *ints.AWSIntegration) (*ints.AWSIntegration, error)
  52. OverwriteAWSIntegration(am *ints.AWSIntegration) (*ints.AWSIntegration, error)
  53. ReadAWSIntegration(projectID, id uint) (*ints.AWSIntegration, error)
  54. ListAWSIntegrationsByProjectID(projectID uint) ([]*ints.AWSIntegration, error)
  55. }
  56. // AzureIntegrationRepository represents the set of queries on the AWS auth
  57. // mechanism
  58. type AzureIntegrationRepository interface {
  59. CreateAzureIntegration(az *ints.AzureIntegration) (*ints.AzureIntegration, error)
  60. OverwriteAzureIntegration(az *ints.AzureIntegration) (*ints.AzureIntegration, error)
  61. ReadAzureIntegration(projectID, id uint) (*ints.AzureIntegration, error)
  62. ListAzureIntegrationsByProjectID(projectID uint) ([]*ints.AzureIntegration, error)
  63. }
  64. // GCPIntegrationRepository represents the set of queries on the GCP auth
  65. // mechanism
  66. type GCPIntegrationRepository interface {
  67. CreateGCPIntegration(am *ints.GCPIntegration) (*ints.GCPIntegration, error)
  68. ReadGCPIntegration(projectID, id uint) (*ints.GCPIntegration, error)
  69. ListGCPIntegrationsByProjectID(projectID uint) ([]*ints.GCPIntegration, error)
  70. }
  71. // GithubAppInstallationRepository represents the set of queries for github app installations
  72. type GithubAppInstallationRepository interface {
  73. CreateGithubAppInstallation(am *ints.GithubAppInstallation) (*ints.GithubAppInstallation, error)
  74. ReadGithubAppInstallationByInstallationID(gaID uint) (*ints.GithubAppInstallation, error)
  75. ReadGithubAppInstallationByAccountID(accountID int64) (*ints.GithubAppInstallation, error)
  76. ReadGithubAppInstallationByAccountIDs(accountIDs []int64) ([]*ints.GithubAppInstallation, error)
  77. DeleteGithubAppInstallationByAccountID(accountID int64) error
  78. }
  79. // GitlabIntegrationRepository represents the set of queries on the GitlabIntegration model
  80. type GitlabIntegrationRepository interface {
  81. CreateGitlabIntegration(gi *ints.GitlabIntegration) (*ints.GitlabIntegration, error)
  82. ReadGitlabIntegration(projectID, id uint) (*ints.GitlabIntegration, error)
  83. ListGitlabIntegrationsByProjectID(projectID uint) ([]*ints.GitlabIntegration, error)
  84. }
  85. // GitlabAppOAuthIntegrationRepository represents the set of queries on the GitlabOAuthIntegration model
  86. type GitlabAppOAuthIntegrationRepository interface {
  87. CreateGitlabAppOAuthIntegration(gi *ints.GitlabAppOAuthIntegration) (*ints.GitlabAppOAuthIntegration, error)
  88. ReadGitlabAppOAuthIntegration(userID, projectID, integrationID uint) (*ints.GitlabAppOAuthIntegration, error)
  89. }