porter_app.go 1019 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package models
  2. import (
  3. "gorm.io/gorm"
  4. "github.com/porter-dev/porter/api/types"
  5. )
  6. // PorterApp (stack) type that extends gorm.Model
  7. type PorterApp struct {
  8. gorm.Model
  9. ProjectID uint
  10. ClusterID uint
  11. Name string
  12. ImageRepoURI string
  13. // Git repo information (optional)
  14. GitRepoID uint
  15. RepoName string
  16. GitBranch string
  17. BuildContext string
  18. Builder string
  19. Buildpacks string
  20. Dockerfile string
  21. PullRequestURL string
  22. }
  23. // ToPorterAppType generates an external types.PorterApp to be shared over REST
  24. func (a *PorterApp) ToPorterAppType() *types.PorterApp {
  25. return &types.PorterApp{
  26. ID: a.ID,
  27. ProjectID: a.ProjectID,
  28. ClusterID: a.ClusterID,
  29. Name: a.Name,
  30. ImageRepoURI: a.ImageRepoURI,
  31. GitRepoID: a.GitRepoID,
  32. RepoName: a.RepoName,
  33. GitBranch: a.GitBranch,
  34. BuildContext: a.BuildContext,
  35. Builder: a.Builder,
  36. Buildpacks: a.Buildpacks,
  37. Dockerfile: a.Dockerfile,
  38. PullRequestURL: a.PullRequestURL,
  39. }
  40. }