Add GetToolchainsForBoard to ToolchainService definition

BUG=b:237098403
TEST=./generate

Change-Id: I380bbbdad23b48a1c2b399af245f826fb4e732ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra/proto/+/3732790
Reviewed-by: Benjamin Shai <bshai@google.com>
Auto-Submit: Jack Neus <jackneus@google.com>
Commit-Queue: Jack Neus <jackneus@google.com>
(cherry picked from commit 523392c2e0e2b3246890dd49591633f467f87d75)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra/proto/+/3752957
Commit-Queue: Madeleine Hardt <hardtmad@google.com>
Reviewed-by: Madeleine Hardt <hardtmad@google.com>
(cherry picked from commit f3ac7264bfbff761aa7fbc8b53a4b11b5f5e2a6b)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra/proto/+/3765953
diff --git a/gen/descriptors.json b/gen/descriptors.json
index cee4a5a..7da6f3b 100644
--- a/gen/descriptors.json
+++ b/gen/descriptors.json
@@ -11075,6 +11075,11 @@
                 }
               },
               "outputType": ".chromite.api.LinterResponse"
+            },
+            {
+              "inputType": ".chromite.api.ToolchainsRequest",
+              "name": "GetToolchainsForBoard",
+              "outputType": ".chromite.api.ToolchainsResponse"
             }
           ],
           "name": "ToolchainService",
diff --git a/go/chromite/api/toolchain.pb.go b/go/chromite/api/toolchain.pb.go
index f19ce79..3a432e4 100644
--- a/go/chromite/api/toolchain.pb.go
+++ b/go/chromite/api/toolchain.pb.go
@@ -1368,7 +1368,7 @@
 	0x61, 0x69, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x15, 0x6e, 0x6f, 0x6e, 0x64, 0x65, 0x66, 0x61, 0x75,
 	0x6c, 0x74, 0x5f, 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x02, 0x20,
 	0x03, 0x28, 0x09, 0x52, 0x14, 0x6e, 0x6f, 0x6e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x54,
-	0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x32, 0x84, 0x04, 0x0a, 0x10, 0x54, 0x6f,
+	0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x32, 0xe0, 0x04, 0x0a, 0x10, 0x54, 0x6f,
 	0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x70,
 	0x0a, 0x0f, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x46, 0x6f, 0x72, 0x42, 0x75, 0x69, 0x6c,
 	0x64, 0x12, 0x2d, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x2e, 0x61, 0x70, 0x69,
@@ -1399,13 +1399,18 @@
 	0x6f, 0x6d, 0x69, 0x74, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x6e, 0x74, 0x65, 0x72,
 	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69,
 	0x74, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73,
-	0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xc2, 0xed, 0x1a, 0x02, 0x10, 0x01, 0x1a, 0x11, 0xc2,
-	0xed, 0x1a, 0x0d, 0x0a, 0x09, 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x10, 0x02,
-	0x42, 0x38, 0x5a, 0x36, 0x67, 0x6f, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75, 0x6d, 0x2e,
-	0x6f, 0x72, 0x67, 0x2f, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75, 0x6d, 0x6f, 0x73, 0x2f, 0x69,
-	0x6e, 0x66, 0x72, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x68,
-	0x72, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
-	0x6f, 0x33,
+	0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xc2, 0xed, 0x1a, 0x02, 0x10, 0x01, 0x12, 0x5a, 0x0a,
+	0x15, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x46, 0x6f,
+	0x72, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x1f, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x74,
+	0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x54, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73,
+	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69,
+	0x74, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x54, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e,
+	0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x11, 0xc2, 0xed, 0x1a, 0x0d, 0x0a,
+	0x09, 0x74, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x10, 0x02, 0x42, 0x38, 0x5a, 0x36,
+	0x67, 0x6f, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75, 0x6d, 0x2e, 0x6f, 0x72, 0x67, 0x2f,
+	0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75, 0x6d, 0x6f, 0x73, 0x2f, 0x69, 0x6e, 0x66, 0x72, 0x61,
+	0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69,
+	0x74, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -1488,13 +1493,15 @@
 	6,  // 31: chromite.api.ToolchainService.GetUpdatedFiles:input_type -> chromite.api.GetUpdatedFilesRequest
 	10, // 32: chromite.api.ToolchainService.EmergeWithLinting:input_type -> chromite.api.LinterRequest
 	10, // 33: chromite.api.ToolchainService.GetClippyLints:input_type -> chromite.api.LinterRequest
