porter_app.go 1.1 KB

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