git_action.go 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. package forms
  2. import (
  3. "github.com/porter-dev/porter/internal/models"
  4. )
  5. // CreateGitAction represents the accepted values for creating a
  6. // github action integration
  7. type CreateGitAction struct {
  8. ReleaseID uint `json:"release_id" form:"required"`
  9. GitRepo string `json:"git_repo" form:"required"`
  10. ImageRepoURI string `json:"image_repo_uri" form:"required"`
  11. DockerfilePath string `json:"dockerfile_path" form:"required"`
  12. GitRepoID uint `json:"git_repo_id" form:"required"`
  13. }
  14. // ToGitActionConfig converts the form to a gorm git action config model
  15. func (ca *CreateGitAction) ToGitActionConfig() (*models.GitActionConfig, error) {
  16. return &models.GitActionConfig{
  17. ReleaseID: ca.ReleaseID,
  18. GitRepo: ca.GitRepo,
  19. ImageRepoURI: ca.ImageRepoURI,
  20. DockerfilePath: ca.DockerfilePath,
  21. GitRepoID: ca.GitRepoID,
  22. }, nil
  23. }
  24. type CreateGitActionOptional struct {
  25. GitRepo string `json:"git_repo"`
  26. ImageRepoURI string `json:"image_repo_uri"`
  27. DockerfilePath string `json:"dockerfile_path"`
  28. GitRepoID uint `json:"git_repo_id"`
  29. }