2
0

slack.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package integrations
  2. import (
  3. "gorm.io/gorm"
  4. "github.com/porter-dev/porter/api/types"
  5. )
  6. // SlackIntegration is a webhook notifier to a specific channel in a Slack workspace.
  7. type SlackIntegration struct {
  8. gorm.Model
  9. SharedOAuthModel
  10. // The name of the auth mechanism
  11. Client types.OAuthIntegrationClient `json:"client"`
  12. // The id of the user that linked this auth mechanism
  13. UserID uint `json:"user_id"`
  14. // The project that this integration belongs to
  15. ProjectID uint `json:"project_id"`
  16. // The ID for the Slack team
  17. TeamID string
  18. // The name of the Slack team
  19. TeamName string
  20. // The icon url for the Slack team
  21. TeamIconURL string
  22. // The channel name that the Slack app is installed in
  23. Channel string
  24. // The channel id that the Slack app is installed in
  25. ChannelID string
  26. // The URL for configuring the workspace app instance
  27. ConfigurationURL string
  28. // ------------------------------------------------------------------
  29. // All fields below encrypted before storage.
  30. // ------------------------------------------------------------------
  31. // The webhook to call
  32. Webhook []byte
  33. }
  34. func (s *SlackIntegration) ToSlackIntegraionType() *types.SlackIntegration {
  35. return &types.SlackIntegration{
  36. ID: s.ID,
  37. ProjectID: s.ProjectID,
  38. TeamID: s.TeamID,
  39. TeamName: s.TeamName,
  40. TeamIconURL: s.TeamIconURL,
  41. Channel: s.Channel,
  42. ConfigurationURL: s.ConfigurationURL,
  43. }
  44. }