Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

perf: batch get groups (#17181)

ecmadaoa790371b641a
diff --git a/backend/api/v1/group_service.go b/backend/api/v1/group_service.go
index d41ab01530..1f67d4903c 100644
--- a/backend/api/v1/group_service.go
+++ b/backend/api/v1/group_service.go
@@ -52,6 +52,19 @@ func (s *GroupService) GetGroup(ctx context.Context, req *connect.Request[v1pb.G
return connect.NewResponse(result), nil
}
+// BatchGetGroups get groups in batch.
+func (s *GroupService) BatchGetGroups(ctx context.Context, request *connect.Request[v1pb.BatchGetGroupsRequest]) (*connect.Response[v1pb.BatchGetGroupsResponse], error) {
+ response := &v1pb.BatchGetGroupsResponse{}
+ for _, name := range request.Msg.Names {
+ group, err := s.GetGroup(ctx, connect.NewRequest(&v1pb.GetGroupRequest{Name: name}))
+ if err != nil {
+ return nil, err
+ }
+ response.Groups = append(response.Groups, group.Msg)
+ }
+ return connect.NewResponse(response), nil
+}
+
// ListGroups lists all groups.
func (s *GroupService) ListGroups(ctx context.Context, _ *connect.Request[v1pb.ListGroupsRequest]) (*connect.Response[v1pb.ListGroupsResponse], error) {
groups, err := s.store.ListGroups(ctx, &store.FindGroupMessage{})
diff --git a/backend/generated-go/v1/group_service.pb.go b/backend/generated-go/v1/group_service.pb.go
index c7131667c1..e63b5d447a 100644
--- a/backend/generated-go/v1/group_service.pb.go
+++ b/backend/generated-go/v1/group_service.pb.go
@@ -70,7 +70,7 @@ func (x GroupMember_Role) Number() protoreflect.EnumNumber {
// Deprecated: Use GroupMember_Role.Descriptor instead.
func (GroupMember_Role) EnumDescriptor() ([]byte, []int) {
- return file_v1_group_service_proto_rawDescGZIP(), []int{6, 0}
+ return file_v1_group_service_proto_rawDescGZIP(), []int{8, 0}
}
type GetGroupRequest struct {
@@ -119,6 +119,97 @@ func (x *GetGroupRequest) GetName() string {
return ""
}
+type BatchGetGroupsRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The group names to retrieve.
+ // Format: groups/{email}
+ Names []string `protobuf:"bytes,1,rep,name=names,proto3" json:"names,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *BatchGetGroupsRequest) Reset() {
+ *x = BatchGetGroupsRequest{}
+ mi := &file_v1_group_service_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *BatchGetGroupsRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*BatchGetGroupsRequest) ProtoMessage() {}
+
+func (x *BatchGetGroupsRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_group_service_proto_msgTypes[1]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use BatchGetGroupsRequest.ProtoReflect.Descriptor instead.
+func (*BatchGetGroupsRequest) Descriptor() ([]byte, []int) {
+ return file_v1_group_service_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *BatchGetGroupsRequest) GetNames() []string {
+ if x != nil {
+ return x.Names
+ }
+ return nil
+}
+
+type BatchGetGroupsResponse struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The groups from the specified request.
+ Groups []*Group `protobuf:"bytes,1,rep,name=groups,proto3" json:"groups,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *BatchGetGroupsResponse) Reset() {
+ *x = BatchGetGroupsResponse{}
+ mi := &file_v1_group_service_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *BatchGetGroupsResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*BatchGetGroupsResponse) ProtoMessage() {}
+
+func (x *BatchGetGroupsResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_group_service_proto_msgTypes[2]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use BatchGetGroupsResponse.ProtoReflect.Descriptor instead.
+func (*BatchGetGroupsResponse) Descriptor() ([]byte, []int) {
+ return file_v1_group_service_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *BatchGetGroupsResponse) GetGroups() []*Group {
+ if x != nil {
+ return x.Groups
+ }
+ return nil
+}
+
type ListGroupsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Not used.
@@ -140,7 +231,7 @@ type ListGroupsRequest struct {
func (x *ListGroupsRequest) Reset() {
*x = ListGroupsRequest{}
- mi := &file_v1_group_service_proto_msgTypes[1]
+ mi := &file_v1_group_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -152,7 +243,7 @@ func (x *ListGroupsRequest) String() string {
func (*ListGroupsRequest) ProtoMessage() {}
func (x *ListGroupsRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_group_service_proto_msgTypes[1]
+ mi := &file_v1_group_service_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -165,7 +256,7 @@ func (x *ListGroupsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListGroupsRequest.ProtoReflect.Descriptor instead.
func (*ListGroupsRequest) Descriptor() ([]byte, []int) {
- return file_v1_group_service_proto_rawDescGZIP(), []int{1}
+ return file_v1_group_service_proto_rawDescGZIP(), []int{3}
}
func (x *ListGroupsRequest) GetPageSize() int32 {
@@ -195,7 +286,7 @@ type ListGroupsResponse struct {
func (x *ListGroupsResponse) Reset() {
*x = ListGroupsResponse{}
- mi := &file_v1_group_service_proto_msgTypes[2]
+ mi := &file_v1_group_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -207,7 +298,7 @@ func (x *ListGroupsResponse) String() string {
func (*ListGroupsResponse) ProtoMessage() {}
func (x *ListGroupsResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_group_service_proto_msgTypes[2]
+ mi := &file_v1_group_service_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -220,7 +311,7 @@ func (x *ListGroupsResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListGroupsResponse.ProtoReflect.Descriptor instead.
func (*ListGroupsResponse) Descriptor() ([]byte, []int) {
- return file_v1_group_service_proto_rawDescGZIP(), []int{2}
+ return file_v1_group_service_proto_rawDescGZIP(), []int{4}
}
func (x *ListGroupsResponse) GetGroups() []*Group {
@@ -250,7 +341,7 @@ type CreateGroupRequest struct {
func (x *CreateGroupRequest) Reset() {
*x = CreateGroupRequest{}
- mi := &file_v1_group_service_proto_msgTypes[3]
+ mi := &file_v1_group_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -262,7 +353,7 @@ func (x *CreateGroupRequest) String() string {
func (*CreateGroupRequest) ProtoMessage() {}
func (x *CreateGroupRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_group_service_proto_msgTypes[3]
+ mi := &file_v1_group_service_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -275,7 +366,7 @@ func (x *CreateGroupRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CreateGroupRequest.ProtoReflect.Descriptor instead.
func (*CreateGroupRequest) Descriptor() ([]byte, []int) {
- return file_v1_group_service_proto_rawDescGZIP(), []int{3}
+ return file_v1_group_service_proto_rawDescGZIP(), []int{5}
}
func (x *CreateGroupRequest) GetGroup() *Group {
@@ -310,7 +401,7 @@ type UpdateGroupRequest struct {
func (x *UpdateGroupRequest) Reset() {
*x = UpdateGroupRequest{}
- mi := &file_v1_group_service_proto_msgTypes[4]
+ mi := &file_v1_group_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -322,7 +413,7 @@ func (x *UpdateGroupRequest) String() string {
func (*UpdateGroupRequest) ProtoMessage() {}
func (x *UpdateGroupRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_group_service_proto_msgTypes[4]
+ mi := &file_v1_group_service_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -335,7 +426,7 @@ func (x *UpdateGroupRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateGroupRequest.ProtoReflect.Descriptor instead.
func (*UpdateGroupRequest) Descriptor() ([]byte, []int) {
- return file_v1_group_service_proto_rawDescGZIP(), []int{4}
+ return file_v1_group_service_proto_rawDescGZIP(), []int{6}
}
func (x *UpdateGroupRequest) GetGroup() *Group {
@@ -370,7 +461,7 @@ type DeleteGroupRequest struct {
func (x *DeleteGroupRequest) Reset() {
*x = DeleteGroupRequest{}
- mi := &file_v1_group_service_proto_msgTypes[5]
+ mi := &file_v1_group_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -382,7 +473,7 @@ func (x *DeleteGroupRequest) String() string {
func (*DeleteGroupRequest) ProtoMessage() {}
func (x *DeleteGroupRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_group_service_proto_msgTypes[5]
+ mi := &file_v1_group_service_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -395,7 +486,7 @@ func (x *DeleteGroupRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteGroupRequest.ProtoReflect.Descriptor instead.
func (*DeleteGroupRequest) Descriptor() ([]byte, []int) {
- return file_v1_group_service_proto_rawDescGZIP(), []int{5}
+ return file_v1_group_service_proto_rawDescGZIP(), []int{7}
}
func (x *DeleteGroupRequest) GetName() string {
@@ -418,7 +509,7 @@ type GroupMember struct {
func (x *GroupMember) Reset() {
*x = GroupMember{}
- mi := &file_v1_group_service_proto_msgTypes[6]
+ mi := &file_v1_group_service_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -430,7 +521,7 @@ func (x *GroupMember) String() string {
func (*GroupMember) ProtoMessage() {}
func (x *GroupMember) ProtoReflect() protoreflect.Message {
- mi := &file_v1_group_service_proto_msgTypes[6]
+ mi := &file_v1_group_service_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -443,7 +534,7 @@ func (x *GroupMember) ProtoReflect() protoreflect.Message {
// Deprecated: Use GroupMember.ProtoReflect.Descriptor instead.
func (*GroupMember) Descriptor() ([]byte, []int) {
- return file_v1_group_service_proto_rawDescGZIP(), []int{6}
+ return file_v1_group_service_proto_rawDescGZIP(), []int{8}
}
func (x *GroupMember) GetMember() string {
@@ -476,7 +567,7 @@ type Group struct {
func (x *Group) Reset() {
*x = Group{}
- mi := &file_v1_group_service_proto_msgTypes[7]
+ mi := &file_v1_group_service_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -488,7 +579,7 @@ func (x *Group) String() string {
func (*Group) ProtoMessage() {}
func (x *Group) ProtoReflect() protoreflect.Message {
- mi := &file_v1_group_service_proto_msgTypes[7]
+ mi := &file_v1_group_service_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -501,7 +592,7 @@ func (x *Group) ProtoReflect() protoreflect.Message {
// Deprecated: Use Group.ProtoReflect.Descriptor instead.
func (*Group) Descriptor() ([]byte, []int) {
- return file_v1_group_service_proto_rawDescGZIP(), []int{7}
+ return file_v1_group_service_proto_rawDescGZIP(), []int{9}
}
func (x *Group) GetName() string {
@@ -546,7 +637,12 @@ const file_v1_group_service_proto_rawDesc = "" +
"\x16v1/group_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x13v1/annotation.proto\"A\n" +
"\x0fGetGroupRequest\x12.\n" +
"\x04name\x18\x01 \x01(\tB\x1a\xe0A\x02\xfaA\x14\n" +
- "\x12bytebase.com/GroupR\x04name\"O\n" +
+ "\x12bytebase.com/GroupR\x04name\"I\n" +
+ "\x15BatchGetGroupsRequest\x120\n" +
+ "\x05names\x18\x01 \x03(\tB\x1a\xe0A\x02\xfaA\x14\n" +
+ "\x12bytebase.com/GroupR\x05names\"D\n" +
+ "\x16BatchGetGroupsResponse\x12*\n" +
+ "\x06groups\x18\x01 \x03(\v2\x12.bytebase.v1.GroupR\x06groups\"O\n" +
"\x11ListGroupsRequest\x12\x1b\n" +
"\tpage_size\x18\x01 \x01(\x05R\bpageSize\x12\x1d\n" +
"\n" +
@@ -580,9 +676,10 @@ const file_v1_group_service_proto_rawDesc = "" +
"\vdescription\x18\x03 \x01(\tR\vdescription\x122\n" +
"\amembers\x18\x05 \x03(\v2\x18.bytebase.v1.GroupMemberR\amembers\x12\x16\n" +
"\x06source\x18\a \x01(\tR\x06source:'\xeaA$\n" +
- "\x12bytebase.com/Group\x12\x0egroups/{group}2\xad\x05\n" +
+ "\x12bytebase.com/Group\x12\x0egroups/{group}2\xbb\x06\n" +
"\fGroupService\x12u\n" +
- "\bGetGroup\x12\x1c.bytebase.v1.GetGroupRequest\x1a\x12.bytebase.v1.Group\"7\xdaA\x04name\x8a\xea0\rbb.groups.get\x90\xea0\x01\x82\xd3\xe4\x93\x02\x15\x12\x13/v1/{name=groups/*}\x12z\n" +
+ "\bGetGroup\x12\x1c.bytebase.v1.GetGroupRequest\x1a\x12.bytebase.v1.Group\"7\xdaA\x04name\x8a\xea0\rbb.groups.get\x90\xea0\x01\x82\xd3\xe4\x93\x02\x15\x12\x13/v1/{name=groups/*}\x12\x8b\x01\n" +
+ "\x0eBatchGetGroups\x12\".bytebase.v1.BatchGetGroupsRequest\x1a#.bytebase.v1.BatchGetGroupsResponse\"0\x8a\xea0\rbb.groups.get\x90\xea0\x01\x82\xd3\xe4\x93\x02\x15\x12\x13/v1/groups:batchGet\x12z\n" +
"\n" +
"ListGroups\x12\x1e.bytebase.v1.ListGroupsRequest\x1a\x1f.bytebase.v1.ListGroupsResponse\"+\xdaA\x00\x8a\xea0\x0ebb.groups.list\x90\xea0\x01\x82\xd3\xe4\x93\x02\f\x12\n" +
"/v1/groups\x12\x81\x01\n" +
@@ -604,42 +701,47 @@ func file_v1_group_service_proto_rawDescGZIP() []byte {
}
var file_v1_group_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_v1_group_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
+var file_v1_group_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_v1_group_service_proto_goTypes = []any{
- (GroupMember_Role)(0), // 0: bytebase.v1.GroupMember.Role
- (*GetGroupRequest)(nil), // 1: bytebase.v1.GetGroupRequest
- (*ListGroupsRequest)(nil), // 2: bytebase.v1.ListGroupsRequest
- (*ListGroupsResponse)(nil), // 3: bytebase.v1.ListGroupsResponse
- (*CreateGroupRequest)(nil), // 4: bytebase.v1.CreateGroupRequest
- (*UpdateGroupRequest)(nil), // 5: bytebase.v1.UpdateGroupRequest
- (*DeleteGroupRequest)(nil), // 6: bytebase.v1.DeleteGroupRequest
- (*GroupMember)(nil), // 7: bytebase.v1.GroupMember
- (*Group)(nil), // 8: bytebase.v1.Group
- (*fieldmaskpb.FieldMask)(nil), // 9: google.protobuf.FieldMask
- (*emptypb.Empty)(nil), // 10: google.protobuf.Empty
+ (GroupMember_Role)(0), // 0: bytebase.v1.GroupMember.Role
+ (*GetGroupRequest)(nil), // 1: bytebase.v1.GetGroupRequest
+ (*BatchGetGroupsRequest)(nil), // 2: bytebase.v1.BatchGetGroupsRequest
+ (*BatchGetGroupsResponse)(nil), // 3: bytebase.v1.BatchGetGroupsResponse
+ (*ListGroupsRequest)(nil), // 4: bytebase.v1.ListGroupsRequest
+ (*ListGroupsResponse)(nil), // 5: bytebase.v1.ListGroupsResponse
+ (*CreateGroupRequest)(nil), // 6: bytebase.v1.CreateGroupRequest
+ (*UpdateGroupRequest)(nil), // 7: bytebase.v1.UpdateGroupRequest
+ (*DeleteGroupRequest)(nil), // 8: bytebase.v1.DeleteGroupRequest
+ (*GroupMember)(nil), // 9: bytebase.v1.GroupMember
+ (*Group)(nil), // 10: bytebase.v1.Group
+ (*fieldmaskpb.FieldMask)(nil), // 11: google.protobuf.FieldMask
+ (*emptypb.Empty)(nil), // 12: google.protobuf.Empty
}
var file_v1_group_service_proto_depIdxs = []int32{
- 8, // 0: bytebase.v1.ListGroupsResponse.groups:type_name -> bytebase.v1.Group
- 8, // 1: bytebase.v1.CreateGroupRequest.group:type_name -> bytebase.v1.Group
- 8, // 2: bytebase.v1.UpdateGroupRequest.group:type_name -> bytebase.v1.Group
- 9, // 3: bytebase.v1.UpdateGroupRequest.update_mask:type_name -> google.protobuf.FieldMask
- 0, // 4: bytebase.v1.GroupMember.role:type_name -> bytebase.v1.GroupMember.Role
- 7, // 5: bytebase.v1.Group.members:type_name -> bytebase.v1.GroupMember
- 1, // 6: bytebase.v1.GroupService.GetGroup:input_type -> bytebase.v1.GetGroupRequest
- 2, // 7: bytebase.v1.GroupService.ListGroups:input_type -> bytebase.v1.ListGroupsRequest
- 4, // 8: bytebase.v1.GroupService.CreateGroup:input_type -> bytebase.v1.CreateGroupRequest
- 5, // 9: bytebase.v1.GroupService.UpdateGroup:input_type -> bytebase.v1.UpdateGroupRequest
- 6, // 10: bytebase.v1.GroupService.DeleteGroup:input_type -> bytebase.v1.DeleteGroupRequest
- 8, // 11: bytebase.v1.GroupService.GetGroup:output_type -> bytebase.v1.Group
- 3, // 12: bytebase.v1.GroupService.ListGroups:output_type -> bytebase.v1.ListGroupsResponse
- 8, // 13: bytebase.v1.GroupService.CreateGroup:output_type -> bytebase.v1.Group
- 8, // 14: bytebase.v1.GroupService.UpdateGroup:output_type -> bytebase.v1.Group
- 10, // 15: bytebase.v1.GroupService.DeleteGroup:output_type -> google.protobuf.Empty
- 11, // [11:16] is the sub-list for method output_type
- 6, // [6:11] is the sub-list for method input_type
- 6, // [6:6] is the sub-list for extension type_name
- 6, // [6:6] is the sub-list for extension extendee
- 0, // [0:6] is the sub-list for field type_name
+ 10, // 0: bytebase.v1.BatchGetGroupsResponse.groups:type_name -> bytebase.v1.Group
+ 10, // 1: bytebase.v1.ListGroupsResponse.groups:type_name -> bytebase.v1.Group
+ 10, // 2: bytebase.v1.CreateGroupRequest.group:type_name -> bytebase.v1.Group
+ 10, // 3: bytebase.v1.UpdateGroupRequest.group:type_name -> bytebase.v1.Group
+ 11, // 4: bytebase.v1.UpdateGroupRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 0, // 5: bytebase.v1.GroupMember.role:type_name -> bytebase.v1.GroupMember.Role
+ 9, // 6: bytebase.v1.Group.members:type_name -> bytebase.v1.GroupMember
+ 1, // 7: bytebase.v1.GroupService.GetGroup:input_type -> bytebase.v1.GetGroupRequest
+ 2, // 8: bytebase.v1.GroupService.BatchGetGroups:input_type -> bytebase.v1.BatchGetGroupsRequest
+ 4, // 9: bytebase.v1.GroupService.ListGroups:input_type -> bytebase.v1.ListGroupsRequest
+ 6, // 10: bytebase.v1.GroupService.CreateGroup:input_type -> bytebase.v1.CreateGroupRequest
+ 7, // 11: bytebase.v1.GroupService.UpdateGroup:input_type -> bytebase.v1.UpdateGroupRequest
+ 8, // 12: bytebase.v1.GroupService.DeleteGroup:input_type -> bytebase.v1.DeleteGroupRequest
+ 10, // 13: bytebase.v1.GroupService.GetGroup:output_type -> bytebase.v1.Group
+ 3, // 14: bytebase.v1.GroupService.BatchGetGroups:output_type -> bytebase.v1.BatchGetGroupsResponse
+ 5, // 15: bytebase.v1.GroupService.ListGroups:output_type -> bytebase.v1.ListGroupsResponse
+ 10, // 16: bytebase.v1.GroupService.CreateGroup:output_type -> bytebase.v1.Group
+ 10, // 17: bytebase.v1.GroupService.UpdateGroup:output_type -> bytebase.v1.Group
+ 12, // 18: bytebase.v1.GroupService.DeleteGroup:output_type -> google.protobuf.Empty
+ 13, // [13:19] is the sub-list for method output_type
+ 7, // [7:13] is the sub-list for method input_type
+ 7, // [7:7] is the sub-list for extension type_name
+ 7, // [7:7] is the sub-list for extension extendee
+ 0, // [0:7] is the sub-list for field type_name
}
func init() { file_v1_group_service_proto_init() }
@@ -654,7 +756,7 @@ func file_v1_group_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_group_service_proto_rawDesc), len(file_v1_group_service_proto_rawDesc)),
NumEnums: 1,
- NumMessages: 8,
+ NumMessages: 10,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/backend/generated-go/v1/group_service.pb.gw.go b/backend/generated-go/v1/group_service.pb.gw.go
index 7ad721d227..dc75200378 100644
--- a/backend/generated-go/v1/group_service.pb.gw.go
+++ b/backend/generated-go/v1/group_service.pb.gw.go
@@ -74,6 +74,41 @@ func local_request_GroupService_GetGroup_0(ctx context.Context, marshaler runtim
return msg, metadata, err
}
+var filter_GroupService_BatchGetGroups_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
+
+func request_GroupService_BatchGetGroups_0(ctx context.Context, marshaler runtime.Marshaler, client GroupServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq BatchGetGroupsRequest
+ metadata runtime.ServerMetadata
+ )
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_GroupService_BatchGetGroups_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := client.BatchGetGroups(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_GroupService_BatchGetGroups_0(ctx context.Context, marshaler runtime.Marshaler, server GroupServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq BatchGetGroupsRequest
+ metadata runtime.ServerMetadata
+ )
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_GroupService_BatchGetGroups_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := server.BatchGetGroups(ctx, &protoReq)
+ return msg, metadata, err
+}
+
var filter_GroupService_ListGroups_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
func request_GroupService_ListGroups_0(ctx context.Context, marshaler runtime.Marshaler, client GroupServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
@@ -296,6 +331,26 @@ func RegisterGroupServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu
}
forward_GroupService_GetGroup_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodGet, pattern_GroupService_BatchGetGroups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.GroupService/BatchGetGroups", runtime.WithHTTPPathPattern("/v1/groups:batchGet"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_GroupService_BatchGetGroups_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_GroupService_BatchGetGroups_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
mux.Handle(http.MethodGet, pattern_GroupService_ListGroups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -433,6 +488,23 @@ func RegisterGroupServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu
}
forward_GroupService_GetGroup_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodGet, pattern_GroupService_BatchGetGroups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.GroupService/BatchGetGroups", runtime.WithHTTPPathPattern("/v1/groups:batchGet"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_GroupService_BatchGetGroups_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_GroupService_BatchGetGroups_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
mux.Handle(http.MethodGet, pattern_GroupService_ListGroups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -505,17 +577,19 @@ func RegisterGroupServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu
}
var (
- pattern_GroupService_GetGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "groups", "name"}, ""))
- pattern_GroupService_ListGroups_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "groups"}, ""))
- pattern_GroupService_CreateGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "groups"}, ""))
- pattern_GroupService_UpdateGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "groups", "group.name"}, ""))
- pattern_GroupService_DeleteGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "groups", "name"}, ""))
+ pattern_GroupService_GetGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "groups", "name"}, ""))
+ pattern_GroupService_BatchGetGroups_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "groups"}, "batchGet"))
+ pattern_GroupService_ListGroups_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "groups"}, ""))
+ pattern_GroupService_CreateGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "groups"}, ""))
+ pattern_GroupService_UpdateGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "groups", "group.name"}, ""))
+ pattern_GroupService_DeleteGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "groups", "name"}, ""))
)
var (
- forward_GroupService_GetGroup_0 = runtime.ForwardResponseMessage
- forward_GroupService_ListGroups_0 = runtime.ForwardResponseMessage
- forward_GroupService_CreateGroup_0 = runtime.ForwardResponseMessage
- forward_GroupService_UpdateGroup_0 = runtime.ForwardResponseMessage
- forward_GroupService_DeleteGroup_0 = runtime.ForwardResponseMessage
+ forward_GroupService_GetGroup_0 = runtime.ForwardResponseMessage
+ forward_GroupService_BatchGetGroups_0 = runtime.ForwardResponseMessage
+ forward_GroupService_ListGroups_0 = runtime.ForwardResponseMessage
+ forward_GroupService_CreateGroup_0 = runtime.ForwardResponseMessage
+ forward_GroupService_UpdateGroup_0 = runtime.ForwardResponseMessage
+ forward_GroupService_DeleteGroup_0 = runtime.ForwardResponseMessage
)
diff --git a/backend/generated-go/v1/group_service_grpc.pb.go b/backend/generated-go/v1/group_service_grpc.pb.go
index ae82a1c385..adeae38942 100644
--- a/backend/generated-go/v1/group_service_grpc.pb.go
+++ b/backend/generated-go/v1/group_service_grpc.pb.go
@@ -20,11 +20,12 @@ import (
const _ = grpc.SupportPackageIsVersion9
const (
- GroupService_GetGroup_FullMethodName = "/bytebase.v1.GroupService/GetGroup"
- GroupService_ListGroups_FullMethodName = "/bytebase.v1.GroupService/ListGroups"
- GroupService_CreateGroup_FullMethodName = "/bytebase.v1.GroupService/CreateGroup"
- GroupService_UpdateGroup_FullMethodName = "/bytebase.v1.GroupService/UpdateGroup"
- GroupService_DeleteGroup_FullMethodName = "/bytebase.v1.GroupService/DeleteGroup"
+ GroupService_GetGroup_FullMethodName = "/bytebase.v1.GroupService/GetGroup"
+ GroupService_BatchGetGroups_FullMethodName = "/bytebase.v1.GroupService/BatchGetGroups"
+ GroupService_ListGroups_FullMethodName = "/bytebase.v1.GroupService/ListGroups"
+ GroupService_CreateGroup_FullMethodName = "/bytebase.v1.GroupService/CreateGroup"
+ GroupService_UpdateGroup_FullMethodName = "/bytebase.v1.GroupService/UpdateGroup"
+ GroupService_DeleteGroup_FullMethodName = "/bytebase.v1.GroupService/DeleteGroup"
)
// GroupServiceClient is the client API for GroupService service.
@@ -33,6 +34,9 @@ const (
type GroupServiceClient interface {
// Permissions required: bb.groups.get
GetGroup(ctx context.Context, in *GetGroupRequest, opts ...grpc.CallOption) (*Group, error)
+ // Get the groups in batch.
+ // Permissions required: bb.groups.get
+ BatchGetGroups(ctx context.Context, in *BatchGetGroupsRequest, opts ...grpc.CallOption) (*BatchGetGroupsResponse, error)
// Permissions required: bb.groups.list
ListGroups(ctx context.Context, in *ListGroupsRequest, opts ...grpc.CallOption) (*ListGroupsResponse, error)
// Permissions required: bb.groups.create
@@ -63,6 +67,16 @@ func (c *groupServiceClient) GetGroup(ctx context.Context, in *GetGroupRequest,
return out, nil
}
+func (c *groupServiceClient) BatchGetGroups(ctx context.Context, in *BatchGetGroupsRequest, opts ...grpc.CallOption) (*BatchGetGroupsResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(BatchGetGroupsResponse)
+ err := c.cc.Invoke(ctx, GroupService_BatchGetGroups_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
func (c *groupServiceClient) ListGroups(ctx context.Context, in *ListGroupsRequest, opts ...grpc.CallOption) (*ListGroupsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListGroupsResponse)
@@ -109,6 +123,9 @@ func (c *groupServiceClient) DeleteGroup(ctx context.Context, in *DeleteGroupReq
type GroupServiceServer interface {
// Permissions required: bb.groups.get
GetGroup(context.Context, *GetGroupRequest) (*Group, error)
+ // Get the groups in batch.
+ // Permissions required: bb.groups.get
+ BatchGetGroups(context.Context, *BatchGetGroupsRequest) (*BatchGetGroupsResponse, error)
// Permissions required: bb.groups.list
ListGroups(context.Context, *ListGroupsRequest) (*ListGroupsResponse, error)
// Permissions required: bb.groups.create
@@ -132,6 +149,9 @@ type UnimplementedGroupServiceServer struct{}
func (UnimplementedGroupServiceServer) GetGroup(context.Context, *GetGroupRequest) (*Group, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetGroup not implemented")
}
+func (UnimplementedGroupServiceServer) BatchGetGroups(context.Context, *BatchGetGroupsRequest) (*BatchGetGroupsResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method BatchGetGroups not implemented")
+}
func (UnimplementedGroupServiceServer) ListGroups(context.Context, *ListGroupsRequest) (*ListGroupsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListGroups not implemented")
}
@@ -183,6 +203,24 @@ func _GroupService_GetGroup_Handler(srv interface{}, ctx context.Context, dec fu
return interceptor(ctx, in, info, handler)
}
+func _GroupService_BatchGetGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(BatchGetGroupsRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(GroupServiceServer).BatchGetGroups(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: GroupService_BatchGetGroups_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(GroupServiceServer).BatchGetGroups(ctx, req.(*BatchGetGroupsRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
func _GroupService_ListGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListGroupsRequest)
if err := dec(in); err != nil {
@@ -266,6 +304,10 @@ var GroupService_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetGroup",
Handler: _GroupService_GetGroup_Handler,
},
+ {
+ MethodName: "BatchGetGroups",
+ Handler: _GroupService_BatchGetGroups_Handler,
+ },
{
MethodName: "ListGroups",
Handler: _GroupService_ListGroups_Handler,
diff --git a/backend/generated-go/v1/v1connect/group_service.connect.go b/backend/generated-go/v1/v1connect/group_service.connect.go
index b06afe754e..6abed89bf4 100644
--- a/backend/generated-go/v1/v1connect/group_service.connect.go
+++ b/backend/generated-go/v1/v1connect/group_service.connect.go
@@ -36,6 +36,9 @@ const (
const (
// GroupServiceGetGroupProcedure is the fully-qualified name of the GroupService's GetGroup RPC.
GroupServiceGetGroupProcedure = "/bytebase.v1.GroupService/GetGroup"
+ // GroupServiceBatchGetGroupsProcedure is the fully-qualified name of the GroupService's
+ // BatchGetGroups RPC.
+ GroupServiceBatchGetGroupsProcedure = "/bytebase.v1.GroupService/BatchGetGroups"
// GroupServiceListGroupsProcedure is the fully-qualified name of the GroupService's ListGroups RPC.
GroupServiceListGroupsProcedure = "/bytebase.v1.GroupService/ListGroups"
// GroupServiceCreateGroupProcedure is the fully-qualified name of the GroupService's CreateGroup
@@ -53,6 +56,9 @@ const (
type GroupServiceClient interface {
// Permissions required: bb.groups.get
GetGroup(context.Context, *connect.Request[v1.GetGroupRequest]) (*connect.Response[v1.Group], error)
+ // Get the groups in batch.
+ // Permissions required: bb.groups.get
+ BatchGetGroups(context.Context, *connect.Request[v1.BatchGetGroupsRequest]) (*connect.Response[v1.BatchGetGroupsResponse], error)
// Permissions required: bb.groups.list
ListGroups(context.Context, *connect.Request[v1.ListGroupsRequest]) (*connect.Response[v1.ListGroupsResponse], error)
// Permissions required: bb.groups.create
@@ -82,6 +88,12 @@ func NewGroupServiceClient(httpClient connect.HTTPClient, baseURL string, opts .
connect.WithSchema(groupServiceMethods.ByName("GetGroup")),
connect.WithClientOptions(opts...),
),
+ batchGetGroups: connect.NewClient[v1.BatchGetGroupsRequest, v1.BatchGetGroupsResponse](
+ httpClient,
+ baseURL+GroupServiceBatchGetGroupsProcedure,
+ connect.WithSchema(groupServiceMethods.ByName("BatchGetGroups")),
+ connect.WithClientOptions(opts...),
+ ),
listGroups: connect.NewClient[v1.ListGroupsRequest, v1.ListGroupsResponse](
httpClient,
baseURL+GroupServiceListGroupsProcedure,
@@ -111,11 +123,12 @@ func NewGroupServiceClient(httpClient connect.HTTPClient, baseURL string, opts .
// groupServiceClient implements GroupServiceClient.
type groupServiceClient struct {
- getGroup *connect.Client[v1.GetGroupRequest, v1.Group]
- listGroups *connect.Client[v1.ListGroupsRequest, v1.ListGroupsResponse]
- createGroup *connect.Client[v1.CreateGroupRequest, v1.Group]
- updateGroup *connect.Client[v1.UpdateGroupRequest, v1.Group]
- deleteGroup *connect.Client[v1.DeleteGroupRequest, emptypb.Empty]
+ getGroup *connect.Client[v1.GetGroupRequest, v1.Group]
+ batchGetGroups *connect.Client[v1.BatchGetGroupsRequest, v1.BatchGetGroupsResponse]
+ listGroups *connect.Client[v1.ListGroupsRequest, v1.ListGroupsResponse]
+ createGroup *connect.Client[v1.CreateGroupRequest, v1.Group]
+ updateGroup *connect.Client[v1.UpdateGroupRequest, v1.Group]
+ deleteGroup *connect.Client[v1.DeleteGroupRequest, emptypb.Empty]
}
// GetGroup calls bytebase.v1.GroupService.GetGroup.
@@ -123,6 +136,11 @@ func (c *groupServiceClient) GetGroup(ctx context.Context, req *connect.Request[
return c.getGroup.CallUnary(ctx, req)
}
+// BatchGetGroups calls bytebase.v1.GroupService.BatchGetGroups.
+func (c *groupServiceClient) BatchGetGroups(ctx context.Context, req *connect.Request[v1.BatchGetGroupsRequest]) (*connect.Response[v1.BatchGetGroupsResponse], error) {
+ return c.batchGetGroups.CallUnary(ctx, req)
+}
+
// ListGroups calls bytebase.v1.GroupService.ListGroups.
func (c *groupServiceClient) ListGroups(ctx context.Context, req *connect.Request[v1.ListGroupsRequest]) (*connect.Response[v1.ListGroupsResponse], error) {
return c.listGroups.CallUnary(ctx, req)
@@ -147,6 +165,9 @@ func (c *groupServiceClient) DeleteGroup(ctx context.Context, req *connect.Reque
type GroupServiceHandler interface {
// Permissions required: bb.groups.get
GetGroup(context.Context, *connect.Request[v1.GetGroupRequest]) (*connect.Response[v1.Group], error)
+ // Get the groups in batch.
+ // Permissions required: bb.groups.get
+ BatchGetGroups(context.Context, *connect.Request[v1.BatchGetGroupsRequest]) (*connect.Response[v1.BatchGetGroupsResponse], error)
// Permissions required: bb.groups.list
ListGroups(context.Context, *connect.Request[v1.ListGroupsRequest]) (*connect.Response[v1.ListGroupsResponse], error)
// Permissions required: bb.groups.create
@@ -172,6 +193,12 @@ func NewGroupServiceHandler(svc GroupServiceHandler, opts ...connect.HandlerOpti
connect.WithSchema(groupServiceMethods.ByName("GetGroup")),
connect.WithHandlerOptions(opts...),
)
+ groupServiceBatchGetGroupsHandler := connect.NewUnaryHandler(
+ GroupServiceBatchGetGroupsProcedure,
+ svc.BatchGetGroups,
+ connect.WithSchema(groupServiceMethods.ByName("BatchGetGroups")),
+ connect.WithHandlerOptions(opts...),
+ )
groupServiceListGroupsHandler := connect.NewUnaryHandler(
GroupServiceListGroupsProcedure,
svc.ListGroups,
@@ -200,6 +227,8 @@ func NewGroupServiceHandler(svc GroupServiceHandler, opts ...connect.HandlerOpti
switch r.URL.Path {
case GroupServiceGetGroupProcedure:
groupServiceGetGroupHandler.ServeHTTP(w, r)
+ case GroupServiceBatchGetGroupsProcedure:
+ groupServiceBatchGetGroupsHandler.ServeHTTP(w, r)
case GroupServiceListGroupsProcedure:
groupServiceListGroupsHandler.ServeHTTP(w, r)
case GroupServiceCreateGroupProcedure:
@@ -221,6 +250,10 @@ func (UnimplementedGroupServiceHandler) GetGroup(context.Context, *connect.Reque
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.GroupService.GetGroup is not implemented"))
}
+func (UnimplementedGroupServiceHandler) BatchGetGroups(context.Context, *connect.Request[v1.BatchGetGroupsRequest]) (*connect.Response[v1.BatchGetGroupsResponse], error) {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.GroupService.BatchGetGroups is not implemented"))
+}
+
func (UnimplementedGroupServiceHandler) ListGroups(context.Context, *connect.Request[v1.ListGroupsRequest]) (*connect.Response[v1.ListGroupsResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.GroupService.ListGroups is not implemented"))
}
diff --git a/frontend/src/AuthContext.vue b/frontend/src/AuthContext.vue
index 628a9993f5..ae40d12faf 100644
--- a/frontend/src/AuthContext.vue
+++ b/frontend/src/AuthContext.vue
@@ -6,6 +6,8 @@
<script setup lang="ts">
import { onMounted, onUnmounted, ref, watch } from "vue";
import { useRouter } from "vue-router";
+import { groupBindingPrefix } from "@/types";
+import type { IamPolicy } from "@/types/proto-es/v1/iam_policy_pb";
import { isAuthRelatedRoute } from "@/utils/auth";
import SigninModal from "@/views/auth/SigninModal.vue";
import { t } from "./plugins/i18n";
@@ -81,6 +83,17 @@ watch(
}
);
+const getGroupList = (policy: IamPolicy) => {
+ return policy.bindings.reduce((list, binding) => {
+ for (const member of binding.members) {
+ if (member.startsWith(groupBindingPrefix)) {
+ list.push(member);
+ }
+ }
+ return list;
+ }, [] as string[]);
+};
+
watch(
() => authStore.isLoggedIn,
async () => {
@@ -88,14 +101,12 @@ watch(
return;
}
- // TODO: Performance optimization needed for large organizations
- // Instead of fetching ALL groups/roles, we should:
- // 1. Fetch workspace IAM policy first
- // 2. Extract used groups/roles from policy members (those starting with groupBindingPrefix)
- // 3. Use batchGet to fetch only the groups/roles referenced in IAM policy
- // This avoids loading millions of unused groups/roles in large organizations
- await Promise.all([groupStore.fetchGroupList(), roleStore.fetchRoleList()]);
- await workspaceStore.fetchIamPolicy();
+ const [policy, _] = await Promise.all([
+ workspaceStore.fetchIamPolicy(),
+ roleStore.fetchRoleList(),
+ ]);
+ const groups = getGroupList(policy);
+ await groupStore.batchFetchGroups(groups);
// If the user is required to reset their password, redirect them to the reset password page.
if (authStore.requireResetPassword) {
diff --git a/frontend/src/store/modules/v1/group.ts b/frontend/src/store/modules/v1/group.ts
index de5a4f32e3..18533bf90c 100644
--- a/frontend/src/store/modules/v1/group.ts
+++ b/frontend/src/store/modules/v1/group.ts
@@ -12,6 +12,7 @@ import {
GetGroupRequestSchema,
ListGroupsRequestSchema,
UpdateGroupRequestSchema,
+ BatchGetGroupsRequestSchema,
} from "@/types/proto-es/v1/group_service_pb";
import { hasWorkspacePermissionV2 } from "@/utils";
import { groupNamePrefix } from "./common";
@@ -58,6 +59,19 @@ export const useGroupStore = defineStore("group", () => {
return groups;
};
+ const batchFetchGroups = async (groupNameList: string[]) => {
+ const request = create(BatchGetGroupsRequestSchema, {
+ names: groupNameList.map(ensureGroupIdentifier),
+ });
+ const { groups } = await groupServiceClientConnect.batchGetGroups(request, {
+ contextValues: createContextValues().set(silentContextKey, true),
+ });
+ for (const group of groups) {
+ groupMapByName.set(group.name, group);
+ }
+ return groups;
+ };
+
const getOrFetchGroupByIdentifier = async (id: string) => {
if (!hasWorkspacePermissionV2("bb.groups.get")) {
return;
@@ -108,6 +122,7 @@ export const useGroupStore = defineStore("group", () => {
return {
groupList,
fetchGroupList,
+ batchFetchGroups,
getGroupByIdentifier,
getOrFetchGroupByIdentifier,
deleteGroup,
diff --git a/frontend/src/store/modules/v1/workspace.ts b/frontend/src/store/modules/v1/workspace.ts
index 77260244c8..0fb70a85d1 100644
--- a/frontend/src/store/modules/v1/workspace.ts
+++ b/frontend/src/store/modules/v1/workspace.ts
@@ -66,6 +66,7 @@ export const useWorkspaceV1Store = defineStore("workspace_v1", () => {
});
const policy = await workspaceServiceClientConnect.getIamPolicy(request);
_workspaceIamPolicy.value = policy;
+ return policy;
};
const mergeBinding = ({
diff --git a/frontend/src/types/proto-es/v1/group_service_pb.d.ts b/frontend/src/types/proto-es/v1/group_service_pb.d.ts
index bf3ec15842..14df096243 100644
--- a/frontend/src/types/proto-es/v1/group_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/group_service_pb.d.ts
@@ -30,6 +30,43 @@ export declare type GetGroupRequest = Message<"bytebase.v1.GetGroupRequest"> & {
*/
export declare const GetGroupRequestSchema: GenMessage<GetGroupRequest>;
+/**
+ * @generated from message bytebase.v1.BatchGetGroupsRequest
+ */
+export declare type BatchGetGroupsRequest = Message<"bytebase.v1.BatchGetGroupsRequest"> & {
+ /**
+ * The group names to retrieve.
+ * Format: groups/{email}
+ *
+ * @generated from field: repeated string names = 1;
+ */
+ names: string[];
+};
+
+/**
+ * Describes the message bytebase.v1.BatchGetGroupsRequest.
+ * Use `create(BatchGetGroupsRequestSchema)` to create a new message.
+ */
+export declare const BatchGetGroupsRequestSchema: GenMessage<BatchGetGroupsRequest>;
+
+/**
+ * @generated from message bytebase.v1.BatchGetGroupsResponse
+ */
+export declare type BatchGetGroupsResponse = Message<"bytebase.v1.BatchGetGroupsResponse"> & {
+ /**
+ * The groups from the specified request.
+ *
+ * @generated from field: repeated bytebase.v1.Group groups = 1;
+ */
+ groups: Group[];
+};
+
+/**
+ * Describes the message bytebase.v1.BatchGetGroupsResponse.
+ * Use `create(BatchGetGroupsResponseSchema)` to create a new message.
+ */
+export declare const BatchGetGroupsResponseSchema: GenMessage<BatchGetGroupsResponse>;
+
/**
* @generated from message bytebase.v1.ListGroupsRequest
*/
@@ -276,6 +313,17 @@ export declare const GroupService: GenService<{
input: typeof GetGroupRequestSchema;
output: typeof GroupSchema;
},
+ /**
+ * Get the groups in batch.
+ * Permissions required: bb.groups.get
+ *
+ * @generated from rpc bytebase.v1.GroupService.BatchGetGroups
+ */
+ batchGetGroups: {
+ methodKind: "unary";
+ input: typeof BatchGetGroupsRequestSchema;
+ output: typeof BatchGetGroupsResponseSchema;
+ },
/**
* Permissions required: bb.groups.list
*
diff --git a/frontend/src/types/proto-es/v1/group_service_pb.js b/frontend/src/types/proto-es/v1/group_service_pb.js
index 4231fccd94..bbbcc5d032 100644
--- a/frontend/src/types/proto-es/v1/group_service_pb.js
+++ b/frontend/src/types/proto-es/v1/group_service_pb.js
@@ -14,7 +14,7 @@ import { file_v1_annotation } from "./annotation_pb";
* Describes the file v1/group_service.proto.
*/
export const file_v1_group_service = /*@__PURE__*/
- fileDesc("ChZ2MS9ncm91cF9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSI7Cg9HZXRHcm91cFJlcXVlc3QSKAoEbmFtZRgBIAEoCUIa4EEC+kEUChJieXRlYmFzZS5jb20vR3JvdXAiOgoRTGlzdEdyb3Vwc1JlcXVlc3QSEQoJcGFnZV9zaXplGAEgASgFEhIKCnBhZ2VfdG9rZW4YAiABKAkiUQoSTGlzdEdyb3Vwc1Jlc3BvbnNlEiIKBmdyb3VwcxgBIAMoCzISLmJ5dGViYXNlLnYxLkdyb3VwEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSJWChJDcmVhdGVHcm91cFJlcXVlc3QSJgoFZ3JvdXAYASABKAsyEi5ieXRlYmFzZS52MS5Hcm91cEID4EECEhgKC2dyb3VwX2VtYWlsGAIgASgJQgPgQQIihAEKElVwZGF0ZUdyb3VwUmVxdWVzdBImCgVncm91cBgBIAEoCzISLmJ5dGViYXNlLnYxLkdyb3VwQgPgQQISLwoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrEhUKDWFsbG93X21pc3NpbmcYAyABKAgiPgoSRGVsZXRlR3JvdXBSZXF1ZXN0EigKBG5hbWUYASABKAlCGuBBAvpBFAoSYnl0ZWJhc2UuY29tL0dyb3VwIn8KC0dyb3VwTWVtYmVyEg4KBm1lbWJlchgBIAEoCRIrCgRyb2xlGAIgASgOMh0uYnl0ZWJhc2UudjEuR3JvdXBNZW1iZXIuUm9sZSIzCgRSb2xlEhQKEFJPTEVfVU5TUEVDSUZJRUQQABIJCgVPV05FUhABEgoKBk1FTUJFUhACIqIBCgVHcm91cBIRCgRuYW1lGAEgASgJQgPgQQMSDQoFdGl0bGUYAiABKAkSEwoLZGVzY3JpcHRpb24YAyABKAkSKQoHbWVtYmVycxgFIAMoCzIYLmJ5dGViYXNlLnYxLkdyb3VwTWVtYmVyEg4KBnNvdXJjZRgHIAEoCTon6kEkChJieXRlYmFzZS5jb20vR3JvdXASDmdyb3Vwcy97Z3JvdXB9Mq0FCgxHcm91cFNlcnZpY2USdQoIR2V0R3JvdXASHC5ieXRlYmFzZS52MS5HZXRHcm91cFJlcXVlc3QaEi5ieXRlYmFzZS52MS5Hcm91cCI32kEEbmFtZYrqMA1iYi5ncm91cHMuZ2V0kOowAYLT5JMCFRITL3YxL3tuYW1lPWdyb3Vwcy8qfRJ6CgpMaXN0R3JvdXBzEh4uYnl0ZWJhc2UudjEuTGlzdEdyb3Vwc1JlcXVlc3QaHy5ieXRlYmFzZS52MS5MaXN0R3JvdXBzUmVzcG9uc2UiK9pBAIrqMA5iYi5ncm91cHMubGlzdJDqMAGC0+STAgwSCi92MS9ncm91cHMSgQEKC0NyZWF0ZUdyb3VwEh8uYnl0ZWJhc2UudjEuQ3JlYXRlR3JvdXBSZXF1ZXN0GhIuYnl0ZWJhc2UudjEuR3JvdXAiPdpBBWdyb3VwiuowEGJiLmdyb3Vwcy5jcmVhdGWQ6jABmOowAYLT5JMCEzoFZ3JvdXAiCi92MS9ncm91cHMSnAEKC1VwZGF0ZUdyb3VwEh8uYnl0ZWJhc2UudjEuVXBkYXRlR3JvdXBSZXF1ZXN0GhIuYnl0ZWJhc2UudjEuR3JvdXAiWNpBEWdyb3VwLHVwZGF0ZV9tYXNriuowEGJiLmdyb3Vwcy51cGRhdGWQ6jACmOowAYLT5JMCIjoFZ3JvdXAyGS92MS97Z3JvdXAubmFtZT1ncm91cHMvKn0ShgEKC0RlbGV0ZUdyb3VwEh8uYnl0ZWJhc2UudjEuRGVsZXRlR3JvdXBSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5Ij7aQQRuYW1liuowEGJiLmdyb3Vwcy5kZWxldGWQ6jACmOowAYLT5JMCFSoTL3YxL3tuYW1lPWdyb3Vwcy8qfUI2WjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_v1_annotation]);
+ fileDesc("ChZ2MS9ncm91cF9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSI7Cg9HZXRHcm91cFJlcXVlc3QSKAoEbmFtZRgBIAEoCUIa4EEC+kEUChJieXRlYmFzZS5jb20vR3JvdXAiQgoVQmF0Y2hHZXRHcm91cHNSZXF1ZXN0EikKBW5hbWVzGAEgAygJQhrgQQL6QRQKEmJ5dGViYXNlLmNvbS9Hcm91cCI8ChZCYXRjaEdldEdyb3Vwc1Jlc3BvbnNlEiIKBmdyb3VwcxgBIAMoCzISLmJ5dGViYXNlLnYxLkdyb3VwIjoKEUxpc3RHcm91cHNSZXF1ZXN0EhEKCXBhZ2Vfc2l6ZRgBIAEoBRISCgpwYWdlX3Rva2VuGAIgASgJIlEKEkxpc3RHcm91cHNSZXNwb25zZRIiCgZncm91cHMYASADKAsyEi5ieXRlYmFzZS52MS5Hcm91cBIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkiVgoSQ3JlYXRlR3JvdXBSZXF1ZXN0EiYKBWdyb3VwGAEgASgLMhIuYnl0ZWJhc2UudjEuR3JvdXBCA+BBAhIYCgtncm91cF9lbWFpbBgCIAEoCUID4EECIoQBChJVcGRhdGVHcm91cFJlcXVlc3QSJgoFZ3JvdXAYASABKAsyEi5ieXRlYmFzZS52MS5Hcm91cEID4EECEi8KC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFzaxIVCg1hbGxvd19taXNzaW5nGAMgASgIIj4KEkRlbGV0ZUdyb3VwUmVxdWVzdBIoCgRuYW1lGAEgASgJQhrgQQL6QRQKEmJ5dGViYXNlLmNvbS9Hcm91cCJ/CgtHcm91cE1lbWJlchIOCgZtZW1iZXIYASABKAkSKwoEcm9sZRgCIAEoDjIdLmJ5dGViYXNlLnYxLkdyb3VwTWVtYmVyLlJvbGUiMwoEUm9sZRIUChBST0xFX1VOU1BFQ0lGSUVEEAASCQoFT1dORVIQARIKCgZNRU1CRVIQAiKiAQoFR3JvdXASEQoEbmFtZRgBIAEoCUID4EEDEg0KBXRpdGxlGAIgASgJEhMKC2Rlc2NyaXB0aW9uGAMgASgJEikKB21lbWJlcnMYBSADKAsyGC5ieXRlYmFzZS52MS5Hcm91cE1lbWJlchIOCgZzb3VyY2UYByABKAk6J+pBJAoSYnl0ZWJhc2UuY29tL0dyb3VwEg5ncm91cHMve2dyb3VwfTK7BgoMR3JvdXBTZXJ2aWNlEnUKCEdldEdyb3VwEhwuYnl0ZWJhc2UudjEuR2V0R3JvdXBSZXF1ZXN0GhIuYnl0ZWJhc2UudjEuR3JvdXAiN9pBBG5hbWWK6jANYmIuZ3JvdXBzLmdldJDqMAGC0+STAhUSEy92MS97bmFtZT1ncm91cHMvKn0SiwEKDkJhdGNoR2V0R3JvdXBzEiIuYnl0ZWJhc2UudjEuQmF0Y2hHZXRHcm91cHNSZXF1ZXN0GiMuYnl0ZWJhc2UudjEuQmF0Y2hHZXRHcm91cHNSZXNwb25zZSIwiuowDWJiLmdyb3Vwcy5nZXSQ6jABgtPkkwIVEhMvdjEvZ3JvdXBzOmJhdGNoR2V0EnoKCkxpc3RHcm91cHMSHi5ieXRlYmFzZS52MS5MaXN0R3JvdXBzUmVxdWVzdBofLmJ5dGViYXNlLnYxLkxpc3RHcm91cHNSZXNwb25zZSIr2kEAiuowDmJiLmdyb3Vwcy5saXN0kOowAYLT5JMCDBIKL3YxL2dyb3VwcxKBAQoLQ3JlYXRlR3JvdXASHy5ieXRlYmFzZS52MS5DcmVhdGVHcm91cFJlcXVlc3QaEi5ieXRlYmFzZS52MS5Hcm91cCI92kEFZ3JvdXCK6jAQYmIuZ3JvdXBzLmNyZWF0ZZDqMAGY6jABgtPkkwITOgVncm91cCIKL3YxL2dyb3VwcxKcAQoLVXBkYXRlR3JvdXASHy5ieXRlYmFzZS52MS5VcGRhdGVHcm91cFJlcXVlc3QaEi5ieXRlYmFzZS52MS5Hcm91cCJY2kERZ3JvdXAsdXBkYXRlX21hc2uK6jAQYmIuZ3JvdXBzLnVwZGF0ZZDqMAKY6jABgtPkkwIiOgVncm91cDIZL3YxL3tncm91cC5uYW1lPWdyb3Vwcy8qfRKGAQoLRGVsZXRlR3JvdXASHy5ieXRlYmFzZS52MS5EZWxldGVHcm91cFJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiPtpBBG5hbWWK6jAQYmIuZ3JvdXBzLmRlbGV0ZZDqMAKY6jABgtPkkwIVKhMvdjEve25hbWU9Z3JvdXBzLyp9QjZaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjFiBnByb3RvMw", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_v1_annotation]);
/**
* Describes the message bytebase.v1.GetGroupRequest.
@@ -23,53 +23,67 @@ export const file_v1_group_service = /*@__PURE__*/
export const GetGroupRequestSchema = /*@__PURE__*/
messageDesc(file_v1_group_service, 0);
+/**
+ * Describes the message bytebase.v1.BatchGetGroupsRequest.
+ * Use `create(BatchGetGroupsRequestSchema)` to create a new message.
+ */
+export const BatchGetGroupsRequestSchema = /*@__PURE__*/
+ messageDesc(file_v1_group_service, 1);
+
+/**
+ * Describes the message bytebase.v1.BatchGetGroupsResponse.
+ * Use `create(BatchGetGroupsResponseSchema)` to create a new message.
+ */
+export const BatchGetGroupsResponseSchema = /*@__PURE__*/
+ messageDesc(file_v1_group_service, 2);
+
/**
* Describes the message bytebase.v1.ListGroupsRequest.
* Use `create(ListGroupsRequestSchema)` to create a new message.
*/
export const ListGroupsRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_group_service, 1);
+ messageDesc(file_v1_group_service, 3);
/**
* Describes the message bytebase.v1.ListGroupsResponse.
* Use `create(ListGroupsResponseSchema)` to create a new message.
*/
export const ListGroupsResponseSchema = /*@__PURE__*/
- messageDesc(file_v1_group_service, 2);
+ messageDesc(file_v1_group_service, 4);
/**
* Describes the message bytebase.v1.CreateGroupRequest.
* Use `create(CreateGroupRequestSchema)` to create a new message.
*/
export const CreateGroupRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_group_service, 3);
+ messageDesc(file_v1_group_service, 5);
/**
* Describes the message bytebase.v1.UpdateGroupRequest.
* Use `create(UpdateGroupRequestSchema)` to create a new message.
*/
export const UpdateGroupRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_group_service, 4);
+ messageDesc(file_v1_group_service, 6);
/**
* Describes the message bytebase.v1.DeleteGroupRequest.
* Use `create(DeleteGroupRequestSchema)` to create a new message.
*/
export const DeleteGroupRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_group_service, 5);
+ messageDesc(file_v1_group_service, 7);
/**
* Describes the message bytebase.v1.GroupMember.
* Use `create(GroupMemberSchema)` to create a new message.
*/
export const GroupMemberSchema = /*@__PURE__*/
- messageDesc(file_v1_group_service, 6);
+ messageDesc(file_v1_group_service, 8);
/**
* Describes the enum bytebase.v1.GroupMember.Role.
*/
export const GroupMember_RoleSchema = /*@__PURE__*/
- enumDesc(file_v1_group_service, 6, 0);
+ enumDesc(file_v1_group_service, 8, 0);
/**
* @generated from enum bytebase.v1.GroupMember.Role
@@ -82,7 +96,7 @@ export const GroupMember_Role = /*@__PURE__*/
* Use `create(GroupSchema)` to create a new message.
*/
export const GroupSchema = /*@__PURE__*/
- messageDesc(file_v1_group_service, 7);
+ messageDesc(file_v1_group_service, 9);
/**
* @generated from service bytebase.v1.GroupService
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index b9c1fd4e6e..39f409d29b 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -683,6 +683,37 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
+ /v1/groups:batchGet:
+ get:
+ tags:
+ - GroupService
+ description: |-
+ Get the groups in batch.
+ Permissions required: bb.groups.get
+ operationId: GroupService_BatchGetGroups
+ parameters:
+ - name: names
+ in: query
+ description: |-
+ The group names to retrieve.
+ Format: groups/{email}
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BatchGetGroupsResponse'
+ default:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Status'
/v1/idps:
get:
tags:
@@ -8569,6 +8600,14 @@ components:
items:
$ref: '#/components/schemas/Database'
description: The databases from the specified request.
+ BatchGetGroupsResponse:
+ type: object
+ properties:
+ groups:
+ type: array
+ items:
+ $ref: '#/components/schemas/Group'
+ description: The groups from the specified request.
BatchGetIamPolicyResponse:
type: object
properties:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index f144b6d3c3..089af3e123 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -357,6 +357,8 @@
- [DatabaseGroupService](#bytebase-v1-DatabaseGroupService)
- [v1/group_service.proto](#v1_group_service-proto)
+ - [BatchGetGroupsRequest](#bytebase-v1-BatchGetGroupsRequest)
+ - [BatchGetGroupsResponse](#bytebase-v1-BatchGetGroupsResponse)
- [CreateGroupRequest](#bytebase-v1-CreateGroupRequest)
- [DeleteGroupRequest](#bytebase-v1-DeleteGroupRequest)
- [GetGroupRequest](#bytebase-v1-GetGroupRequest)
@@ -6110,6 +6112,36 @@ The database group&#39;s `name` field is used to identify the database group to
+<a name="bytebase-v1-BatchGetGroupsRequest"></a>
+
+### BatchGetGroupsRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| names | [string](#string) | repeated | The group names to retrieve. Format: groups/{email} |
+
+
+
+
+
+
+<a name="bytebase-v1-BatchGetGroupsResponse"></a>
+
+### BatchGetGroupsResponse
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| groups | [Group](#bytebase-v1-Group) | repeated | The groups from the specified request. |
+
+
+
+
+
+
<a name="bytebase-v1-CreateGroupRequest"></a>
### CreateGroupRequest
@@ -6273,6 +6305,7 @@ The group&#39;s `name` field is used to identify the group to update. Format: gr
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
| GetGroup | [GetGroupRequest](#bytebase-v1-GetGroupRequest) | [Group](#bytebase-v1-Group) | Permissions required: bb.groups.get |
+| BatchGetGroups | [BatchGetGroupsRequest](#bytebase-v1-BatchGetGroupsRequest) | [BatchGetGroupsResponse](#bytebase-v1-BatchGetGroupsResponse) | Get the groups in batch. Permissions required: bb.groups.get |
| ListGroups | [ListGroupsRequest](#bytebase-v1-ListGroupsRequest) | [ListGroupsResponse](#bytebase-v1-ListGroupsResponse) | Permissions required: bb.groups.list |
| CreateGroup | [CreateGroupRequest](#bytebase-v1-CreateGroupRequest) | [Group](#bytebase-v1-Group) | Permissions required: bb.groups.create |
| UpdateGroup | [UpdateGroupRequest](#bytebase-v1-UpdateGroupRequest) | [Group](#bytebase-v1-Group) | UpdateGroup updates the group. Users with &#34;bb.groups.update&#34; permission on the workspace or the group owner can access this method. Permissions required: bb.groups.update |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index f604fad95f..35194f40f2 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -1542,6 +1542,14 @@
<a href="#v1%2fgroup_service.proto">v1/group_service.proto</a>
<ul>
+ <li>
+ <a href="#bytebase.v1.BatchGetGroupsRequest"><span class="badge">M</span>BatchGetGroupsRequest</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.BatchGetGroupsResponse"><span class="badge">M</span>BatchGetGroupsResponse</a>
+ </li>
+
<li>
<a href="#bytebase.v1.CreateGroupRequest"><span class="badge">M</span>CreateGroupRequest</a>
</li>
@@ -17332,6 +17340,55 @@ The API will default to the BASIC view.</p></td>
<p></p>
+ <h3 id="bytebase.v1.BatchGetGroupsRequest">BatchGetGroupsRequest</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>names</td>
+ <td><a href="#string">string</a></td>
+ <td>repeated</td>
+ <td><p>The group names to retrieve.
+Format: groups/{email} </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.v1.BatchGetGroupsResponse">BatchGetGroupsResponse</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>groups</td>
+ <td><a href="#bytebase.v1.Group">Group</a></td>
+ <td>repeated</td>
+ <td><p>The groups from the specified request. </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
<h3 id="bytebase.v1.CreateGroupRequest">CreateGroupRequest</h3>
<p></p>
@@ -17664,6 +17721,14 @@ In this situation, `update_mask` is ignored. </p></td>
<td><p>Permissions required: bb.groups.get</p></td>
</tr>
+ <tr>
+ <td>BatchGetGroups</td>
+ <td><a href="#bytebase.v1.BatchGetGroupsRequest">BatchGetGroupsRequest</a></td>
+ <td><a href="#bytebase.v1.BatchGetGroupsResponse">BatchGetGroupsResponse</a></td>
+ <td><p>Get the groups in batch.
+Permissions required: bb.groups.get</p></td>
+ </tr>
+
<tr>
<td>ListGroups</td>
<td><a href="#bytebase.v1.ListGroupsRequest">ListGroupsRequest</a></td>
@@ -17724,6 +17789,16 @@ Permissions required: bb.groups.update</p></td>
+ <tr>
+ <td>BatchGetGroups</td>
+ <td>GET</td>
+ <td>/v1/groups:batchGet</td>
+ <td></td>
+ </tr>
+
+
+
+
<tr>
<td>ListGroups</td>
<td>GET</td>
diff --git a/proto/v1/v1/group_service.proto b/proto/v1/v1/group_service.proto
index a1d821d9a3..259decfdf1 100644
--- a/proto/v1/v1/group_service.proto
+++ b/proto/v1/v1/group_service.proto
@@ -21,6 +21,14 @@ service GroupService {
option (bytebase.v1.auth_method) = IAM;
}
+ // Get the groups in batch.
+ // Permissions required: bb.groups.get
+ rpc BatchGetGroups(BatchGetGroupsRequest) returns (BatchGetGroupsResponse) {
+ option (google.api.http) = {get: "/v1/groups:batchGet"};
+ option (bytebase.v1.permission) = "bb.groups.get";
+ option (bytebase.v1.auth_method) = IAM;
+ }
+
// Permissions required: bb.groups.list
rpc ListGroups(ListGroupsRequest) returns (ListGroupsResponse) {
option (google.api.http) = {get: "/v1/groups"};
@@ -74,6 +82,20 @@ message GetGroupRequest {
];
}
+message BatchGetGroupsRequest {
+ // The group names to retrieve.
+ // Format: groups/{email}
+ repeated string names = 1 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.resource_reference) = {type: "bytebase.com/Group"}
+ ];
+}
+
+message BatchGetGroupsResponse {
+ // The groups from the specified request.
+ repeated Group groups = 1;
+}
+
message ListGroupsRequest {
// Not used.
// The maximum number of groups to return. The service may return fewer than