2
0

release.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. package types
  2. import (
  3. "helm.sh/helm/v3/pkg/release"
  4. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  5. )
  6. // Release is a helm release with a form attached
  7. type Release struct {
  8. *release.Release
  9. *PorterRelease
  10. Form *FormYAML `json:"form,omitempty"`
  11. }
  12. type PorterRelease struct {
  13. ID uint `json:"id"`
  14. WebhookToken string `json:"webhook_token"`
  15. GitActionConfig *GitActionConfig `json:"git_action_config,omitempty"`
  16. }
  17. type GetReleaseResponse Release
  18. type UpdateNotificationConfigRequest struct {
  19. Payload struct {
  20. Enabled bool `json:"enabled"`
  21. Success bool `json:"success"`
  22. Failure bool `json:"failure"`
  23. } `json:"payload"`
  24. }
  25. type CreateReleaseBaseRequest struct {
  26. RepoURL string `schema:"repo_url"`
  27. TemplateName string `json:"template_name" form:"required"`
  28. TemplateVersion string `json:"template_version" form:"required"`
  29. Values map[string]interface{} `json:"values"`
  30. Name string `json:"name" form:"required"`
  31. }
  32. type CreateReleaseRequest struct {
  33. *CreateReleaseBaseRequest
  34. ImageURL string `json:"image_url" form:"required"`
  35. GithubActionConfig *CreateGitActionConfigRequest `json:"github_action_config,omitempty"`
  36. }
  37. type CreateAddonRequest struct {
  38. *CreateReleaseBaseRequest
  39. }
  40. type RollbackReleaseRequest struct {
  41. Revision int `json:"revision" form:"required"`
  42. }
  43. type UpgradeReleaseRequest struct {
  44. Values string `json:"values" form:"required"`
  45. ChartVersion string `json:"version"`
  46. }
  47. type UpdateImageBatchRequest struct {
  48. ImageRepoURI string `json:"image_repo_uri" form:"required"`
  49. Tag string `json:"tag" form:"required"`
  50. }
  51. type GetJobsStatusResponse struct {
  52. Status string `json:"status,omitempty"`
  53. StartTime *metav1.Time `json:"start_time,omitempty"`
  54. }
  55. const URLParamToken URLParam = "token"
  56. type WebhookRequest struct {
  57. Commit string `schema:"commit"`
  58. }
  59. type GetGHATemplateRequest struct {
  60. ReleaseName string `json:"release_name"`
  61. GithubActionConfig *CreateGitActionConfigRequest `json:"github_action_config" form:"required"`
  62. }
  63. type GetGHATemplateResponse string
  64. type GetReleaseStepsResponse []SubEvent
  65. type SubEvent struct {
  66. EventID string `json:"event_id"`
  67. Name string `json:"name"`
  68. Index int64 `json:"index"`
  69. Status EventStatus `json:"status"`
  70. Info string `json:"info"`
  71. Time int64 `json:"time"`
  72. }
  73. type EventStatus int64
  74. const (
  75. EventStatusSuccess EventStatus = 1
  76. EventStatusInProgress = 2
  77. EventStatusFailed = 3
  78. )
  79. type UpdateReleaseStepsRequest struct {
  80. Event struct {
  81. ID string `json:"event_id" form:"required"`
  82. Name string `json:"name" form:"required"`
  83. Index int64 `json:"index" form:"required"`
  84. Status EventStatus `json:"status" form:"required"`
  85. Info string `json:"info" form:"required"`
  86. } `json:"event" form:"required"`
  87. }
  88. type NotificationConfig struct {
  89. Enabled bool `json:"enabled"`
  90. Success bool `json:"success"`
  91. Failure bool `json:"failure"`
  92. }
  93. type GetNotificationConfigResponse struct {
  94. *NotificationConfig
  95. }
  96. type DNSRecord struct {
  97. ExternalURL string `json:"external_url"`
  98. Endpoint string `json:"endpoint"`
  99. Hostname string `json:"hostname"`
  100. ClusterID uint `json:"cluster_id"`
  101. }