-	3,  // 34: chromite.api.ToolchainService.PrepareForBuild:output_type -> chromite.api.PrepareForToolchainBuildResponse
-	5,  // 35: chromite.api.ToolchainService.BundleArtifacts:output_type -> chromite.api.BundleToolchainResponse
-	7,  // 36: chromite.api.ToolchainService.GetUpdatedFiles:output_type -> chromite.api.GetUpdatedFilesResponse
-	11, // 37: chromite.api.ToolchainService.EmergeWithLinting:output_type -> chromite.api.LinterResponse
-	11, // 38: chromite.api.ToolchainService.GetClippyLints:output_type -> chromite.api.LinterResponse
-	34, // [34:39] is the sub-list for method output_type
-	29, // [29:34] is the sub-list for method input_type
+	12, // 34: chromite.api.ToolchainService.GetToolchainsForBoard:input_type -> chromite.api.ToolchainsRequest
+	3,  // 35: chromite.api.ToolchainService.PrepareForBuild:output_type -> chromite.api.PrepareForToolchainBuildResponse
+	5,  // 36: chromite.api.ToolchainService.BundleArtifacts:output_type -> chromite.api.BundleToolchainResponse
+	7,  // 37: chromite.api.ToolchainService.GetUpdatedFiles:output_type -> chromite.api.GetUpdatedFilesResponse
+	11, // 38: chromite.api.ToolchainService.EmergeWithLinting:output_type -> chromite.api.LinterResponse
+	11, // 39: chromite.api.ToolchainService.GetClippyLints:output_type -> chromite.api.LinterResponse
+	13, // 40: chromite.api.ToolchainService.GetToolchainsForBoard:output_type -> chromite.api.ToolchainsResponse
+	35, // [35:41] is the sub-list for method output_type
+	29, // [29:35] is the sub-list for method input_type
 	29, // [29:29] is the sub-list for extension type_name
 	29, // [29:29] is the sub-list for extension extendee
 	0,  // [0:29] is the sub-list for field type_name
diff --git a/go/chromite/api/toolchain_grpc.pb.go b/go/chromite/api/toolchain_grpc.pb.go
index d455022..5f9d31d 100644
--- a/go/chromite/api/toolchain_grpc.pb.go
+++ b/go/chromite/api/toolchain_grpc.pb.go
@@ -43,6 +43,8 @@
 	//  3) Update the recipe to use EmergeWithLinting
 	//  4) Delete GetClippyLints endpoint
 	GetClippyLints(ctx context.Context, in *LinterRequest, opts ...grpc.CallOption) (*LinterResponse, error)
+	// Get the default and non-default toolchains for a board.
+	GetToolchainsForBoard(ctx context.Context, in *ToolchainsRequest, opts ...grpc.CallOption) (*ToolchainsResponse, error)
 }
 
 type toolchainServiceClient struct {
@@ -98,6 +100,15 @@
 	return out, nil
 }
 
+func (c *toolchainServiceClient) GetToolchainsForBoard(ctx context.Context, in *ToolchainsRequest, opts ...grpc.CallOption) (*ToolchainsResponse, error) {
+	out := new(ToolchainsResponse)
+	err := c.cc.Invoke(ctx, "/chromite.api.ToolchainService/GetToolchainsForBoard", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // ToolchainServiceServer is the server API for ToolchainService service.
 // All implementations must embed UnimplementedToolchainServiceServer
 // for forward compatibility
@@ -123,6 +134,8 @@
 	//  3) Update the recipe to use EmergeWithLinting
 	//  4) Delete GetClippyLints endpoint
 	GetClippyLints(context.Context, *LinterRequest) (*LinterResponse, error)
+	// Get the default and non-default toolchains for a board.
+	GetToolchainsForBoard(context.Context, *ToolchainsRequest) (*ToolchainsResponse, error)
 	mustEmbedUnimplementedToolchainServiceServer()
 }
 
@@ -145,6 +158,9 @@
 func (UnimplementedToolchainServiceServer) GetClippyLints(context.Context, *LinterRequest) (*LinterResponse, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method GetClippyLints not implemented")
 }
+func (UnimplementedToolchainServiceServer) GetToolchainsForBoard(context.Context, *ToolchainsRequest) (*ToolchainsResponse, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GetToolchainsForBoard not implemented")
+}
 func (UnimplementedToolchainServiceServer) mustEmbedUnimplementedToolchainServiceServer() {}
 
 // UnsafeToolchainServiceServer may be embedded to opt out of forward compatibility for this service.
@@ -248,6 +264,24 @@
 	return interceptor(ctx, in, info, handler)
 }
 
+func _ToolchainService_GetToolchainsForBoard_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(ToolchainsRequest)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ToolchainServiceServer).GetToolchainsForBoard(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/chromite.api.ToolchainService/GetToolchainsForBoard",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ToolchainServiceServer).GetToolchainsForBoard(ctx, req.(*ToolchainsRequest))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // ToolchainService_ServiceDesc is the grpc.ServiceDesc for ToolchainService service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -275,6 +309,10 @@
 			MethodName: "GetClippyLints",
 			Handler:    _ToolchainService_GetClippyLints_Handler,
 		},
+		{
+			MethodName: "GetToolchainsForBoard",
+			Handler:    _ToolchainService_GetToolchainsForBoard_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "chromite/api/toolchain.proto",
diff --git a/src/chromite/api/toolchain.proto b/src/chromite/api/toolchain.proto
index d4c98e9..bbd835a 100644
--- a/src/chromite/api/toolchain.proto
+++ b/src/chromite/api/toolchain.proto
@@ -216,4 +216,7 @@
       method_chroot_assert: INSIDE,
     };
   };
+
+  // Get the default and non-default toolchains for a board.
+  rpc GetToolchainsForBoard(ToolchainsRequest) returns (ToolchainsResponse);
 }