From fbc0864799362ebd58af0523cea2b0657104767b Mon Sep 17 00:00:00 2001 From: Neil Naveen <42328488+neilnaveen@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:54:34 -0600 Subject: [PATCH] Add more endpoints @coderabbitai (#158) * Add more endpoints - Added AddNode and SetDependency to the Graph service Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com> * Tweaked the code better Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> --------- Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com> Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> Co-authored-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> --- api/v1/service.go | 74 +++- api/v1/service.proto | 15 + api/v1/service_test.go | 53 +++ cmd/query/getMetadata/getMetadata_test.go | 11 + cmd/query/globsearch/globsearch_test.go | 10 + gen/api/v1/apiv1connect/service.connect.go | 59 +++ gen/api/v1/service.pb.go | 468 +++++++++++++++------ pkg/tools/ingest/helpers.go | 8 +- pkg/tools/ingest/vuln.go | 2 +- 9 files changed, 547 insertions(+), 153 deletions(-) diff --git a/api/v1/service.go b/api/v1/service.go index 5a4ebed..c3a6830 100644 --- a/api/v1/service.go +++ b/api/v1/service.go @@ -48,11 +48,11 @@ type Query struct { func (s *Service) GetNode(ctx context.Context, req *connect.Request[service.GetNodeRequest]) (*connect.Response[service.GetNodeResponse], error) { node, err := s.storage.GetNode(req.Msg.Id) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to get node by id: %w", err) } serviceNode, err := NodeToServiceNode(node) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to convert node to service node: %w", err) } return connect.NewResponse(&service.GetNodeResponse{Node: serviceNode}), nil } @@ -60,15 +60,15 @@ func (s *Service) GetNode(ctx context.Context, req *connect.Request[service.GetN func (s *Service) GetNodeByName(ctx context.Context, req *connect.Request[service.GetNodeByNameRequest]) (*connect.Response[service.GetNodeByNameResponse], error) { id, err := s.storage.NameToID(req.Msg.Name) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to get node by name: %w", err) } node, err := s.storage.GetNode(id) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to get node by id: %w", err) } serviceNode, err := NodeToServiceNode(node) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to convert node to service node: %w", err) } return connect.NewResponse(&service.GetNodeByNameResponse{Node: serviceNode}), nil } @@ -76,23 +76,51 @@ func (s *Service) GetNodeByName(ctx context.Context, req *connect.Request[servic func (s *Service) GetNodesByGlob(ctx context.Context, req *connect.Request[service.GetNodesByGlobRequest]) (*connect.Response[service.GetNodesByGlobResponse], error) { nodes, err := s.storage.GetNodesByGlob(req.Msg.Pattern) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to get nodes by glob: %w", err) } serviceNodes := make([]*service.Node, 0, len(nodes)) for _, node := range nodes { serviceNode, err := NodeToServiceNode(node) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to convert node to service node: %w", err) } serviceNodes = append(serviceNodes, serviceNode) } return connect.NewResponse(&service.GetNodesByGlobResponse{Nodes: serviceNodes}), nil } +func (s *Service) AddNode(ctx context.Context, req *connect.Request[service.AddNodeRequest]) (*connect.Response[service.AddNodeResponse], error) { + resultNode, err := graph.AddNode(s.storage, req.Msg.Node.Type, req.Msg.Node.Metadata, req.Msg.Node.Name) + if err != nil { + return nil, fmt.Errorf("failed to add node: %w", err) + } + serviceNode, err := NodeToServiceNode(resultNode) + if err != nil { + return nil, fmt.Errorf("failed to convert node to service node: %w", err) + } + return connect.NewResponse(&service.AddNodeResponse{Node: serviceNode}), nil +} + +func (s *Service) SetDependency(ctx context.Context, req *connect.Request[service.SetDependencyRequest]) (*connect.Response[emptypb.Empty], error) { + fromNode, err := s.storage.GetNode(req.Msg.NodeId) + if err != nil { + return nil, err + } + toNode, err := s.storage.GetNode(req.Msg.DependencyID) + if err != nil { + return nil, err + } + err = fromNode.SetDependency(s.storage, toNode) + if err != nil { + return nil, err + } + return connect.NewResponse(&emptypb.Empty{}), nil +} + func (s *Service) Cache(ctx context.Context, req *connect.Request[emptypb.Empty]) (*connect.Response[emptypb.Empty], error) { err := graph.Cache(s.storage) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to cache: %w", err) } return connect.NewResponse(&emptypb.Empty{}), nil } @@ -100,7 +128,7 @@ func (s *Service) Cache(ctx context.Context, req *connect.Request[emptypb.Empty] func (s *Service) Clear(ctx context.Context, req *connect.Request[emptypb.Empty]) (*connect.Response[emptypb.Empty], error) { err := s.storage.RemoveAllCaches() if err != nil { - return nil, err + return nil, fmt.Errorf("failed to clear: %w", err) } return connect.NewResponse(&emptypb.Empty{}), nil } @@ -108,7 +136,7 @@ func (s *Service) Clear(ctx context.Context, req *connect.Request[emptypb.Empty] func (s *Service) CustomLeaderboard(ctx context.Context, req *connect.Request[service.CustomLeaderboardRequest]) (*connect.Response[service.CustomLeaderboardResponse], error) { uncachedNodes, err := s.storage.ToBeCached() if err != nil { - return nil, err + return nil, fmt.Errorf("failed to get uncached nodes: %w", err) } if len(uncachedNodes) != 0 { return nil, fmt.Errorf("cannot use sorted leaderboards without caching") @@ -211,18 +239,18 @@ func (s *Service) CustomLeaderboard(ctx context.Context, req *connect.Request[se func (s *Service) AllKeys(ctx context.Context, req *connect.Request[emptypb.Empty]) (*connect.Response[service.AllKeysResponse], error) { keys, err := s.storage.GetAllKeys() if err != nil { - return nil, err + return nil, fmt.Errorf("failed to get all keys: %w", err) } nodes, err := s.storage.GetNodes(keys) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to get nodes by keys: %w", err) } resultNodes := make([]*service.Node, 0, len(nodes)) for _, node := range nodes { query, err := NodeToServiceNode(node) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to convert node to service node: %w", err) } resultNodes = append(resultNodes, query) } @@ -238,37 +266,37 @@ func (s *Service) Query(ctx context.Context, req *connect.Request[service.QueryR } keys, err := s.storage.GetAllKeys() if err != nil { - return nil, err + return nil, fmt.Errorf("failed to get all keys: %w", err) } nodes, err := s.storage.GetNodes(keys) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to get nodes by keys: %w", err) } caches, err := s.storage.GetCaches(keys) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to get caches by keys: %w", err) } cacheStack, err := s.storage.ToBeCached() if err != nil { - return nil, err + return nil, fmt.Errorf("failed to get to be cached nodes: %w", err) } result, err := graph.ParseAndExecute(req.Msg.Script, s.storage, "", nodes, caches, len(cacheStack) == 0) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to parse and execute script: %w", err) } outputNodes, err := s.storage.GetNodes(result.ToArray()) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to get nodes by ids: %w", err) } resultNodes := make([]*service.Node, 0, len(outputNodes)) for _, node := range outputNodes { query, err := NodeToServiceNode(node) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to convert node to service node: %w", err) } resultNodes = append(resultNodes, query) } @@ -287,7 +315,7 @@ func (s *Service) Check(ctx context.Context, req *connect.Request[emptypb.Empty] func (s *Service) IngestSBOM(ctx context.Context, req *connect.Request[service.IngestSBOMRequest]) (*connect.Response[emptypb.Empty], error) { err := ingest.SBOM(s.storage, req.Msg.Sbom) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to ingest sbom: %w", err) } return connect.NewResponse(&emptypb.Empty{}), nil } @@ -295,7 +323,7 @@ func (s *Service) IngestSBOM(ctx context.Context, req *connect.Request[service.I func (s *Service) IngestVulnerability(ctx context.Context, req *connect.Request[service.IngestVulnerabilityRequest]) (*connect.Response[emptypb.Empty], error) { err := ingest.Vulnerabilities(s.storage, req.Msg.Vulnerability) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to ingest vulnerability: %w", err) } return connect.NewResponse(&emptypb.Empty{}), nil } @@ -303,7 +331,7 @@ func (s *Service) IngestVulnerability(ctx context.Context, req *connect.Request[ func (s *Service) IngestScorecard(ctx context.Context, req *connect.Request[service.IngestScorecardRequest]) (*connect.Response[emptypb.Empty], error) { err := ingest.Scorecards(s.storage, req.Msg.Scorecard) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to ingest scorecard: %w", err) } return connect.NewResponse(&emptypb.Empty{}), nil } diff --git a/api/v1/service.proto b/api/v1/service.proto index 7e4bdba..b9d9626 100644 --- a/api/v1/service.proto +++ b/api/v1/service.proto @@ -64,6 +64,19 @@ message GetNodesByGlobResponse { repeated Node nodes = 1; } +message AddNodeRequest { + Node node = 1; +} + +message AddNodeResponse { + Node node = 1; +} + +message SetDependencyRequest { + uint32 nodeId = 1; + uint32 dependencyID = 2; +} + message IngestSBOMRequest { bytes sbom = 1; } @@ -98,6 +111,8 @@ service GraphService { rpc GetNode(GetNodeRequest) returns (GetNodeResponse) {} rpc GetNodesByGlob(GetNodesByGlobRequest) returns (GetNodesByGlobResponse) {} rpc GetNodeByName(GetNodeByNameRequest) returns (GetNodeByNameResponse) {} + rpc AddNode(AddNodeRequest) returns (AddNodeResponse) {} + rpc SetDependency(SetDependencyRequest) returns (google.protobuf.Empty) {} } service IngestService { diff --git a/api/v1/service_test.go b/api/v1/service_test.go index 075ee79..13564c4 100644 --- a/api/v1/service_test.go +++ b/api/v1/service_test.go @@ -186,6 +186,59 @@ func TestIngestScorecard(t *testing.T) { require.NoError(t, err) } +func TestAddNode(t *testing.T) { + s := setupService() + addNodeReq := connect.NewRequest(&service.AddNodeRequest{ + Node: &service.Node{Name: "test_node", Type: "type1"}, + }) + _, err := s.AddNode(context.Background(), addNodeReq) + require.NoError(t, err) + getNodeReq := connect.NewRequest(&service.GetNodeByNameRequest{Name: "test_node"}) + resp, err := s.GetNodeByName(context.Background(), getNodeReq) + require.NoError(t, err) + assert.NotNil(t, resp.Msg.Node) + assert.Equal(t, "test_node", resp.Msg.Node.Name) + + getNodeReq = connect.NewRequest(&service.GetNodeByNameRequest{Name: "nonexistent_node"}) + resp, err = s.GetNodeByName(context.Background(), getNodeReq) + require.Error(t, err) + assert.Nil(t, resp) +} + +func TestSetDependency(t *testing.T) { + s := setupService() + addNodeReq := connect.NewRequest(&service.AddNodeRequest{ + Node: &service.Node{Name: "test_node", Type: "type1"}, + }) + node1, err := s.AddNode(context.Background(), addNodeReq) + require.NoError(t, err) + addNodeReq2 := connect.NewRequest(&service.AddNodeRequest{ + Node: &service.Node{Name: "test_node2", Type: "type1"}, + }) + node2, err := s.AddNode(context.Background(), addNodeReq2) + require.NoError(t, err) + setDependencyReq := connect.NewRequest(&service.SetDependencyRequest{ + NodeId: node1.Msg.Node.Id, + DependencyID: node2.Msg.Node.Id, + }) + _, err = s.SetDependency(context.Background(), setDependencyReq) + require.NoError(t, err) + getNodeReq := connect.NewRequest(&service.GetNodeByNameRequest{Name: "test_node"}) + resp, err := s.GetNodeByName(context.Background(), getNodeReq) + require.NoError(t, err) + assert.NotNil(t, resp.Msg.Node) + assert.NotEmpty(t, resp.Msg.Node.Dependencies, "Dependencies slice should not be empty") + assert.Equal(t, resp.Msg.Node.Dependencies[0], node2.Msg.Node.Id) + t.Run("non-existent node", func(t *testing.T) { + invalidReq := connect.NewRequest(&service.SetDependencyRequest{ + NodeId: 0, + DependencyID: node2.Msg.Node.Id, + }) + _, err = s.SetDependency(context.Background(), invalidReq) + assert.Error(t, err) + }) +} + func TestHealthCheck(t *testing.T) { s := setupService() req := connect.NewRequest(&emptypb.Empty{}) diff --git a/cmd/query/getMetadata/getMetadata_test.go b/cmd/query/getMetadata/getMetadata_test.go index 181e58f..cd83069 100644 --- a/cmd/query/getMetadata/getMetadata_test.go +++ b/cmd/query/getMetadata/getMetadata_test.go @@ -12,6 +12,7 @@ import ( apiv1 "github.com/bitbomdev/minefield/gen/api/v1" "github.com/spf13/cobra" "github.com/zeebo/assert" + "google.golang.org/protobuf/types/known/emptypb" ) func TestFormatTable(t *testing.T) { @@ -48,6 +49,8 @@ type mockGraphServiceClient struct { GetNodesByGlobFunc func(ctx context.Context, req *connect.Request[apiv1.GetNodesByGlobRequest]) (*connect.Response[apiv1.GetNodesByGlobResponse], error) GetNodeFunc func(ctx context.Context, req *connect.Request[apiv1.GetNodeRequest]) (*connect.Response[apiv1.GetNodeResponse], error) GetNodeByNameFunc func(ctx context.Context, req *connect.Request[apiv1.GetNodeByNameRequest]) (*connect.Response[apiv1.GetNodeByNameResponse], error) + AddNodeFunc func(ctx context.Context, req *connect.Request[apiv1.AddNodeRequest]) (*connect.Response[apiv1.AddNodeResponse], error) + SetDependencyFunc func(ctx context.Context, req *connect.Request[apiv1.SetDependencyRequest]) (*connect.Response[emptypb.Empty], error) } func (m *mockGraphServiceClient) GetNodesByGlob(ctx context.Context, req *connect.Request[apiv1.GetNodesByGlobRequest]) (*connect.Response[apiv1.GetNodesByGlobResponse], error) { @@ -62,6 +65,14 @@ func (m *mockGraphServiceClient) GetNodeByName(ctx context.Context, req *connect return m.GetNodeByNameFunc(ctx, req) } +func (m *mockGraphServiceClient) AddNode(ctx context.Context, req *connect.Request[apiv1.AddNodeRequest]) (*connect.Response[apiv1.AddNodeResponse], error) { + return m.AddNodeFunc(ctx, req) +} + +func (m *mockGraphServiceClient) SetDependency(ctx context.Context, req *connect.Request[apiv1.SetDependencyRequest]) (*connect.Response[emptypb.Empty], error) { + return m.SetDependencyFunc(ctx, req) +} + func TestRun(t *testing.T) { tests := []struct { name string diff --git a/cmd/query/globsearch/globsearch_test.go b/cmd/query/globsearch/globsearch_test.go index 6f64209..b89fce9 100644 --- a/cmd/query/globsearch/globsearch_test.go +++ b/cmd/query/globsearch/globsearch_test.go @@ -15,6 +15,7 @@ import ( apiv1 "github.com/bitbomdev/minefield/gen/api/v1" "github.com/spf13/cobra" "github.com/zeebo/assert" + "google.golang.org/protobuf/types/known/emptypb" ) func TestFormatTable(t *testing.T) { @@ -163,6 +164,8 @@ type mockGraphServiceClient struct { GetNodesByGlobFunc func(ctx context.Context, req *connect.Request[apiv1.GetNodesByGlobRequest]) (*connect.Response[apiv1.GetNodesByGlobResponse], error) GetNodeFunc func(ctx context.Context, req *connect.Request[apiv1.GetNodeRequest]) (*connect.Response[apiv1.GetNodeResponse], error) GetNodeByNameFunc func(ctx context.Context, req *connect.Request[apiv1.GetNodeByNameRequest]) (*connect.Response[apiv1.GetNodeByNameResponse], error) + SetDependencyFunc func(ctx context.Context, req *connect.Request[apiv1.SetDependencyRequest]) (*connect.Response[emptypb.Empty], error) + AddNodeFunc func(ctx context.Context, req *connect.Request[apiv1.AddNodeRequest]) (*connect.Response[apiv1.AddNodeResponse], error) } func (m *mockGraphServiceClient) GetNodesByGlob(ctx context.Context, req *connect.Request[apiv1.GetNodesByGlobRequest]) (*connect.Response[apiv1.GetNodesByGlobResponse], error) { @@ -177,6 +180,13 @@ func (m *mockGraphServiceClient) GetNodeByName(ctx context.Context, req *connect return m.GetNodeByNameFunc(ctx, req) } +func (m *mockGraphServiceClient) AddNode(ctx context.Context, req *connect.Request[apiv1.AddNodeRequest]) (*connect.Response[apiv1.AddNodeResponse], error) { + return m.AddNodeFunc(ctx, req) +} + +func (m *mockGraphServiceClient) SetDependency(ctx context.Context, req *connect.Request[apiv1.SetDependencyRequest]) (*connect.Response[emptypb.Empty], error) { + return m.SetDependencyFunc(ctx, req) +} func TestRun(t *testing.T) { tests := []struct { name string diff --git a/gen/api/v1/apiv1connect/service.connect.go b/gen/api/v1/apiv1connect/service.connect.go index 0ff4e53..8f27e7e 100644 --- a/gen/api/v1/apiv1connect/service.connect.go +++ b/gen/api/v1/apiv1connect/service.connect.go @@ -64,6 +64,11 @@ const ( // GraphServiceGetNodeByNameProcedure is the fully-qualified name of the GraphService's // GetNodeByName RPC. GraphServiceGetNodeByNameProcedure = "/api.v1.GraphService/GetNodeByName" + // GraphServiceAddNodeProcedure is the fully-qualified name of the GraphService's AddNode RPC. + GraphServiceAddNodeProcedure = "/api.v1.GraphService/AddNode" + // GraphServiceSetDependencyProcedure is the fully-qualified name of the GraphService's + // SetDependency RPC. + GraphServiceSetDependencyProcedure = "/api.v1.GraphService/SetDependency" // IngestServiceIngestSBOMProcedure is the fully-qualified name of the IngestService's IngestSBOM // RPC. IngestServiceIngestSBOMProcedure = "/api.v1.IngestService/IngestSBOM" @@ -91,6 +96,8 @@ var ( graphServiceGetNodeMethodDescriptor = graphServiceServiceDescriptor.Methods().ByName("GetNode") graphServiceGetNodesByGlobMethodDescriptor = graphServiceServiceDescriptor.Methods().ByName("GetNodesByGlob") graphServiceGetNodeByNameMethodDescriptor = graphServiceServiceDescriptor.Methods().ByName("GetNodeByName") + graphServiceAddNodeMethodDescriptor = graphServiceServiceDescriptor.Methods().ByName("AddNode") + graphServiceSetDependencyMethodDescriptor = graphServiceServiceDescriptor.Methods().ByName("SetDependency") ingestServiceServiceDescriptor = v1.File_api_v1_service_proto.Services().ByName("IngestService") ingestServiceIngestSBOMMethodDescriptor = ingestServiceServiceDescriptor.Methods().ByName("IngestSBOM") ingestServiceIngestVulnerabilityMethodDescriptor = ingestServiceServiceDescriptor.Methods().ByName("IngestVulnerability") @@ -360,6 +367,8 @@ type GraphServiceClient interface { GetNode(context.Context, *connect.Request[v1.GetNodeRequest]) (*connect.Response[v1.GetNodeResponse], error) GetNodesByGlob(context.Context, *connect.Request[v1.GetNodesByGlobRequest]) (*connect.Response[v1.GetNodesByGlobResponse], error) GetNodeByName(context.Context, *connect.Request[v1.GetNodeByNameRequest]) (*connect.Response[v1.GetNodeByNameResponse], error) + AddNode(context.Context, *connect.Request[v1.AddNodeRequest]) (*connect.Response[v1.AddNodeResponse], error) + SetDependency(context.Context, *connect.Request[v1.SetDependencyRequest]) (*connect.Response[emptypb.Empty], error) } // NewGraphServiceClient constructs a client for the api.v1.GraphService service. By default, it @@ -390,6 +399,18 @@ func NewGraphServiceClient(httpClient connect.HTTPClient, baseURL string, opts . connect.WithSchema(graphServiceGetNodeByNameMethodDescriptor), connect.WithClientOptions(opts...), ), + addNode: connect.NewClient[v1.AddNodeRequest, v1.AddNodeResponse]( + httpClient, + baseURL+GraphServiceAddNodeProcedure, + connect.WithSchema(graphServiceAddNodeMethodDescriptor), + connect.WithClientOptions(opts...), + ), + setDependency: connect.NewClient[v1.SetDependencyRequest, emptypb.Empty]( + httpClient, + baseURL+GraphServiceSetDependencyProcedure, + connect.WithSchema(graphServiceSetDependencyMethodDescriptor), + connect.WithClientOptions(opts...), + ), } } @@ -398,6 +419,8 @@ type graphServiceClient struct { getNode *connect.Client[v1.GetNodeRequest, v1.GetNodeResponse] getNodesByGlob *connect.Client[v1.GetNodesByGlobRequest, v1.GetNodesByGlobResponse] getNodeByName *connect.Client[v1.GetNodeByNameRequest, v1.GetNodeByNameResponse] + addNode *connect.Client[v1.AddNodeRequest, v1.AddNodeResponse] + setDependency *connect.Client[v1.SetDependencyRequest, emptypb.Empty] } // GetNode calls api.v1.GraphService.GetNode. @@ -415,11 +438,23 @@ func (c *graphServiceClient) GetNodeByName(ctx context.Context, req *connect.Req return c.getNodeByName.CallUnary(ctx, req) } +// AddNode calls api.v1.GraphService.AddNode. +func (c *graphServiceClient) AddNode(ctx context.Context, req *connect.Request[v1.AddNodeRequest]) (*connect.Response[v1.AddNodeResponse], error) { + return c.addNode.CallUnary(ctx, req) +} + +// SetDependency calls api.v1.GraphService.SetDependency. +func (c *graphServiceClient) SetDependency(ctx context.Context, req *connect.Request[v1.SetDependencyRequest]) (*connect.Response[emptypb.Empty], error) { + return c.setDependency.CallUnary(ctx, req) +} + // GraphServiceHandler is an implementation of the api.v1.GraphService service. type GraphServiceHandler interface { GetNode(context.Context, *connect.Request[v1.GetNodeRequest]) (*connect.Response[v1.GetNodeResponse], error) GetNodesByGlob(context.Context, *connect.Request[v1.GetNodesByGlobRequest]) (*connect.Response[v1.GetNodesByGlobResponse], error) GetNodeByName(context.Context, *connect.Request[v1.GetNodeByNameRequest]) (*connect.Response[v1.GetNodeByNameResponse], error) + AddNode(context.Context, *connect.Request[v1.AddNodeRequest]) (*connect.Response[v1.AddNodeResponse], error) + SetDependency(context.Context, *connect.Request[v1.SetDependencyRequest]) (*connect.Response[emptypb.Empty], error) } // NewGraphServiceHandler builds an HTTP handler from the service implementation. It returns the @@ -446,6 +481,18 @@ func NewGraphServiceHandler(svc GraphServiceHandler, opts ...connect.HandlerOpti connect.WithSchema(graphServiceGetNodeByNameMethodDescriptor), connect.WithHandlerOptions(opts...), ) + graphServiceAddNodeHandler := connect.NewUnaryHandler( + GraphServiceAddNodeProcedure, + svc.AddNode, + connect.WithSchema(graphServiceAddNodeMethodDescriptor), + connect.WithHandlerOptions(opts...), + ) + graphServiceSetDependencyHandler := connect.NewUnaryHandler( + GraphServiceSetDependencyProcedure, + svc.SetDependency, + connect.WithSchema(graphServiceSetDependencyMethodDescriptor), + connect.WithHandlerOptions(opts...), + ) return "/api.v1.GraphService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case GraphServiceGetNodeProcedure: @@ -454,6 +501,10 @@ func NewGraphServiceHandler(svc GraphServiceHandler, opts ...connect.HandlerOpti graphServiceGetNodesByGlobHandler.ServeHTTP(w, r) case GraphServiceGetNodeByNameProcedure: graphServiceGetNodeByNameHandler.ServeHTTP(w, r) + case GraphServiceAddNodeProcedure: + graphServiceAddNodeHandler.ServeHTTP(w, r) + case GraphServiceSetDependencyProcedure: + graphServiceSetDependencyHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } @@ -475,6 +526,14 @@ func (UnimplementedGraphServiceHandler) GetNodeByName(context.Context, *connect. return nil, connect.NewError(connect.CodeUnimplemented, errors.New("api.v1.GraphService.GetNodeByName is not implemented")) } +func (UnimplementedGraphServiceHandler) AddNode(context.Context, *connect.Request[v1.AddNodeRequest]) (*connect.Response[v1.AddNodeResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("api.v1.GraphService.AddNode is not implemented")) +} + +func (UnimplementedGraphServiceHandler) SetDependency(context.Context, *connect.Request[v1.SetDependencyRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("api.v1.GraphService.SetDependency is not implemented")) +} + // IngestServiceClient is a client for the api.v1.IngestService service. type IngestServiceClient interface { IngestSBOM(context.Context, *connect.Request[v1.IngestSBOMRequest]) (*connect.Response[emptypb.Empty], error) diff --git a/gen/api/v1/service.pb.go b/gen/api/v1/service.pb.go index 5486c1a..62604e5 100644 --- a/gen/api/v1/service.pb.go +++ b/gen/api/v1/service.pb.go @@ -680,6 +680,155 @@ func (x *GetNodesByGlobResponse) GetNodes() []*Node { return nil } +type AddNodeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Node *Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` +} + +func (x *AddNodeRequest) Reset() { + *x = AddNodeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddNodeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddNodeRequest) ProtoMessage() {} + +func (x *AddNodeRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_service_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddNodeRequest.ProtoReflect.Descriptor instead. +func (*AddNodeRequest) Descriptor() ([]byte, []int) { + return file_api_v1_service_proto_rawDescGZIP(), []int{13} +} + +func (x *AddNodeRequest) GetNode() *Node { + if x != nil { + return x.Node + } + return nil +} + +type AddNodeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Node *Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` +} + +func (x *AddNodeResponse) Reset() { + *x = AddNodeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_service_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddNodeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddNodeResponse) ProtoMessage() {} + +func (x *AddNodeResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_service_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddNodeResponse.ProtoReflect.Descriptor instead. +func (*AddNodeResponse) Descriptor() ([]byte, []int) { + return file_api_v1_service_proto_rawDescGZIP(), []int{14} +} + +func (x *AddNodeResponse) GetNode() *Node { + if x != nil { + return x.Node + } + return nil +} + +type SetDependencyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId uint32 `protobuf:"varint,1,opt,name=nodeId,proto3" json:"nodeId,omitempty"` + DependencyID uint32 `protobuf:"varint,2,opt,name=dependencyID,proto3" json:"dependencyID,omitempty"` +} + +func (x *SetDependencyRequest) Reset() { + *x = SetDependencyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v1_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetDependencyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetDependencyRequest) ProtoMessage() {} + +func (x *SetDependencyRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_service_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetDependencyRequest.ProtoReflect.Descriptor instead. +func (*SetDependencyRequest) Descriptor() ([]byte, []int) { + return file_api_v1_service_proto_rawDescGZIP(), []int{15} +} + +func (x *SetDependencyRequest) GetNodeId() uint32 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *SetDependencyRequest) GetDependencyID() uint32 { + if x != nil { + return x.DependencyID + } + return 0 +} + type IngestSBOMRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -691,7 +840,7 @@ type IngestSBOMRequest struct { func (x *IngestSBOMRequest) Reset() { *x = IngestSBOMRequest{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_service_proto_msgTypes[13] + mi := &file_api_v1_service_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -704,7 +853,7 @@ func (x *IngestSBOMRequest) String() string { func (*IngestSBOMRequest) ProtoMessage() {} func (x *IngestSBOMRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_service_proto_msgTypes[13] + mi := &file_api_v1_service_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -717,7 +866,7 @@ func (x *IngestSBOMRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use IngestSBOMRequest.ProtoReflect.Descriptor instead. func (*IngestSBOMRequest) Descriptor() ([]byte, []int) { - return file_api_v1_service_proto_rawDescGZIP(), []int{13} + return file_api_v1_service_proto_rawDescGZIP(), []int{16} } func (x *IngestSBOMRequest) GetSbom() []byte { @@ -738,7 +887,7 @@ type IngestVulnerabilityRequest struct { func (x *IngestVulnerabilityRequest) Reset() { *x = IngestVulnerabilityRequest{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_service_proto_msgTypes[14] + mi := &file_api_v1_service_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -751,7 +900,7 @@ func (x *IngestVulnerabilityRequest) String() string { func (*IngestVulnerabilityRequest) ProtoMessage() {} func (x *IngestVulnerabilityRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_service_proto_msgTypes[14] + mi := &file_api_v1_service_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -764,7 +913,7 @@ func (x *IngestVulnerabilityRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use IngestVulnerabilityRequest.ProtoReflect.Descriptor instead. func (*IngestVulnerabilityRequest) Descriptor() ([]byte, []int) { - return file_api_v1_service_proto_rawDescGZIP(), []int{14} + return file_api_v1_service_proto_rawDescGZIP(), []int{17} } func (x *IngestVulnerabilityRequest) GetVulnerability() []byte { @@ -785,7 +934,7 @@ type IngestScorecardRequest struct { func (x *IngestScorecardRequest) Reset() { *x = IngestScorecardRequest{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_service_proto_msgTypes[15] + mi := &file_api_v1_service_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -798,7 +947,7 @@ func (x *IngestScorecardRequest) String() string { func (*IngestScorecardRequest) ProtoMessage() {} func (x *IngestScorecardRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_service_proto_msgTypes[15] + mi := &file_api_v1_service_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -811,7 +960,7 @@ func (x *IngestScorecardRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use IngestScorecardRequest.ProtoReflect.Descriptor instead. func (*IngestScorecardRequest) Descriptor() ([]byte, []int) { - return file_api_v1_service_proto_rawDescGZIP(), []int{15} + return file_api_v1_service_proto_rawDescGZIP(), []int{18} } func (x *IngestScorecardRequest) GetScorecard() []byte { @@ -832,7 +981,7 @@ type HealthCheckResponse struct { func (x *HealthCheckResponse) Reset() { *x = HealthCheckResponse{} if protoimpl.UnsafeEnabled { - mi := &file_api_v1_service_proto_msgTypes[16] + mi := &file_api_v1_service_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -845,7 +994,7 @@ func (x *HealthCheckResponse) String() string { func (*HealthCheckResponse) ProtoMessage() {} func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_service_proto_msgTypes[16] + mi := &file_api_v1_service_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -858,7 +1007,7 @@ func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead. func (*HealthCheckResponse) Descriptor() ([]byte, []int) { - return file_api_v1_service_proto_rawDescGZIP(), []int{16} + return file_api_v1_service_proto_rawDescGZIP(), []int{19} } func (x *HealthCheckResponse) GetStatus() string { @@ -924,84 +1073,104 @@ var file_api_v1_service_proto_rawDesc = []byte{ 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x79, 0x47, 0x6c, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x27, 0x0a, 0x11, + 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x32, 0x0a, 0x0e, + 0x41, 0x64, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, + 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, + 0x22, 0x33, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, + 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x52, 0x0a, 0x14, 0x53, 0x65, 0x74, 0x44, 0x65, 0x70, 0x65, + 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, + 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x6e, + 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, + 0x6e, 0x63, 0x79, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x64, 0x65, 0x70, + 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x49, 0x44, 0x22, 0x27, 0x0a, 0x11, 0x49, 0x6e, 0x67, + 0x65, 0x73, 0x74, 0x53, 0x42, 0x4f, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x73, 0x62, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x62, + 0x6f, 0x6d, 0x22, 0x42, 0x0a, 0x1a, 0x49, 0x6e, 0x67, 0x65, 0x73, 0x74, 0x56, 0x75, 0x6c, 0x6e, + 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x24, 0x0a, 0x0d, 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x22, 0x36, 0x0a, 0x16, 0x49, 0x6e, 0x67, 0x65, 0x73, 0x74, + 0x53, 0x63, 0x6f, 0x72, 0x65, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x63, 0x61, 0x72, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x63, 0x61, 0x72, 0x64, 0x22, 0x2d, + 0x0a, 0x13, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x32, 0x46, 0x0a, + 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x36, 0x0a, + 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x32, 0x84, 0x01, 0x0a, 0x0c, 0x43, 0x61, 0x63, 0x68, 0x65, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, + 0x00, 0x12, 0x39, 0x0a, 0x05, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x32, 0xae, 0x01, 0x0a, + 0x12, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x5a, 0x0a, 0x11, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4c, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x20, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x62, 0x6f, + 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x62, 0x6f, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x3c, 0x0a, 0x07, 0x41, 0x6c, 0x6c, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x6c, 0x4b, + 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x32, 0xf6, 0x02, + 0x0a, 0x0c, 0x47, 0x72, 0x61, 0x70, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3c, + 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, + 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0e, + 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x79, 0x47, 0x6c, 0x6f, 0x62, 0x12, 0x1d, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x73, + 0x42, 0x79, 0x47, 0x6c, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, + 0x79, 0x47, 0x6c, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x4e, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, + 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, + 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x3c, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x4e, + 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x47, 0x0a, + 0x0d, 0x53, 0x65, 0x74, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x1c, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x44, 0x65, 0x70, 0x65, 0x6e, + 0x64, 0x65, 0x6e, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x32, 0xf4, 0x01, 0x0a, 0x0d, 0x49, 0x6e, 0x67, 0x65, 0x73, + 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x0a, 0x49, 0x6e, 0x67, 0x65, + 0x73, 0x74, 0x53, 0x42, 0x4f, 0x4d, 0x12, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x67, 0x65, 0x73, 0x74, 0x53, 0x42, 0x4f, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x62, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x04, 0x73, 0x62, 0x6f, 0x6d, 0x22, 0x42, 0x0a, 0x1a, 0x49, 0x6e, 0x67, 0x65, 0x73, 0x74, 0x56, - 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x76, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, - 0x6c, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x76, 0x75, 0x6c, 0x6e, - 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x22, 0x36, 0x0a, 0x16, 0x49, 0x6e, 0x67, + 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x13, 0x49, + 0x6e, 0x67, 0x65, 0x73, 0x74, 0x56, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x67, 0x65, + 0x73, 0x74, 0x56, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, + 0x12, 0x4b, 0x0a, 0x0f, 0x49, 0x6e, 0x67, 0x65, 0x73, 0x74, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x63, + 0x61, 0x72, 0x64, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x67, 0x65, 0x73, 0x74, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x63, 0x61, 0x72, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x63, 0x61, 0x72, - 0x64, 0x22, 0x2d, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x32, 0x46, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x36, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x32, 0x84, 0x01, 0x0a, 0x0c, 0x43, 0x61, 0x63, - 0x68, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x43, 0x61, 0x63, - 0x68, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x05, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x12, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x32, - 0xae, 0x01, 0x0a, 0x12, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5a, 0x0a, 0x11, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, - 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x20, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4c, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4c, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x07, 0x41, 0x6c, 0x6c, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x41, - 0x6c, 0x6c, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x32, 0xef, 0x01, 0x0a, 0x0c, 0x47, 0x72, 0x61, 0x70, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x3c, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, - 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x51, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x79, 0x47, 0x6c, 0x6f, - 0x62, 0x12, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, - 0x64, 0x65, 0x73, 0x42, 0x79, 0x47, 0x6c, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, - 0x65, 0x73, 0x42, 0x79, 0x47, 0x6c, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, - 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, - 0x64, 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x32, 0xf4, 0x01, 0x0a, 0x0d, 0x49, 0x6e, 0x67, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x0a, 0x49, 0x6e, 0x67, 0x65, 0x73, 0x74, 0x53, 0x42, - 0x4f, 0x4d, 0x12, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x67, 0x65, - 0x73, 0x74, 0x53, 0x42, 0x4f, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x13, 0x49, 0x6e, 0x67, 0x65, 0x73, - 0x74, 0x56, 0x75, 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x22, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x67, 0x65, 0x73, 0x74, 0x56, 0x75, - 0x6c, 0x6e, 0x65, 0x72, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0f, - 0x49, 0x6e, 0x67, 0x65, 0x73, 0x74, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x63, 0x61, 0x72, 0x64, 0x12, - 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x67, 0x65, 0x73, 0x74, 0x53, - 0x63, 0x6f, 0x72, 0x65, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x32, 0x4f, 0x0a, 0x0d, 0x48, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x05, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1b, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x69, 0x74, 0x62, 0x6f, 0x6d, 0x64, - 0x65, 0x76, 0x2f, 0x6d, 0x69, 0x6e, 0x65, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2f, 0x67, 0x65, 0x6e, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x32, 0x4f, 0x0a, + 0x0d, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, + 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, + 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x31, + 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x69, 0x74, + 0x62, 0x6f, 0x6d, 0x64, 0x65, 0x76, 0x2f, 0x6d, 0x69, 0x6e, 0x65, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1016,7 +1185,7 @@ func file_api_v1_service_proto_rawDescGZIP() []byte { return file_api_v1_service_proto_rawDescData } -var file_api_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_api_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_api_v1_service_proto_goTypes = []any{ (*QueryRequest)(nil), // 0: api.v1.QueryRequest (*QueryResponse)(nil), // 1: api.v1.QueryResponse @@ -1031,11 +1200,14 @@ var file_api_v1_service_proto_goTypes = []any{ (*GetNodeByNameResponse)(nil), // 10: api.v1.GetNodeByNameResponse (*GetNodesByGlobRequest)(nil), // 11: api.v1.GetNodesByGlobRequest (*GetNodesByGlobResponse)(nil), // 12: api.v1.GetNodesByGlobResponse - (*IngestSBOMRequest)(nil), // 13: api.v1.IngestSBOMRequest - (*IngestVulnerabilityRequest)(nil), // 14: api.v1.IngestVulnerabilityRequest - (*IngestScorecardRequest)(nil), // 15: api.v1.IngestScorecardRequest - (*HealthCheckResponse)(nil), // 16: api.v1.HealthCheckResponse - (*emptypb.Empty)(nil), // 17: google.protobuf.Empty + (*AddNodeRequest)(nil), // 13: api.v1.AddNodeRequest + (*AddNodeResponse)(nil), // 14: api.v1.AddNodeResponse + (*SetDependencyRequest)(nil), // 15: api.v1.SetDependencyRequest + (*IngestSBOMRequest)(nil), // 16: api.v1.IngestSBOMRequest + (*IngestVulnerabilityRequest)(nil), // 17: api.v1.IngestVulnerabilityRequest + (*IngestScorecardRequest)(nil), // 18: api.v1.IngestScorecardRequest + (*HealthCheckResponse)(nil), // 19: api.v1.HealthCheckResponse + (*emptypb.Empty)(nil), // 20: google.protobuf.Empty } var file_api_v1_service_proto_depIdxs = []int32{ 3, // 0: api.v1.QueryResponse.nodes:type_name -> api.v1.Node @@ -1045,35 +1217,41 @@ var file_api_v1_service_proto_depIdxs = []int32{ 3, // 4: api.v1.GetNodeResponse.node:type_name -> api.v1.Node 3, // 5: api.v1.GetNodeByNameResponse.node:type_name -> api.v1.Node 3, // 6: api.v1.GetNodesByGlobResponse.nodes:type_name -> api.v1.Node - 0, // 7: api.v1.QueryService.Query:input_type -> api.v1.QueryRequest - 17, // 8: api.v1.CacheService.Cache:input_type -> google.protobuf.Empty - 17, // 9: api.v1.CacheService.Clear:input_type -> google.protobuf.Empty - 5, // 10: api.v1.LeaderboardService.CustomLeaderboard:input_type -> api.v1.CustomLeaderboardRequest - 17, // 11: api.v1.LeaderboardService.AllKeys:input_type -> google.protobuf.Empty - 7, // 12: api.v1.GraphService.GetNode:input_type -> api.v1.GetNodeRequest - 11, // 13: api.v1.GraphService.GetNodesByGlob:input_type -> api.v1.GetNodesByGlobRequest - 9, // 14: api.v1.GraphService.GetNodeByName:input_type -> api.v1.GetNodeByNameRequest - 13, // 15: api.v1.IngestService.IngestSBOM:input_type -> api.v1.IngestSBOMRequest - 14, // 16: api.v1.IngestService.IngestVulnerability:input_type -> api.v1.IngestVulnerabilityRequest - 15, // 17: api.v1.IngestService.IngestScorecard:input_type -> api.v1.IngestScorecardRequest - 17, // 18: api.v1.HealthService.Check:input_type -> google.protobuf.Empty - 1, // 19: api.v1.QueryService.Query:output_type -> api.v1.QueryResponse - 17, // 20: api.v1.CacheService.Cache:output_type -> google.protobuf.Empty - 17, // 21: api.v1.CacheService.Clear:output_type -> google.protobuf.Empty - 6, // 22: api.v1.LeaderboardService.CustomLeaderboard:output_type -> api.v1.CustomLeaderboardResponse - 2, // 23: api.v1.LeaderboardService.AllKeys:output_type -> api.v1.AllKeysResponse - 8, // 24: api.v1.GraphService.GetNode:output_type -> api.v1.GetNodeResponse - 12, // 25: api.v1.GraphService.GetNodesByGlob:output_type -> api.v1.GetNodesByGlobResponse - 10, // 26: api.v1.GraphService.GetNodeByName:output_type -> api.v1.GetNodeByNameResponse - 17, // 27: api.v1.IngestService.IngestSBOM:output_type -> google.protobuf.Empty - 17, // 28: api.v1.IngestService.IngestVulnerability:output_type -> google.protobuf.Empty - 17, // 29: api.v1.IngestService.IngestScorecard:output_type -> google.protobuf.Empty - 16, // 30: api.v1.HealthService.Check:output_type -> api.v1.HealthCheckResponse - 19, // [19:31] is the sub-list for method output_type - 7, // [7:19] 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 + 3, // 7: api.v1.AddNodeRequest.node:type_name -> api.v1.Node + 3, // 8: api.v1.AddNodeResponse.node:type_name -> api.v1.Node + 0, // 9: api.v1.QueryService.Query:input_type -> api.v1.QueryRequest + 20, // 10: api.v1.CacheService.Cache:input_type -> google.protobuf.Empty + 20, // 11: api.v1.CacheService.Clear:input_type -> google.protobuf.Empty + 5, // 12: api.v1.LeaderboardService.CustomLeaderboard:input_type -> api.v1.CustomLeaderboardRequest + 20, // 13: api.v1.LeaderboardService.AllKeys:input_type -> google.protobuf.Empty + 7, // 14: api.v1.GraphService.GetNode:input_type -> api.v1.GetNodeRequest + 11, // 15: api.v1.GraphService.GetNodesByGlob:input_type -> api.v1.GetNodesByGlobRequest + 9, // 16: api.v1.GraphService.GetNodeByName:input_type -> api.v1.GetNodeByNameRequest + 13, // 17: api.v1.GraphService.AddNode:input_type -> api.v1.AddNodeRequest + 15, // 18: api.v1.GraphService.SetDependency:input_type -> api.v1.SetDependencyRequest + 16, // 19: api.v1.IngestService.IngestSBOM:input_type -> api.v1.IngestSBOMRequest + 17, // 20: api.v1.IngestService.IngestVulnerability:input_type -> api.v1.IngestVulnerabilityRequest + 18, // 21: api.v1.IngestService.IngestScorecard:input_type -> api.v1.IngestScorecardRequest + 20, // 22: api.v1.HealthService.Check:input_type -> google.protobuf.Empty + 1, // 23: api.v1.QueryService.Query:output_type -> api.v1.QueryResponse + 20, // 24: api.v1.CacheService.Cache:output_type -> google.protobuf.Empty + 20, // 25: api.v1.CacheService.Clear:output_type -> google.protobuf.Empty + 6, // 26: api.v1.LeaderboardService.CustomLeaderboard:output_type -> api.v1.CustomLeaderboardResponse + 2, // 27: api.v1.LeaderboardService.AllKeys:output_type -> api.v1.AllKeysResponse + 8, // 28: api.v1.GraphService.GetNode:output_type -> api.v1.GetNodeResponse + 12, // 29: api.v1.GraphService.GetNodesByGlob:output_type -> api.v1.GetNodesByGlobResponse + 10, // 30: api.v1.GraphService.GetNodeByName:output_type -> api.v1.GetNodeByNameResponse + 14, // 31: api.v1.GraphService.AddNode:output_type -> api.v1.AddNodeResponse + 20, // 32: api.v1.GraphService.SetDependency:output_type -> google.protobuf.Empty + 20, // 33: api.v1.IngestService.IngestSBOM:output_type -> google.protobuf.Empty + 20, // 34: api.v1.IngestService.IngestVulnerability:output_type -> google.protobuf.Empty + 20, // 35: api.v1.IngestService.IngestScorecard:output_type -> google.protobuf.Empty + 19, // 36: api.v1.HealthService.Check:output_type -> api.v1.HealthCheckResponse + 23, // [23:37] is the sub-list for method output_type + 9, // [9:23] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_api_v1_service_proto_init() } @@ -1239,7 +1417,7 @@ func file_api_v1_service_proto_init() { } } file_api_v1_service_proto_msgTypes[13].Exporter = func(v any, i int) any { - switch v := v.(*IngestSBOMRequest); i { + switch v := v.(*AddNodeRequest); i { case 0: return &v.state case 1: @@ -1251,7 +1429,7 @@ func file_api_v1_service_proto_init() { } } file_api_v1_service_proto_msgTypes[14].Exporter = func(v any, i int) any { - switch v := v.(*IngestVulnerabilityRequest); i { + switch v := v.(*AddNodeResponse); i { case 0: return &v.state case 1: @@ -1263,7 +1441,7 @@ func file_api_v1_service_proto_init() { } } file_api_v1_service_proto_msgTypes[15].Exporter = func(v any, i int) any { - switch v := v.(*IngestScorecardRequest); i { + switch v := v.(*SetDependencyRequest); i { case 0: return &v.state case 1: @@ -1275,6 +1453,42 @@ func file_api_v1_service_proto_init() { } } file_api_v1_service_proto_msgTypes[16].Exporter = func(v any, i int) any { + switch v := v.(*IngestSBOMRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v1_service_proto_msgTypes[17].Exporter = func(v any, i int) any { + switch v := v.(*IngestVulnerabilityRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v1_service_proto_msgTypes[18].Exporter = func(v any, i int) any { + switch v := v.(*IngestScorecardRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v1_service_proto_msgTypes[19].Exporter = func(v any, i int) any { switch v := v.(*HealthCheckResponse); i { case 0: return &v.state @@ -1293,7 +1507,7 @@ func file_api_v1_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_api_v1_service_proto_rawDesc, NumEnums: 0, - NumMessages: 17, + NumMessages: 20, NumExtensions: 0, NumServices: 6, }, diff --git a/pkg/tools/ingest/helpers.go b/pkg/tools/ingest/helpers.go index 6819011..8a8fe92 100644 --- a/pkg/tools/ingest/helpers.go +++ b/pkg/tools/ingest/helpers.go @@ -1,6 +1,10 @@ package ingest -import "github.com/package-url/packageurl-go" +import ( + "fmt" + + "github.com/package-url/packageurl-go" +) type Ecosystem string @@ -69,7 +73,7 @@ func getPURLEcosystem(pkgURL packageurl.PackageURL) Ecosystem { func PURLToPackage(purl string) (PackageInfo, error) { parsedPURL, err := packageurl.FromString(purl) if err != nil { - return PackageInfo{}, err + return PackageInfo{}, fmt.Errorf("failed to parse purl: %w", err) } ecosystem := getPURLEcosystem(parsedPURL) diff --git a/pkg/tools/ingest/vuln.go b/pkg/tools/ingest/vuln.go index 5580581..0de86f7 100644 --- a/pkg/tools/ingest/vuln.go +++ b/pkg/tools/ingest/vuln.go @@ -103,7 +103,7 @@ func Vulnerabilities(storage graph.Storage, data []byte) error { keys, err := storage.GetAllKeys() if err != nil { - return err + return fmt.Errorf("failed to get all keys: %w", err) } nodes, err := storage.GetNodes(keys)