-
Notifications
You must be signed in to change notification settings - Fork 82
/
regist.go
67 lines (56 loc) · 3.73 KB
/
regist.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright 2022 The kubegems.io Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package tenanthandler
import (
"github.com/gin-gonic/gin"
"kubegems.io/kubegems/pkg/service/handlers/base"
)
// TenantHandler 租户相关 Handler
type TenantHandler struct {
base.BaseHandler
}
func (h *TenantHandler) RegistRouter(rg *gin.RouterGroup) {
rg.GET("/tenant", h.CheckIsSysADMIN, h.ListTenant)
rg.GET("/tenant/:tenant_id", h.CheckByTenantID, h.RetrieveTenant)
rg.POST("/tenant", h.CheckIsSysADMIN, h.PostTenant)
rg.PUT("/tenant/:tenant_id", h.CheckByTenantID, h.PutTenant)
rg.DELETE("/tenant/:tenant_id", h.CheckByTenantID, h.DeleteTenant)
rg.GET("/tenant/:tenant_id/user", h.CheckByTenantID, h.ListTenantUser)
rg.GET("/tenant/:tenant_id/user/:user_id", h.CheckByTenantID, h.RetrieveTenantUser)
rg.POST("/tenant/:tenant_id/user", h.CheckByTenantID, h.PostTenantUser)
rg.PUT("/tenant/:tenant_id/user/:user_id", h.CheckByTenantID, h.PutTenantUser)
rg.DELETE("/tenant/:tenant_id/user/:user_id", h.CheckByTenantID, h.DeleteTenantUser)
rg.GET("/tenant/:tenant_id/project", h.CheckByTenantID, h.ListTenantProject)
rg.GET("/tenant/:tenant_id/project/:project_id", h.CheckByTenantID, h.RetrieveTenantProject)
rg.POST("/tenant/:tenant_id/project", h.CheckByTenantID, h.PostTenantProject)
rg.GET("/tenant/:tenant_id/tenantresourcequota", h.CheckByTenantID, h.ListTenantTenantResourceQuota)
rg.POST("/tenant/:tenant_id/tenantresourcequota", h.CheckByTenantID, h.PostTenantTenantResourceQuota)
rg.GET("/tenant/:tenant_id/tenantresourcequota/:tenantresourcequota_id", h.CheckByTenantID, h.RetrieveTenantTenantResourceQuota)
rg.PUT("/tenant/:tenant_id/action/enable", h.CheckByTenantID, h.EnableTenant)
rg.PUT("/tenant/:tenant_id/action/disable", h.CheckByTenantID, h.DisableTenant)
rg.POST("/tenant/:tenant_id/action/networkisolate", h.CheckByTenantID, h.TenantSwitch)
rg.GET("/tenant/:tenant_id/environment_with_quotas", h.CheckByTenantID, h.TenantEnvironments)
rg.GET("/tenant/:tenant_id/environment", h.CheckByTenantID, h.ListEnvironment)
rg.GET("/tenant/:tenant_id/statistics", h.CheckByTenantID, h.TenantStatistics)
rg.PUT("/tenant/:tenant_id/tenantresourcequota/:cluster_id", h.CheckByTenantID, h.PutTenantTenantResourceQuota)
rg.DELETE("/tenant/:tenant_id/tenantresourcequota/:cluster_id", h.CheckByTenantID, h.DeleteTenantResourceQuota)
rg.POST("/tenant/:tenant_id/cluster/:cluster_id/resourceApply", h.CheckByTenantID, h.CreateTenantResourceQuotaApply)
rg.GET("/tenant/:tenant_id/tenantresourcequotaapply/:tenantresourcequotaapply_id", h.CheckByTenantID, h.GetTenantTenantResourceQuotaApply)
rg.GET("/tenant/:tenant_id/cluster/:cluster_id/tenantgateways", h.CheckByTenantID, h.ListTenantGateway)
rg.GET("/tenant/:tenant_id/cluster/:cluster_id/tenantgateways/:name", h.CheckByTenantID, h.GetTenantGateway)
rg.POST("/tenant/:tenant_id/cluster/:cluster_id/tenantgateways", h.CheckByTenantID, h.CreateTenantGateway)
rg.PUT("/tenant/:tenant_id/cluster/:cluster_id/tenantgateways/:name", h.CheckByTenantID, h.UpdateTenantGateway)
rg.DELETE("/tenant/:tenant_id/cluster/:cluster_id/tenantgateways/:name", h.CheckByTenantID, h.DeleteTenantGateway)
rg.GET("/tenant/:tenant_id/cluster/:cluster_id/tenantgateways/:name/addresses", h.CheckByTenantID, h.GetObjectTenantGatewayAddr)
}