porter_app.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. // Porter YAML
  23. PorterYamlPath string
  24. EnvironmentConfigID uint
  25. }
  26. // ToPorterAppType generates an external types.PorterApp to be shared over REST
  27. func (a *PorterApp) ToPorterAppType() *types.PorterApp {
  28. return &types.PorterApp{
  29. ID: a.ID,
  30. ProjectID: a.ProjectID,
  31. ClusterID: a.ClusterID,
  32. Name: a.Name,
  33. ImageRepoURI: a.ImageRepoURI,
  34. GitRepoID: a.GitRepoID,
  35. RepoName: a.RepoName,
  36. GitBranch: a.GitBranch,
  37. BuildContext: a.BuildContext,
  38. Builder: a.Builder,
  39. Buildpacks: a.Buildpacks,
  40. Dockerfile: a.Dockerfile,
  41. PullRequestURL: a.PullRequestURL,
  42. PorterYamlPath: a.PorterYamlPath,
  43. }
  44. }