deployment.go 852 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package models
  2. import (
  3. "github.com/porter-dev/porter/api/types"
  4. "gorm.io/gorm"
  5. )
  6. type Environment struct {
  7. gorm.Model
  8. ProjectID uint
  9. ClusterID uint
  10. GitInstallationID uint
  11. Name string
  12. }
  13. func (e *Environment) ToEnvironmentType() *types.Environment {
  14. return &types.Environment{
  15. ID: e.Model.ID,
  16. ProjectID: e.ProjectID,
  17. ClusterID: e.ClusterID,
  18. GitInstallationID: e.GitInstallationID,
  19. Name: e.Name,
  20. }
  21. }
  22. type Deployment struct {
  23. gorm.Model
  24. EnvironmentID uint
  25. Namespace string
  26. Status string
  27. Subdomain string
  28. }
  29. func (d *Deployment) ToDeploymentType() *types.Deployment {
  30. return &types.Deployment{
  31. ID: d.Model.ID,
  32. EnvironmentID: d.EnvironmentID,
  33. Namespace: d.Namespace,
  34. Status: d.Status,
  35. Subdomain: d.Subdomain,
  36. }
  37. }