integrations.go 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. // GCPIntegrationRepository represents the set of queries on the GCP auth
  56. // mechanism
  57. type GCPIntegrationRepository interface {
  58. CreateGCPIntegration(am *ints.GCPIntegration) (*ints.GCPIntegration, error)
  59. ReadGCPIntegration(projectID, id uint) (*ints.GCPIntegration, error)
  60. ListGCPIntegrationsByProjectID(projectID uint) ([]*ints.GCPIntegration, error)
  61. }
  62. // GithubAppInstallationRepository represents the set of queries for github app installations
  63. type GithubAppInstallationRepository interface {
  64. CreateGithubAppInstallation(am *ints.GithubAppInstallation) (*ints.GithubAppInstallation, error)
  65. ReadGithubAppInstallationByInstallationID(gaID uint) (*ints.GithubAppInstallation, error)
  66. ReadGithubAppInstallationByAccountID(accountID int64) (*ints.GithubAppInstallation, error)
  67. ReadGithubAppInstallationByAccountIDs(accountIDs []int64) ([]*ints.GithubAppInstallation, error)
  68. DeleteGithubAppInstallationByAccountID(accountID int64) error
  69. }