project.go 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. package types
  2. // ProjectList type for entries in the api response on GET /projects
  3. type ProjectList struct {
  4. ID uint `json:"id"`
  5. Name string `json:"name"`
  6. // note: all of these fields should be considered deprecated
  7. // in an api response
  8. Roles []Role `json:"roles"`
  9. PreviewEnvsEnabled bool `json:"preview_envs_enabled"`
  10. RDSDatabasesEnabled bool `json:"enable_rds_databases"`
  11. ManagedInfraEnabled bool `json:"managed_infra_enabled"`
  12. APITokensEnabled bool `json:"api_tokens_enabled"`
  13. StacksEnabled bool `json:"stacks_enabled"`
  14. CapiProvisionerEnabled bool `json:"capi_provisioner_enabled"`
  15. DBEnabled bool `json:"db_enabled"`
  16. SimplifiedViewEnabled bool `json:"simplified_view_enabled"`
  17. AzureEnabled bool `json:"azure_enabled"`
  18. HelmValuesEnabled bool `json:"helm_values_enabled"`
  19. MultiCluster bool `json:"multi_cluster"`
  20. FullAddOns bool `json:"full_add_ons"`
  21. EnableReprovision bool `json:"enable_reprovision"`
  22. ValidateApplyV2 bool `json:"validate_apply_v2"`
  23. }
  24. type Project struct {
  25. ID uint `json:"id"`
  26. Name string `json:"name"`
  27. Roles []*Role `json:"roles"`
  28. PreviewEnvsEnabled bool `json:"preview_envs_enabled"`
  29. RDSDatabasesEnabled bool `json:"enable_rds_databases"`
  30. ManagedInfraEnabled bool `json:"managed_infra_enabled"`
  31. APITokensEnabled bool `json:"api_tokens_enabled"`
  32. StacksEnabled bool `json:"stacks_enabled"`
  33. CapiProvisionerEnabled bool `json:"capi_provisioner_enabled"`
  34. DBEnabled bool `json:"db_enabled"`
  35. SimplifiedViewEnabled bool `json:"simplified_view_enabled"`
  36. AzureEnabled bool `json:"azure_enabled"`
  37. HelmValuesEnabled bool `json:"helm_values_enabled"`
  38. MultiCluster bool `json:"multi_cluster"`
  39. FullAddOns bool `json:"full_add_ons"`
  40. EnableReprovision bool `json:"enable_reprovision"`
  41. ValidateApplyV2 bool `json:"validate_apply_v2"`
  42. }
  43. type FeatureFlags struct {
  44. PreviewEnvironmentsEnabled string `json:"preview_environments_enabled,omitempty"`
  45. ManagedInfraEnabled string `json:"managed_infra_enabled,omitempty"`
  46. StacksEnabled string `json:"stacks_enabled,omitempty"`
  47. ManagedDatabasesEnabled string `json:"managed_databases_enabled,omitempty"`
  48. CapiProvisionerEnabled string `json:"capi_provisioner_enabled,omitempty"`
  49. SimplifiedViewEnabled string `json:"simplified_view_enabled,omitempty"`
  50. AzureEnabled bool `json:"azure_enabled,omitempty"`
  51. HelmValuesEnabled bool `json:"helm_values_enabled,omitempty"`
  52. MultiCluster bool `json:"multi_cluster,omitempty"`
  53. FullAddOns bool `json:"full_add_ons,omitempty"`
  54. EnableReprovision bool `json:"enable_reprovision,omitempty"`
  55. ValidateApplyV2 bool `json:"validate_apply_v2"`
  56. }
  57. type CreateProjectRequest struct {
  58. Name string `json:"name" form:"required"`
  59. }
  60. type CreateProjectResponse Project
  61. type CreateProjectRoleRequest struct {
  62. Kind string `json:"kind" form:"required"`
  63. UserID uint `json:"user_id" form:"required"`
  64. }
  65. type ProjectInviteAdminRequest struct{}
  66. type ReadProjectResponse Project
  67. type ListProjectsRequest struct{}
  68. type ListProjectsResponse []Project
  69. type DeleteProjectRequest struct {
  70. Name string `json:"name" form:"required"`
  71. }
  72. type DeleteProjectResponse Project
  73. type ListProjectInfraResponse []*Infra
  74. type GetProjectPolicyResponse []*PolicyDocument
  75. type ListProjectRolesResponse []RoleKind
  76. type Collaborator struct {
  77. ID uint `json:"id"`
  78. Kind string `json:"kind"`
  79. UserID uint `json:"user_id"`
  80. Email string `json:"email"`
  81. ProjectID uint `json:"project_id"`
  82. }
  83. type ListCollaboratorsResponse []*Collaborator
  84. type UpdateRoleRequest struct {
  85. UserID uint `json:"user_id,required"`
  86. Kind string `json:"kind,required"`
  87. }
  88. type UpdateRoleResponse struct {
  89. *Role
  90. }
  91. type DeleteRoleRequest struct {
  92. UserID uint `schema:"user_id,required"`
  93. }
  94. type DeleteRoleResponse struct {
  95. *Role
  96. }
  97. type GetBillingTokenResponse struct {
  98. Token string `json:"token"`
  99. TeamID string `json:"team_id"`
  100. }
  101. type GetProjectBillingResponse struct {
  102. HasBilling bool `json:"has_billing"`
  103. }
  104. type StepEnum string
  105. const (
  106. StepConnectSource StepEnum = "connect_source"
  107. StepGithub StepEnum = "github"
  108. )
  109. type ConnectedSourceType string
  110. const (
  111. ConnectedSourceTypeGithub = "github"
  112. ConnectedSourceTypeDocker = "docker"
  113. )
  114. type OnboardingData struct {
  115. CurrentStep StepEnum `json:"current_step"`
  116. ConnectedSource ConnectedSourceType `json:"connected_source"`
  117. SkipRegistryConnection bool `json:"skip_registry_connection"`
  118. SkipResourceProvision bool `json:"skip_resource_provision"`
  119. RegistryConnectionID uint `json:"registry_connection_id"`
  120. RegistryConnectionCredentialID uint `json:"registry_connection_credential_id"`
  121. RegistryConnectionProvider string `json:"registry_connection_provider"`
  122. RegistryInfraID uint `json:"registry_infra_id"`
  123. RegistryInfraCredentialID uint `json:"registry_infra_credential_id"`
  124. RegistryInfraProvider string `json:"registry_infra_provider"`
  125. ClusterInfraID uint `json:"cluster_infra_id"`
  126. ClusterInfraCredentialID uint `json:"cluster_infra_credential_id"`
  127. ClusterInfraProvider string `json:"cluster_infra_provider"`
  128. }
  129. type UpdateOnboardingRequest OnboardingData
  130. type UpdateOnboardingStepRequest struct {
  131. Step string `json:"step" form:"required,max=255"`
  132. Provider string `json:"provider"`
  133. AccountId string `json:"account_id"`
  134. CloudformationURL string `json:"cloudformation_url"`
  135. ErrorMessage string `json:"error_message"`
  136. LoginURL string `json:"login_url"`
  137. Region string `json:"region"`
  138. // ExternalId used as a 'password' for the aws assume role chain to porter-manager role
  139. ExternalId string `json:"external_id"`
  140. }
  141. // UpdateProjectNameRequest takes in a name to rename projects
  142. type UpdateProjectNameRequest struct {
  143. Name string `json:"name" form:"required"`
  144. }