Unified storage: Add quotas app to apiserver (#114425)

* initial generation

* went through doc to add new resource

* added dummy kind so grafana will run

* added dummy handler and custom route

* fix app name

* gets custom route working - still a dummy route

* adds groupOverride to manifest

* adds quotas to grpc client and server

* WIP - trying to get api recognized - not working

* Gets route working

* fixes group and resource vars

* expects group and resource as separate params

* set content-type header on response

* removes Quotas kind and regens

* Update grafana-app-sdk to v0.48.5

* Update codegen

* updates manifest

* formatting

* updates grafana-app-sdk version to 0.48.5

* regen ResourceClient mocks

* adds tests

* remove commented code

* uncomment go mod tidy

* fix tests and make update workspace

* adds quotas app to codeowners

* formatting

* make gen-apps

* deletes temp file

* fix generated folder code

* make gofmt

* make gen-go

* make update-workspace

* add COPY apps/quotas to Dockerfile

* fix test mock

* fixes undefined NewFolderStatus()

* make gen-apps, and add func for NewFolderStatus

* make gen-apps again

* make update-workspace

* regen folder_object_gen.go

* gofmt

* fix linting

* apps/folder make update-workspace

* make gen-apps

* make gen-apps

* fixes enterprise_imports.go

* go get testcontainers

* adds feature toggle

* make update-workspace

* fix go mod

* fix another client mock

---------

Co-authored-by: Steve Simpson <steve@grafana.com>
This commit is contained in:
owensmallwood
2025-12-09 09:40:34 -06:00
committed by GitHub
co-authored by Steve Simpson
parent 297e886e1b
commit a3daf0e39d
47 changed files with 1758 additions and 149 deletions
@@ -709,3 +709,94 @@ var Diagnostics_ServiceDesc = grpc.ServiceDesc{
Streams: []grpc.StreamDesc{},
Metadata: "resource.proto",
}
const (
Quotas_GetQuotaUsage_FullMethodName = "/resource.Quotas/GetQuotaUsage"
)
// QuotasClient is the client API for Quotas service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type QuotasClient interface {
// Get current quota usage and limits
GetQuotaUsage(ctx context.Context, in *QuotaUsageRequest, opts ...grpc.CallOption) (*QuotaUsageResponse, error)
}
type quotasClient struct {
cc grpc.ClientConnInterface
}
func NewQuotasClient(cc grpc.ClientConnInterface) QuotasClient {
return &quotasClient{cc}
}
func (c *quotasClient) GetQuotaUsage(ctx context.Context, in *QuotaUsageRequest, opts ...grpc.CallOption) (*QuotaUsageResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QuotaUsageResponse)
err := c.cc.Invoke(ctx, Quotas_GetQuotaUsage_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// QuotasServer is the server API for Quotas service.
// All implementations should embed UnimplementedQuotasServer
// for forward compatibility
type QuotasServer interface {
// Get current quota usage and limits
GetQuotaUsage(context.Context, *QuotaUsageRequest) (*QuotaUsageResponse, error)
}
// UnimplementedQuotasServer should be embedded to have forward compatible implementations.
type UnimplementedQuotasServer struct {
}
func (UnimplementedQuotasServer) GetQuotaUsage(context.Context, *QuotaUsageRequest) (*QuotaUsageResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetQuotaUsage not implemented")
}
// UnsafeQuotasServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QuotasServer will
// result in compilation errors.
type UnsafeQuotasServer interface {
mustEmbedUnimplementedQuotasServer()
}
func RegisterQuotasServer(s grpc.ServiceRegistrar, srv QuotasServer) {
s.RegisterService(&Quotas_ServiceDesc, srv)
}
func _Quotas_GetQuotaUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QuotaUsageRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QuotasServer).GetQuotaUsage(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Quotas_GetQuotaUsage_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QuotasServer).GetQuotaUsage(ctx, req.(*QuotaUsageRequest))
}
return interceptor(ctx, in, info, handler)
}
// Quotas_ServiceDesc is the grpc.ServiceDesc for Quotas service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Quotas_ServiceDesc = grpc.ServiceDesc{
ServiceName: "resource.Quotas",
HandlerType: (*QuotasServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetQuotaUsage",
Handler: _Quotas_GetQuotaUsage_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "resource.proto",
}