helm_repo.go 917 B

1234567891011121314151617181920212223242526272829
  1. package forms
  2. import (
  3. "github.com/porter-dev/porter/internal/models"
  4. )
  5. // CreateHelmRepo represents the accepted values for creating a
  6. // helm repo
  7. type CreateHelmRepo struct {
  8. Name string `json:"name" form:"required"`
  9. RepoURL string `json:"repo_url" form:"required"`
  10. ProjectID uint `json:"project_id" form:"required"`
  11. BasicIntegrationID uint `json:"basic_integration_id"`
  12. GCPIntegrationID uint `json:"gcp_integration_id"`
  13. AWSIntegrationID uint `json:"aws_integration_id"`
  14. }
  15. // ToHelmRepo converts the form to a gorm helm repo model
  16. func (ch *CreateHelmRepo) ToHelmRepo() (*models.HelmRepo, error) {
  17. return &models.HelmRepo{
  18. Name: ch.Name,
  19. RepoURL: ch.RepoURL,
  20. ProjectID: ch.ProjectID,
  21. BasicAuthIntegrationID: ch.BasicIntegrationID,
  22. GCPIntegrationID: ch.GCPIntegrationID,
  23. AWSIntegrationID: ch.AWSIntegrationID,
  24. }, nil
  25. }