2
0

basic.go 906 B

12345678910111213141516171819202122232425262728293031323334
  1. package integrations
  2. import (
  3. "gorm.io/gorm"
  4. "github.com/porter-dev/porter/api/types"
  5. )
  6. // BasicIntegration represents a basic auth mechanism via username/password
  7. type BasicIntegration struct {
  8. gorm.Model
  9. // The id of the user that linked this auth mechanism
  10. UserID uint `json:"user_id"`
  11. // The project that this integration belongs to
  12. ProjectID uint `json:"project_id"`
  13. // ------------------------------------------------------------------
  14. // All fields encrypted before storage.
  15. // ------------------------------------------------------------------
  16. // Username/Password for basic authentication to a cluster
  17. Username []byte `json:"username,omitempty"`
  18. Password []byte `json:"password,omitempty"`
  19. }
  20. func (b *BasicIntegration) ToBasicIntegrationType() *types.BasicIntegration {
  21. return &types.BasicIntegration{
  22. ID: b.ID,
  23. UserID: b.UserID,
  24. ProjectID: b.ProjectID,
  25. }
  26. }