Skip to content

Commit

Permalink
Feature: add resource usage service (#1215)
Browse files Browse the repository at this point in the history
  • Loading branch information
little-cui committed Jan 11, 2022
1 parent 339a0b0 commit 12f54ca
Show file tree
Hide file tree
Showing 18 changed files with 204 additions and 415 deletions.
32 changes: 0 additions & 32 deletions server/plugin/quota/buildin/account.go

This file was deleted.

12 changes: 7 additions & 5 deletions server/plugin/quota/buildin/buildin.go
Expand Up @@ -26,7 +26,9 @@ import (
"github.com/apache/servicecomb-service-center/pkg/util"
"github.com/apache/servicecomb-service-center/server/config"
"github.com/apache/servicecomb-service-center/server/plugin/quota"
"github.com/apache/servicecomb-service-center/server/service/disco"
quotasvc "github.com/apache/servicecomb-service-center/server/service/quota"
"github.com/apache/servicecomb-service-center/server/service/rbac"
pb "github.com/go-chassis/cari/discovery"
)

Expand Down Expand Up @@ -99,24 +101,24 @@ func (q *Quota) RemandQuotas(ctx context.Context, resourceType quota.ResourceTyp
func (q *Quota) Usage(ctx context.Context, req *quota.Request) (int64, error) {
switch req.QuotaType {
case quotasvc.TypeInstance:
return InstanceUsage(ctx, &pb.GetServiceCountRequest{
return disco.InstanceUsage(ctx, &pb.GetServiceCountRequest{
Domain: util.ParseDomain(ctx),
Project: util.ParseProject(ctx),
})
case quotasvc.TypeService:
return ServiceUsage(ctx, &pb.GetServiceCountRequest{
return disco.ServiceUsage(ctx, &pb.GetServiceCountRequest{
Domain: util.ParseDomain(ctx),
Project: util.ParseProject(ctx),
})
case quotasvc.TypeSchema:
return SchemaUsage(ctx, req.ServiceID)
return disco.Usage(ctx, req.ServiceID)
case quotasvc.TypeTag:
// always re-create the service old tags
return 0, nil
case quotasvc.TypeAccount:
return AccountUsage(ctx)
return rbac.AccountUsage(ctx)
case quotasvc.TypeRole:
return RoleUsage(ctx)
return rbac.RoleUsage(ctx)
default:
return 0, nil
}
Expand Down
33 changes: 0 additions & 33 deletions server/plugin/quota/buildin/instance.go

This file was deleted.

66 changes: 0 additions & 66 deletions server/plugin/quota/buildin/instance_test.go

This file was deleted.

32 changes: 0 additions & 32 deletions server/plugin/quota/buildin/role.go

This file was deleted.

36 changes: 0 additions & 36 deletions server/plugin/quota/buildin/schema.go

This file was deleted.

71 changes: 0 additions & 71 deletions server/plugin/quota/buildin/schema_test.go

This file was deleted.

33 changes: 0 additions & 33 deletions server/plugin/quota/buildin/service.go

This file was deleted.

0 comments on commit 12f54ca

Please sign in to comment.