release.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. LatestVersion string `json:"latest_version"`
  17. GitActionConfig *GitActionConfig `json:"git_action_config,omitempty"`
  18. ImageRepoURI string `json:"image_repo_uri"`
  19. }
  20. type GetReleaseResponse Release
  21. type UpdateNotificationConfigRequest struct {
  22. Payload struct {
  23. Enabled bool `json:"enabled"`
  24. Success bool `json:"success"`
  25. Failure bool `json:"failure"`
  26. } `json:"payload"`
  27. }
  28. type CreateReleaseBaseRequest struct {
  29. RepoURL string `schema:"repo_url"`
  30. TemplateName string `json:"template_name" form:"required"`
  31. TemplateVersion string `json:"template_version" form:"required"`
  32. Values map[string]interface{} `json:"values"`
  33. Name string `json:"name" form:"required"`
  34. }
  35. type CreateReleaseRequest struct {
  36. *CreateReleaseBaseRequest
  37. ImageURL string `json:"image_url" form:"required"`
  38. GithubActionConfig *CreateGitActionConfigRequest `json:"github_action_config,omitempty"`
  39. }
  40. type CreateAddonRequest struct {
  41. *CreateReleaseBaseRequest
  42. }
  43. type RollbackReleaseRequest struct {
  44. Revision int `json:"revision" form:"required"`
  45. }
  46. type UpgradeReleaseRequest struct {
  47. Values string `json:"values" form:"required"`
  48. ChartVersion string `json:"version"`
  49. }
  50. type UpdateImageBatchRequest struct {
  51. ImageRepoURI string `json:"image_repo_uri" form:"required"`
  52. Tag string `json:"tag" form:"required"`
  53. }
  54. type GetJobsStatusResponse struct {
  55. Status string `json:"status,omitempty"`
  56. StartTime *metav1.Time `json:"start_time,omitempty"`
  57. }
  58. const URLParamToken URLParam = "token"
  59. type WebhookRequest struct {
  60. Commit string `schema:"commit"`
  61. // NOTICE: deprecated. This field should no longer be used; it is not supported
  62. // internally.
  63. Repository string `schema:"repository"`
  64. }
  65. type GetGHATemplateRequest struct {
  66. ReleaseName string `json:"release_name"`
  67. GithubActionConfig *CreateGitActionConfigRequest `json:"github_action_config" form:"required"`
  68. }
  69. type GetGHATemplateResponse string
  70. type GetReleaseStepsResponse []SubEvent
  71. type SubEvent struct {
  72. EventID string `json:"event_id"`
  73. Name string `json:"name"`
  74. Index int64 `json:"index"`
  75. Status EventStatus `json:"status"`
  76. Info string `json:"info"`
  77. Time int64 `json:"time"`
  78. }
  79. type EventStatus int64
  80. const (
  81. EventStatusSuccess EventStatus = 1
  82. EventStatusInProgress = 2
  83. EventStatusFailed = 3
  84. )
  85. type UpdateReleaseStepsRequest struct {
  86. Event SubEvent `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. }
  102. type GetReleaseAllPodsResponse []v1.Pod