release.go 3.3 KB

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