porter_app.go 928 B

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