2
0

project.go 6.2 KB

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