templates.go 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package models
  2. import "helm.sh/helm/v3/pkg/chart"
  3. // PorterChartList is how a chart gets displayed when listed
  4. type PorterChartList struct {
  5. Name string `json:"name"`
  6. Version string `json:"version"`
  7. Description string `json:"description"`
  8. Icon string `json:"icon"`
  9. }
  10. // PorterChartRead is a chart with detailed information and a form for reading
  11. type PorterChartRead struct {
  12. Markdown string `json:"markdown"`
  13. Metadata *chart.Metadata `json:"metadata"`
  14. Values map[string]interface{} `json:"values"`
  15. Form *FormYAML `json:"form"`
  16. }
  17. // FormContext is the target context
  18. type FormContext struct {
  19. Type string `yaml:"type" json:"type"`
  20. Config map[string]string `yaml:"config" json:"config"`
  21. }
  22. // FormTab is a tab rendered in a form
  23. type FormTab struct {
  24. Context *FormContext `yaml:"context" json:"context"`
  25. Name string `yaml:"name" json:"name"`
  26. Label string `yaml:"label" json:"label"`
  27. Sections []*FormSection `yaml:"sections" json:"sections,omitempty"`
  28. }
  29. // FormSection is a section of a form
  30. type FormSection struct {
  31. Context *FormContext `yaml:"context" json:"context"`
  32. Name string `yaml:"name" json:"name"`
  33. ShowIf string `yaml:"show_if" json:"show_if"`
  34. Contents []*FormContent `yaml:"contents" json:"contents,omitempty"`
  35. }
  36. // FormContent is a form's atomic unit
  37. type FormContent struct {
  38. Context *FormContext `yaml:"context" json:"context"`
  39. Type string `yaml:"type" json:"type"`
  40. Label string `yaml:"label" json:"label"`
  41. Required bool `json:"required"`
  42. Name string `yaml:"name,omitempty" json:"name,omitempty"`
  43. Variable string `yaml:"variable,omitempty" json:"variable,omitempty"`
  44. Value interface{} `yaml:"value,omitempty" json:"value,omitempty"`
  45. Settings struct {
  46. Default interface{} `yaml:"default,omitempty" json:"default,omitempty"`
  47. Unit interface{} `yaml:"unit,omitempty" json:"unit,omitempty"`
  48. Options interface{} `yaml:"options,omitempty" json:"options,omitempty"`
  49. Placeholder string `yaml:"placeholder,omitempty" json:"placeholder,omitempty"`
  50. } `yaml:"settings,omitempty" json:"settings,omitempty"`
  51. }
  52. // FormYAML represents a chart's values.yaml form abstraction
  53. type FormYAML struct {
  54. Name string `yaml:"name" json:"name"`
  55. Icon string `yaml:"icon" json:"icon"`
  56. HasSource string `yaml:"hasSource" json:"hasSource"`
  57. Description string `yaml:"description" json:"description"`
  58. Tags []string `yaml:"tags" json:"tags"`
  59. Tabs []*FormTab `yaml:"tabs" json:"tabs,omitempty"`
  60. }