Skip to content

Commit

Permalink
feature. change api path for admin
Browse files Browse the repository at this point in the history
  • Loading branch information
ktkfree committed Mar 7, 2024
1 parent bbc437f commit 07a6413
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 55 deletions.
13 changes: 7 additions & 6 deletions internal/delivery/api/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,13 @@ const (
GetResourceQuota

// StackTemplate
GetStackTemplates
CreateStackTemplate
GetStackTemplate
UpdateStackTemplate
DeleteStackTemplate
UpdateStackTemplateOrganizations
Admin_GetStackTemplates
Admin_GetStackTemplate
Admin_GetStackTemplateServices
Admin_CreateStackTemplate
Admin_UpdateStackTemplate
Admin_DeleteStackTemplate
Admin_UpdateStackTemplateOrganizations

// Dashboard
GetChartsDashboard // 대시보드/대시보드/조회
Expand Down
80 changes: 44 additions & 36 deletions internal/delivery/api/generated_endpoints.go.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,28 +275,32 @@ var ApiMap = map[Endpoint]EndpointInfo{
Name: "GetResourceQuota",
Group: "CloudAccount",
},
GetStackTemplates: {
Name: "GetStackTemplates",
Admin_GetStackTemplates: {
Name: "Admin_GetStackTemplates",
Group: "StackTemplate",
},
CreateStackTemplate: {
Name: "CreateStackTemplate",
Admin_GetStackTemplate: {
Name: "Admin_GetStackTemplate",
Group: "StackTemplate",
},
GetStackTemplate: {
Name: "GetStackTemplate",
Admin_GetStackTemplateServices: {
Name: "Admin_GetStackTemplateServices",
Group: "StackTemplate",
},
UpdateStackTemplate: {
Name: "UpdateStackTemplate",
Admin_CreateStackTemplate: {
Name: "Admin_CreateStackTemplate",
Group: "StackTemplate",
},
DeleteStackTemplate: {
Name: "DeleteStackTemplate",
Admin_UpdateStackTemplate: {
Name: "Admin_UpdateStackTemplate",
Group: "StackTemplate",
},
UpdateStackTemplateOrganizations: {
Name: "UpdateStackTemplateOrganizations",
Admin_DeleteStackTemplate: {
Name: "Admin_DeleteStackTemplate",
Group: "StackTemplate",
},
Admin_UpdateStackTemplateOrganizations: {
Name: "Admin_UpdateStackTemplateOrganizations",
Group: "StackTemplate",
},
GetChartsDashboard: {
Expand Down Expand Up @@ -690,18 +694,20 @@ func (e Endpoint) String() string {
return "DeleteForceCloudAccount"
case GetResourceQuota:
return "GetResourceQuota"
case GetStackTemplates:
return "GetStackTemplates"
case CreateStackTemplate:
return "CreateStackTemplate"
case GetStackTemplate:
return "GetStackTemplate"
case UpdateStackTemplate:
return "UpdateStackTemplate"
case DeleteStackTemplate:
return "DeleteStackTemplate"
case UpdateStackTemplateOrganizations:
return "UpdateStackTemplateOrganizations"
case Admin_GetStackTemplates:
return "Admin_GetStackTemplates"
case Admin_GetStackTemplate:
return "Admin_GetStackTemplate"
case Admin_GetStackTemplateServices:
return "Admin_GetStackTemplateServices"
case Admin_CreateStackTemplate:
return "Admin_CreateStackTemplate"
case Admin_UpdateStackTemplate:
return "Admin_UpdateStackTemplate"
case Admin_DeleteStackTemplate:
return "Admin_DeleteStackTemplate"
case Admin_UpdateStackTemplateOrganizations:
return "Admin_UpdateStackTemplateOrganizations"
case GetChartsDashboard:
return "GetChartsDashboard"
case GetChartDashboard:
Expand Down Expand Up @@ -970,18 +976,20 @@ func GetEndpoint(name string) Endpoint {
return DeleteForceCloudAccount
case "GetResourceQuota":
return GetResourceQuota
case "GetStackTemplates":
return GetStackTemplates
case "CreateStackTemplate":
return CreateStackTemplate
case "GetStackTemplate":
return GetStackTemplate
case "UpdateStackTemplate":
return UpdateStackTemplate
case "DeleteStackTemplate":
return DeleteStackTemplate
case "UpdateStackTemplateOrganizations":
return UpdateStackTemplateOrganizations
case "Admin_GetStackTemplates":
return Admin_GetStackTemplates
case "Admin_GetStackTemplate":
return Admin_GetStackTemplate
case "Admin_GetStackTemplateServices":
return Admin_GetStackTemplateServices
case "Admin_CreateStackTemplate":
return Admin_CreateStackTemplate
case "Admin_UpdateStackTemplate":
return Admin_UpdateStackTemplate
case "Admin_DeleteStackTemplate":
return Admin_DeleteStackTemplate
case "Admin_UpdateStackTemplateOrganizations":
return Admin_UpdateStackTemplateOrganizations
case "GetChartsDashboard":
return GetChartsDashboard
case "GetChartDashboard":
Expand Down
20 changes: 7 additions & 13 deletions internal/route/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,19 +178,13 @@ func SetupRouter(db *gorm.DB, argoClient argowf.ArgoClient, kc keycloak.IKeycloa
r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/cloud-accounts/{cloudAccountId}/quotas", customMiddleware.Handle(internalApi.GetResourceQuota, http.HandlerFunc(cloudAccountHandler.GetResourceQuota))).Methods(http.MethodGet)

stackTemplateHandler := delivery.NewStackTemplateHandler(usecaseFactory)
/* REMOVE START */
r.Handle(API_PREFIX+API_VERSION+"/stack-templates", customMiddleware.Handle(internalApi.GetStackTemplates, http.HandlerFunc(stackTemplateHandler.GetStackTemplates))).Methods(http.MethodGet)
r.Handle(API_PREFIX+API_VERSION+"/stack-templates", customMiddleware.Handle(internalApi.CreateStackTemplate, http.HandlerFunc(stackTemplateHandler.CreateStackTemplate))).Methods(http.MethodPost)
r.Handle(API_PREFIX+API_VERSION+"/stack-templates/{stackTemplateId}", customMiddleware.Handle(internalApi.GetStackTemplate, http.HandlerFunc(stackTemplateHandler.GetStackTemplate))).Methods(http.MethodGet)
r.Handle(API_PREFIX+API_VERSION+"/stack-templates/{stackTemplateId}", customMiddleware.Handle(internalApi.UpdateStackTemplate, http.HandlerFunc(stackTemplateHandler.UpdateStackTemplate))).Methods(http.MethodPut)
r.Handle(API_PREFIX+API_VERSION+"/stack-templates/{stackTemplateId}", customMiddleware.Handle(internalApi.DeleteStackTemplate, http.HandlerFunc(stackTemplateHandler.DeleteStackTemplate))).Methods(http.MethodDelete)
/* REMOVE END */

r.Handle(API_PREFIX+API_VERSION+ADMINAPI_PREFIX+"/stack-templates", customMiddleware.Handle(internalApi.GetStackTemplates, http.HandlerFunc(stackTemplateHandler.GetStackTemplates))).Methods(http.MethodGet)
r.Handle(API_PREFIX+API_VERSION+ADMINAPI_PREFIX+"/stack-templates", customMiddleware.Handle(internalApi.CreateStackTemplate, http.HandlerFunc(stackTemplateHandler.CreateStackTemplate))).Methods(http.MethodPost)
r.Handle(API_PREFIX+API_VERSION+ADMINAPI_PREFIX+"/stack-templates/services", customMiddleware.Handle(internalApi.GetStackTemplates, http.HandlerFunc(stackTemplateHandler.GetStackTemplateServices))).Methods(http.MethodGet)
r.Handle(API_PREFIX+API_VERSION+ADMINAPI_PREFIX+"/stack-templates/{stackTemplateId}", customMiddleware.Handle(internalApi.GetStackTemplates, http.HandlerFunc(stackTemplateHandler.GetStackTemplate))).Methods(http.MethodGet)
r.Handle(API_PREFIX+API_VERSION+ADMINAPI_PREFIX+"/stack-templates/{stackTemplateId}/organizations", customMiddleware.Handle(internalApi.UpdateStackTemplateOrganizations, http.HandlerFunc(stackTemplateHandler.UpdateStackTemplateOrganizations))).Methods(http.MethodPut)
r.Handle(API_PREFIX+API_VERSION+ADMINAPI_PREFIX+"/stack-templates", customMiddleware.Handle(internalApi.Admin_GetStackTemplates, http.HandlerFunc(stackTemplateHandler.GetStackTemplates))).Methods(http.MethodGet)
r.Handle(API_PREFIX+API_VERSION+ADMINAPI_PREFIX+"/stack-templates/{stackTemplateId}", customMiddleware.Handle(internalApi.Admin_GetStackTemplates, http.HandlerFunc(stackTemplateHandler.GetStackTemplate))).Methods(http.MethodGet)
r.Handle(API_PREFIX+API_VERSION+ADMINAPI_PREFIX+"/stack-templates", customMiddleware.Handle(internalApi.Admin_CreateStackTemplate, http.HandlerFunc(stackTemplateHandler.CreateStackTemplate))).Methods(http.MethodPost)
r.Handle(API_PREFIX+API_VERSION+ADMINAPI_PREFIX+"/stack-templates/services", customMiddleware.Handle(internalApi.Admin_GetStackTemplateServices, http.HandlerFunc(stackTemplateHandler.GetStackTemplateServices))).Methods(http.MethodGet)
r.Handle(API_PREFIX+API_VERSION+ADMINAPI_PREFIX+"/stack-templates/{stackTemplateId}/organizations", customMiddleware.Handle(internalApi.Admin_UpdateStackTemplateOrganizations, http.HandlerFunc(stackTemplateHandler.UpdateStackTemplateOrganizations))).Methods(http.MethodPut)
r.Handle(API_PREFIX+API_VERSION+ADMINAPI_PREFIX+"/stack-templates/{stackTemplateId}", customMiddleware.Handle(internalApi.Admin_UpdateStackTemplate, http.HandlerFunc(stackTemplateHandler.UpdateStackTemplate))).Methods(http.MethodPut)
r.Handle(API_PREFIX+API_VERSION+ADMINAPI_PREFIX+"/stack-templates/{stackTemplateId}", customMiddleware.Handle(internalApi.Admin_DeleteStackTemplate, http.HandlerFunc(stackTemplateHandler.DeleteStackTemplate))).Methods(http.MethodDelete)

dashboardHandler := delivery.NewDashboardHandler(usecaseFactory)
r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/dashboard/charts", customMiddleware.Handle(internalApi.GetChartsDashboard, http.HandlerFunc(dashboardHandler.GetCharts))).Methods(http.MethodGet)
Expand Down

0 comments on commit 07a6413

Please sign in to comment.