release.go 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. package types
  2. import (
  3. "github.com/stefanmcshane/helm/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. // The ID of this Porter release
  15. ID uint `json:"id"`
  16. // The webhook token used to secure Github repository webhooks
  17. WebhookToken string `json:"webhook_token"`
  18. // The latest version of this Porter release
  19. LatestVersion string `json:"latest_version"`
  20. // Configuration regarding the connected git repository
  21. GitActionConfig *GitActionConfig `json:"git_action_config,omitempty"`
  22. // The complete image repository URI for this release
  23. ImageRepoURI string `json:"image_repo_uri"`
  24. // The build configuration for this release when using buildpacks
  25. BuildConfig *BuildConfig `json:"build_config,omitempty"`
  26. // The list of tags for this release
  27. Tags []string `json:"tags,omitempty"`
  28. // Whether this release is tied to a stack or not
  29. StackID string `json:"stack_id"`
  30. // The canonical name of this release
  31. CanonicalName string `json:"canonical_name"`
  32. }
  33. // swagger:model
  34. type GetReleaseResponse Release
  35. type UpdateNotificationConfigRequest struct {
  36. Payload struct {
  37. Enabled bool `json:"enabled"`
  38. Success bool `json:"success"`
  39. Failure bool `json:"failure"`
  40. } `json:"payload"`
  41. }
  42. type CreateReleaseBaseRequest struct {
  43. // The repository URL for this release
  44. RepoURL string `json:"repo_url,omitempty" schema:"repo_url"`
  45. // the Porter charts templated name
  46. // required: true
  47. TemplateName string `json:"template_name" form:"required"`
  48. // The Porter charts template version
  49. // required: true
  50. TemplateVersion string `json:"template_version" form:"required"`
  51. // The Helm values for this release
  52. Values map[string]interface{} `json:"values"`
  53. // The name of this release
  54. // required: true
  55. Name string `json:"name" form:"required,dns1123"`
  56. }
  57. // swagger:model
  58. type CreateReleaseRequest struct {
  59. *CreateReleaseBaseRequest
  60. // The repository image URL for this release
  61. // required: true
  62. ImageURL string `json:"image_url" form:"required"`
  63. // Configuration regarding the connected git repository
  64. GitActionConfig *CreateGitActionConfigRequest `json:"git_action_config,omitempty"`
  65. // Build configuration options for this release
  66. BuildConfig *CreateBuildConfigRequest `json:"build_config,omitempty"`
  67. // The list of tags for this release
  68. Tags []string `json:"tags,omitempty"`
  69. // The list of synced environment groups for this release
  70. SyncedEnvGroups []string `json:"synced_env_groups,omitempty"`
  71. }
  72. type CreateAddonRequest struct {
  73. *CreateReleaseBaseRequest
  74. HelmRepoID uint `json:"helm_repo_id"`
  75. }
  76. type RollbackReleaseRequest struct {
  77. Revision int `json:"revision" form:"required"`
  78. }
  79. // swagger:model UpdateReleaseRequest
  80. type V1UpgradeReleaseRequest struct {
  81. // The Helm values to upgrade the release with
  82. // required: true
  83. Values map[string]interface{} `json:"values" form:"required"`
  84. // The Porter charts version to upgrade the release with
  85. ChartVersion string `json:"version"`
  86. // (optional) if set, the backend will validate that the user was upgrading from the revision specified by
  87. // LatestRevision, and there hasn't been an upgrade in the meantime.
  88. LatestRevision uint `json:"latest_revision"`
  89. }
  90. type UpgradeReleaseRequest struct {
  91. Values string `json:"values" form:"required"`
  92. ChartVersion string `json:"version"`
  93. // (optional) if set, the backend will validate that the user was upgrading from the revision specified by
  94. // LatestRevision, and there hasn't been an upgrade in the meantime.
  95. LatestRevision uint `json:"latest_revision"`
  96. }
  97. type UpdateImageBatchRequest struct {
  98. ImageRepoURI string `json:"image_repo_uri" form:"required"`
  99. Tag string `json:"tag" form:"required"`
  100. }
  101. type GetJobsStatusResponse struct {
  102. Status string `json:"status,omitempty"`
  103. StartTime *metav1.Time `json:"start_time,omitempty"`
  104. }
  105. const URLParamToken URLParam = "token"
  106. type WebhookRequest struct {
  107. Commit string `schema:"commit"`
  108. // NOTICE: deprecated. This field should no longer be used; it is not supported
  109. // internally.
  110. Repository string `schema:"repository"`
  111. }
  112. type GetGHATemplateRequest struct {
  113. ReleaseName string `json:"release_name"`
  114. GithubActionConfig *CreateGitActionConfigRequest `json:"github_action_config" form:"required"`
  115. }
  116. type GetGHATemplateResponse string
  117. type GetReleaseStepsResponse []SubEvent
  118. type SubEvent struct {
  119. EventID string `json:"event_id"`
  120. Name string `json:"name"`
  121. Index int64 `json:"index"`
  122. Status EventStatus `json:"status"`
  123. Info string `json:"info"`
  124. Time int64 `json:"time"`
  125. }
  126. type EventStatus int64
  127. const (
  128. EventStatusSuccess EventStatus = 1
  129. EventStatusInProgress = 2
  130. EventStatusFailed = 3
  131. )
  132. type UpdateReleaseStepsRequest struct {
  133. Event SubEvent `json:"event" form:"required"`
  134. }
  135. type NotificationConfig struct {
  136. Enabled bool `json:"enabled"`
  137. Success bool `json:"success"`
  138. Failure bool `json:"failure"`
  139. NotifLimit string `json:"notif_limit"`
  140. }
  141. type GetNotificationConfigResponse struct {
  142. *NotificationConfig
  143. }
  144. type DNSRecord struct {
  145. ExternalURL string `json:"external_url"`
  146. Endpoint string `json:"endpoint"`
  147. Hostname string `json:"hostname"`
  148. ClusterID uint `json:"cluster_id"`
  149. }
  150. type GetReleaseAllPodsResponse []v1.Pod
  151. type PatchUpdateReleaseTags struct {
  152. Tags []string `json:"tags"`
  153. }
  154. type PartialGitActionConfig struct {
  155. // The branch to use for the git repository
  156. // required: true
  157. GitBranch string `json:"git_branch" form:"required"`
  158. }
  159. type UpdateGitActionConfigRequest struct {
  160. GitActionConfig *PartialGitActionConfig `json:"git_action_config"`
  161. }
  162. type UpdateCanonicalNameRequest struct {
  163. CanonicalName string `json:"canonical_name"`
  164. }