project.go 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. EFSEnabled bool `json:"efs_enabled"`
  36. GPUEnabled bool `json:"gpu_enabled"`
  37. SimplifiedViewEnabled bool `json:"simplified_view_enabled"`
  38. AzureEnabled bool `json:"azure_enabled"`
  39. HelmValuesEnabled bool `json:"helm_values_enabled"`
  40. MultiCluster bool `json:"multi_cluster"`
  41. FullAddOns bool `json:"full_add_ons"`
  42. EnableReprovision bool `json:"enable_reprovision"`
  43. ValidateApplyV2 bool `json:"validate_apply_v2"`
  44. QuotaIncrease bool `json:"quota_increase"`
  45. BetaFeaturesEnabled bool `json:"beta_features_enabled"`
  46. }
  47. type FeatureFlags struct {
  48. PreviewEnvironmentsEnabled string `json:"preview_environments_enabled,omitempty"`
  49. ManagedInfraEnabled string `json:"managed_infra_enabled,omitempty"`
  50. StacksEnabled string `json:"stacks_enabled,omitempty"`
  51. ManagedDatabasesEnabled string `json:"managed_databases_enabled,omitempty"`
  52. CapiProvisionerEnabled string `json:"capi_provisioner_enabled,omitempty"`
  53. SimplifiedViewEnabled string `json:"simplified_view_enabled,omitempty"`
  54. AzureEnabled bool `json:"azure_enabled,omitempty"`
  55. HelmValuesEnabled bool `json:"helm_values_enabled,omitempty"`
  56. MultiCluster bool `json:"multi_cluster,omitempty"`
  57. FullAddOns bool `json:"full_add_ons,omitempty"`
  58. EnableReprovision bool `json:"enable_reprovision,omitempty"`
  59. ValidateApplyV2 bool `json:"validate_apply_v2"`
  60. }
  61. type CreateProjectRequest struct {
  62. Name string `json:"name" form:"required"`
  63. }
  64. type CreateProjectResponse Project
  65. type CreateProjectRoleRequest struct {
  66. Kind string `json:"kind" form:"required"`
  67. UserID uint `json:"user_id" form:"required"`
  68. }
  69. type ProjectInviteAdminRequest struct{}
  70. type ReadProjectResponse Project
  71. type ListProjectsRequest struct{}
  72. type ListProjectsResponse []Project
  73. type DeleteProjectRequest struct {
  74. Name string `json:"name" form:"required"`
  75. }
  76. type DeleteProjectResponse Project
  77. type ListProjectInfraResponse []*Infra
  78. type GetProjectPolicyResponse []*PolicyDocument
  79. type ListProjectRolesResponse []RoleKind
  80. type Collaborator struct {
  81. ID uint `json:"id"`
  82. Kind string `json:"kind"`
  83. UserID uint `json:"user_id"`
  84. Email string `json:"email"`
  85. ProjectID uint `json:"project_id"`
  86. }
  87. type ListCollaboratorsResponse []*Collaborator
  88. type UpdateRoleRequest struct {
  89. UserID uint `json:"user_id,required"`
  90. Kind string `json:"kind,required"`
  91. }
  92. type UpdateRoleResponse struct {
  93. *Role
  94. }
  95. type DeleteRoleRequest struct {
  96. UserID uint `schema:"user_id,required"`
  97. }
  98. type DeleteRoleResponse struct {
  99. *Role
  100. }
  101. type GetBillingTokenResponse struct {
  102. Token string `json:"token"`
  103. TeamID string `json:"team_id"`
  104. }
  105. type GetProjectBillingResponse struct {
  106. HasBilling bool `json:"has_billing"`
  107. }
  108. type StepEnum string
  109. const (
  110. StepConnectSource StepEnum = "connect_source"
  111. StepGithub StepEnum = "github"
  112. )
  113. type ConnectedSourceType string
  114. const (
  115. ConnectedSourceTypeGithub = "github"
  116. ConnectedSourceTypeDocker = "docker"
  117. )
  118. type OnboardingData struct {
  119. CurrentStep StepEnum `json:"current_step"`
  120. ConnectedSource ConnectedSourceType `json:"connected_source"`
  121. SkipRegistryConnection bool `json:"skip_registry_connection"`
  122. SkipResourceProvision bool `json:"skip_resource_provision"`
  123. RegistryConnectionID uint `json:"registry_connection_id"`
  124. RegistryConnectionCredentialID uint `json:"registry_connection_credential_id"`
  125. RegistryConnectionProvider string `json:"registry_connection_provider"`
  126. RegistryInfraID uint `json:"registry_infra_id"`
  127. RegistryInfraCredentialID uint `json:"registry_infra_credential_id"`
  128. RegistryInfraProvider string `json:"registry_infra_provider"`
  129. ClusterInfraID uint `json:"cluster_infra_id"`
  130. ClusterInfraCredentialID uint `json:"cluster_infra_credential_id"`
  131. ClusterInfraProvider string `json:"cluster_infra_provider"`
  132. }
  133. type UpdateOnboardingRequest OnboardingData
  134. type UpdateOnboardingStepRequest struct {
  135. Step string `json:"step" form:"required,max=255"`
  136. Provider string `json:"provider"`
  137. AccountId string `json:"account_id"`
  138. CloudformationURL string `json:"cloudformation_url"`
  139. ErrorMessage string `json:"error_message"`
  140. LoginURL string `json:"login_url"`
  141. Region string `json:"region"`
  142. // ExternalId used as a 'password' for the aws assume role chain to porter-manager role
  143. ExternalId string `json:"external_id"`
  144. }
  145. // UpdateProjectNameRequest takes in a name to rename projects
  146. type UpdateProjectNameRequest struct {
  147. Name string `json:"name" form:"required"`
  148. }