integrations.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. }
  19. // OIDCIntegrationRepository represents the set of queries on the OIDC auth
  20. // mechanism
  21. type OIDCIntegrationRepository interface {
  22. CreateOIDCIntegration(am *ints.OIDCIntegration) (*ints.OIDCIntegration, error)
  23. ReadOIDCIntegration(projectID, id uint) (*ints.OIDCIntegration, error)
  24. ListOIDCIntegrationsByProjectID(projectID uint) ([]*ints.OIDCIntegration, error)
  25. }
  26. // OAuthIntegrationRepository represents the set of queries on the oauth
  27. // mechanism
  28. type OAuthIntegrationRepository interface {
  29. CreateOAuthIntegration(am *ints.OAuthIntegration) (*ints.OAuthIntegration, error)
  30. ReadOAuthIntegration(projectID, id uint) (*ints.OAuthIntegration, error)
  31. ListOAuthIntegrationsByProjectID(projectID uint) ([]*ints.OAuthIntegration, error)
  32. UpdateOAuthIntegration(am *ints.OAuthIntegration) (*ints.OAuthIntegration, error)
  33. }
  34. // GithubAppOAuthIntegrationRepository represents the set of queries on the oauth
  35. // mechanism
  36. type GithubAppOAuthIntegrationRepository interface {
  37. CreateGithubAppOAuthIntegration(am *ints.GithubAppOAuthIntegration) (*ints.GithubAppOAuthIntegration, error)
  38. ReadGithubAppOauthIntegration(id uint) (*ints.GithubAppOAuthIntegration, error)
  39. UpdateGithubAppOauthIntegration(am *ints.GithubAppOAuthIntegration) (*ints.GithubAppOAuthIntegration, error)
  40. }
  41. // SlackIntegrationRepository represents the set of queries on a Slack integration
  42. type SlackIntegrationRepository interface {
  43. CreateSlackIntegration(slackInt *ints.SlackIntegration) (*ints.SlackIntegration, error)
  44. ListSlackIntegrationsByProjectID(projectID uint) ([]*ints.SlackIntegration, error)
  45. DeleteSlackIntegration(integrationID uint) error
  46. }
  47. // AWSIntegrationRepository represents the set of queries on the AWS auth
  48. // mechanism
  49. type AWSIntegrationRepository interface {
  50. CreateAWSIntegration(am *ints.AWSIntegration) (*ints.AWSIntegration, error)
  51. OverwriteAWSIntegration(am *ints.AWSIntegration) (*ints.AWSIntegration, error)
  52. ReadAWSIntegration(projectID, id uint) (*ints.AWSIntegration, error)
  53. ListAWSIntegrationsByProjectID(projectID uint) ([]*ints.AWSIntegration, error)
  54. }
  55. // AzureIntegrationRepository represents the set of queries on the AWS auth
  56. // mechanism
  57. type AzureIntegrationRepository interface {
  58. CreateAzureIntegration(az *ints.AzureIntegration) (*ints.AzureIntegration, error)
  59. OverwriteAzureIntegration(az *ints.AzureIntegration) (*ints.AzureIntegration, error)
  60. ReadAzureIntegration(projectID, id uint) (*ints.AzureIntegration, error)
  61. ListAzureIntegrationsByProjectID(projectID uint) ([]*ints.AzureIntegration, error)
  62. }
  63. // GCPIntegrationRepository represents the set of queries on the GCP auth
  64. // mechanism
  65. type GCPIntegrationRepository interface {
  66. CreateGCPIntegration(am *ints.GCPIntegration) (*ints.GCPIntegration, error)
  67. ReadGCPIntegration(projectID, id uint) (*ints.GCPIntegration, error)
  68. ListGCPIntegrationsByProjectID(projectID uint) ([]*ints.GCPIntegration, error)
  69. }
  70. // GithubAppInstallationRepository represents the set of queries for github app installations
  71. type GithubAppInstallationRepository interface {
  72. CreateGithubAppInstallation(am *ints.GithubAppInstallation) (*ints.GithubAppInstallation, error)
  73. ReadGithubAppInstallationByInstallationID(gaID uint) (*ints.GithubAppInstallation, error)
  74. ReadGithubAppInstallationByAccountID(accountID int64) (*ints.GithubAppInstallation, error)
  75. ReadGithubAppInstallationByAccountIDs(accountIDs []int64) ([]*ints.GithubAppInstallation, error)
  76. DeleteGithubAppInstallationByAccountID(accountID int64) error
  77. }
  78. // GitlabIntegrationRepository represents the set of queries on the GitlabIntegration model
  79. type GitlabIntegrationRepository interface {
  80. CreateGitlabIntegration(gi *ints.GitlabIntegration) (*ints.GitlabIntegration, error)
  81. ReadGitlabIntegration(projectID, id uint) (*ints.GitlabIntegration, error)
  82. ListGitlabIntegrationsByProjectID(projectID uint) ([]*ints.GitlabIntegration, error)
  83. }
  84. // GitlabAppOAuthIntegrationRepository represents the set of queries on the GitlabOAuthIntegration model
  85. type GitlabAppOAuthIntegrationRepository interface {
  86. CreateGitlabAppOAuthIntegration(gi *ints.GitlabAppOAuthIntegration) (*ints.GitlabAppOAuthIntegration, error)
  87. ReadGitlabAppOAuthIntegration(userID, projectID, integrationID uint) (*ints.GitlabAppOAuthIntegration, error)
  88. }