diff --git a/cli/set.go b/cli/set.go index 4837654d2e..e9cbb55bc0 100644 --- a/cli/set.go +++ b/cli/set.go @@ -18,11 +18,11 @@ import ( "github.com/edgelesssys/nunki/internal/atls" "github.com/edgelesssys/nunki/internal/attestation/snp" - "github.com/edgelesssys/nunki/internal/coordapi" "github.com/edgelesssys/nunki/internal/fsstore" "github.com/edgelesssys/nunki/internal/grpc/dialer" "github.com/edgelesssys/nunki/internal/manifest" "github.com/edgelesssys/nunki/internal/spinner" + "github.com/edgelesssys/nunki/internal/userapi" "github.com/spf13/cobra" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -112,8 +112,8 @@ func runSet(cmd *cobra.Command, args []string) error { } defer conn.Close() - client := coordapi.NewCoordAPIClient(conn) - req := &coordapi.SetManifestRequest{ + client := userapi.NewUserAPIClient(conn) + req := &userapi.SetManifestRequest{ Manifest: manifestBytes, Policies: policyMapToBytesList(policies), } @@ -227,8 +227,8 @@ func loadWorkloadOwnerKey(path string, manifst manifest.Manifest, log *slog.Logg } func setLoop( - ctx context.Context, client coordapi.CoordAPIClient, out io.Writer, req *coordapi.SetManifestRequest, -) (resp *coordapi.SetManifestResponse, retErr error) { + ctx context.Context, client userapi.UserAPIClient, out io.Writer, req *userapi.SetManifestRequest, +) (resp *userapi.SetManifestResponse, retErr error) { spinner := spinner.New(" Waiting for coordinator ", 500*time.Millisecond, out) spinner.Start() defer func() { diff --git a/cli/verify.go b/cli/verify.go index 9b6815da0c..13e736dc36 100644 --- a/cli/verify.go +++ b/cli/verify.go @@ -10,10 +10,10 @@ import ( "github.com/edgelesssys/nunki/internal/atls" "github.com/edgelesssys/nunki/internal/attestation/snp" - "github.com/edgelesssys/nunki/internal/coordapi" "github.com/edgelesssys/nunki/internal/fsstore" "github.com/edgelesssys/nunki/internal/grpc/dialer" "github.com/edgelesssys/nunki/internal/manifest" + "github.com/edgelesssys/nunki/internal/userapi" "github.com/google/go-sev-guest/abi" "github.com/google/go-sev-guest/kds" "github.com/google/go-sev-guest/validate" @@ -78,8 +78,8 @@ func runVerify(cmd *cobra.Command, _ []string) error { defer conn.Close() log.Debug("Getting manifest") - client := coordapi.NewCoordAPIClient(conn) - resp, err := client.GetManifests(cmd.Context(), &coordapi.GetManifestsRequest{}) + client := userapi.NewUserAPIClient(conn) + resp, err := client.GetManifests(cmd.Context(), &userapi.GetManifestsRequest{}) if err != nil { return fmt.Errorf("failed to get manifest: %w", err) } diff --git a/coordinator/main.go b/coordinator/main.go index 818ed6fdc4..d86b6bc020 100644 --- a/coordinator/main.go +++ b/coordinator/main.go @@ -6,9 +6,9 @@ import ( "os" "github.com/edgelesssys/nunki/internal/ca" - "github.com/edgelesssys/nunki/internal/coordapi" "github.com/edgelesssys/nunki/internal/logger" "github.com/edgelesssys/nunki/internal/meshapi" + "github.com/edgelesssys/nunki/internal/userapi" "golang.org/x/sync/errgroup" ) @@ -38,14 +38,14 @@ func run() (retErr error) { } meshAuth := newMeshAuthority(caInstance, logger) - coordS := newCoordAPIServer(meshAuth, caInstance, logger) + userAPI := newUserAPIServer(meshAuth, caInstance, logger) meshAPI := newMeshAPIServer(meshAuth, caInstance, logger) eg := errgroup.Group{} eg.Go(func() error { - logger.Info("Coordinator API listening") - if err := coordS.Serve(net.JoinHostPort("0.0.0.0", coordapi.Port)); err != nil { + logger.Info("Coordinator user API listening") + if err := userAPI.Serve(net.JoinHostPort("0.0.0.0", userapi.Port)); err != nil { return fmt.Errorf("serving Coordinator API: %w", err) } return nil diff --git a/coordinator/coordapi.go b/coordinator/userapi.go similarity index 87% rename from coordinator/coordapi.go rename to coordinator/userapi.go index fcf573eb09..b5cc3ffbda 100644 --- a/coordinator/coordapi.go +++ b/coordinator/userapi.go @@ -15,11 +15,11 @@ import ( "github.com/edgelesssys/nunki/internal/appendable" "github.com/edgelesssys/nunki/internal/attestation/snp" - "github.com/edgelesssys/nunki/internal/coordapi" "github.com/edgelesssys/nunki/internal/grpc/atlscredentials" "github.com/edgelesssys/nunki/internal/logger" "github.com/edgelesssys/nunki/internal/manifest" "github.com/edgelesssys/nunki/internal/memstore" + "github.com/edgelesssys/nunki/internal/userapi" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" @@ -28,7 +28,7 @@ import ( "google.golang.org/grpc/status" ) -type coordAPIServer struct { +type userAPIServer struct { grpc *grpc.Server policyTextStore store[manifest.HexString, manifest.Policy] manifSetGetter manifestSetGetter @@ -36,28 +36,28 @@ type coordAPIServer struct { logger *slog.Logger mux sync.RWMutex - coordapi.UnimplementedCoordAPIServer + userapi.UnimplementedUserAPIServer } -func newCoordAPIServer(mSGetter manifestSetGetter, caGetter certChainGetter, log *slog.Logger) *coordAPIServer { +func newUserAPIServer(mSGetter manifestSetGetter, caGetter certChainGetter, log *slog.Logger) *userAPIServer { issuer := snp.NewIssuer(logger.NewNamed(log, "snp-issuer")) credentials := atlscredentials.New(issuer, nil) grpcServer := grpc.NewServer( grpc.Creds(credentials), grpc.KeepaliveParams(keepalive.ServerParameters{Time: 15 * time.Second}), ) - s := &coordAPIServer{ + s := &userAPIServer{ grpc: grpcServer, policyTextStore: memstore.New[manifest.HexString, manifest.Policy](), manifSetGetter: mSGetter, caChainGetter: caGetter, - logger: log.WithGroup("coordapi"), + logger: log.WithGroup("userapi"), } - coordapi.RegisterCoordAPIServer(s.grpc, s) + userapi.RegisterUserAPIServer(s.grpc, s) return s } -func (s *coordAPIServer) Serve(endpoint string) error { +func (s *userAPIServer) Serve(endpoint string) error { lis, err := net.Listen("tcp", endpoint) if err != nil { return fmt.Errorf("failed to listen: %w", err) @@ -65,8 +65,8 @@ func (s *coordAPIServer) Serve(endpoint string) error { return s.grpc.Serve(lis) } -func (s *coordAPIServer) SetManifest(ctx context.Context, req *coordapi.SetManifestRequest, -) (*coordapi.SetManifestResponse, error) { +func (s *userAPIServer) SetManifest(ctx context.Context, req *userapi.SetManifestRequest, +) (*userapi.SetManifestResponse, error) { s.logger.Info("SetManifest called") s.mux.Lock() defer s.mux.Unlock() @@ -100,7 +100,7 @@ func (s *coordAPIServer) SetManifest(ctx context.Context, req *coordapi.SetManif return nil, status.Errorf(codes.Internal, "setting manifest: %v", err) } - resp := &coordapi.SetManifestResponse{ + resp := &userapi.SetManifestResponse{ CACert: s.caChainGetter.GetRootCACert(), IntermCert: s.caChainGetter.GetIntermCert(), } @@ -109,8 +109,8 @@ func (s *coordAPIServer) SetManifest(ctx context.Context, req *coordapi.SetManif return resp, nil } -func (s *coordAPIServer) GetManifests(_ context.Context, _ *coordapi.GetManifestsRequest, -) (*coordapi.GetManifestsResponse, error) { +func (s *userAPIServer) GetManifests(_ context.Context, _ *userapi.GetManifestsRequest, +) (*userapi.GetManifestsResponse, error) { s.logger.Info("GetManifest called") s.mux.RLock() defer s.mux.RUnlock() @@ -130,7 +130,7 @@ func (s *coordAPIServer) GetManifests(_ context.Context, _ *coordapi.GetManifest return nil, status.Error(codes.Internal, "no policies found in store") } - resp := &coordapi.GetManifestsResponse{ + resp := &userapi.GetManifestsResponse{ Manifests: manifestBytes, Policies: policySliceToBytesSlice(policies), CACert: s.caChainGetter.GetRootCACert(), @@ -141,7 +141,7 @@ func (s *coordAPIServer) GetManifests(_ context.Context, _ *coordapi.GetManifest return resp, nil } -func (s *coordAPIServer) validatePeer(ctx context.Context) error { +func (s *userAPIServer) validatePeer(ctx context.Context) error { latest, err := s.manifSetGetter.LatestManifest() if err != nil && errors.Is(err, appendable.ErrIsEmpty) { // in the initial state, no peer validation is required diff --git a/coordinator/coordapi_test.go b/coordinator/userapi_test.go similarity index 92% rename from coordinator/coordapi_test.go rename to coordinator/userapi_test.go index c31bb4bee3..da54018a99 100644 --- a/coordinator/coordapi_test.go +++ b/coordinator/userapi_test.go @@ -14,9 +14,9 @@ import ( "testing" "github.com/edgelesssys/nunki/internal/appendable" - "github.com/edgelesssys/nunki/internal/coordapi" "github.com/edgelesssys/nunki/internal/manifest" "github.com/edgelesssys/nunki/internal/memstore" + "github.com/edgelesssys/nunki/internal/userapi" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/grpc/credentials" @@ -46,19 +46,19 @@ func TestManifestSet(t *testing.T) { require.NoError(t, err) testCases := map[string]struct { - req *coordapi.SetManifestRequest + req *userapi.SetManifestRequest mSGetter *stubManifestSetGetter caGetter *stubCertChainGetter workloadOwnerKey *ecdsa.PrivateKey wantErr bool }{ "empty request": { - req: &coordapi.SetManifestRequest{}, + req: &userapi.SetManifestRequest{}, mSGetter: &stubManifestSetGetter{}, wantErr: true, }, "manifest without policies": { - req: &coordapi.SetManifestRequest{ + req: &userapi.SetManifestRequest{ Manifest: newManifestBytes(func(m *manifest.Manifest) { m.Policies = nil }), @@ -67,7 +67,7 @@ func TestManifestSet(t *testing.T) { wantErr: true, }, "request without policies": { - req: &coordapi.SetManifestRequest{ + req: &userapi.SetManifestRequest{ Manifest: newManifestBytes(func(m *manifest.Manifest) { m.Policies = map[manifest.HexString][]string{ manifest.HexString("a"): {"a1", "a2"}, @@ -79,7 +79,7 @@ func TestManifestSet(t *testing.T) { wantErr: true, }, "policy not in manifest": { - req: &coordapi.SetManifestRequest{ + req: &userapi.SetManifestRequest{ Manifest: newManifestBytes(func(m *manifest.Manifest) { m.Policies = map[manifest.HexString][]string{ manifest.HexString("ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb"): {"a1", "a2"}, @@ -95,7 +95,7 @@ func TestManifestSet(t *testing.T) { wantErr: true, }, "valid manifest": { - req: &coordapi.SetManifestRequest{ + req: &userapi.SetManifestRequest{ Manifest: newManifestBytes(func(m *manifest.Manifest) { m.Policies = map[manifest.HexString][]string{ manifest.HexString("ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb"): {"a1", "a2"}, @@ -111,7 +111,7 @@ func TestManifestSet(t *testing.T) { caGetter: &stubCertChainGetter{}, }, "valid manifest but error when setting it": { - req: &coordapi.SetManifestRequest{ + req: &userapi.SetManifestRequest{ Manifest: newManifestBytes(func(m *manifest.Manifest) { m.Policies = map[manifest.HexString][]string{ manifest.HexString("ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb"): {"a1", "a2"}, @@ -128,7 +128,7 @@ func TestManifestSet(t *testing.T) { wantErr: true, }, "workload owner key match": { - req: &coordapi.SetManifestRequest{ + req: &userapi.SetManifestRequest{ Manifest: newManifestBytes(func(m *manifest.Manifest) { m.Policies = map[manifest.HexString][]string{ manifest.HexString("ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb"): {"a1", "a2"}, @@ -147,7 +147,7 @@ func TestManifestSet(t *testing.T) { workloadOwnerKey: trustedKey, }, "workload owner key mismatch": { - req: &coordapi.SetManifestRequest{ + req: &userapi.SetManifestRequest{ Manifest: newManifestBytes(func(m *manifest.Manifest) { m.Policies = map[manifest.HexString][]string{ manifest.HexString("ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb"): {"a1", "a2"}, @@ -167,7 +167,7 @@ func TestManifestSet(t *testing.T) { wantErr: true, }, "workload owner key missing": { - req: &coordapi.SetManifestRequest{ + req: &userapi.SetManifestRequest{ Manifest: newManifestBytes(func(m *manifest.Manifest) { m.Policies = map[manifest.HexString][]string{ manifest.HexString("ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb"): {"a1", "a2"}, @@ -186,7 +186,7 @@ func TestManifestSet(t *testing.T) { wantErr: true, }, "manifest not updatable": { - req: &coordapi.SetManifestRequest{ + req: &userapi.SetManifestRequest{ Manifest: newManifestBytes(func(m *manifest.Manifest) { m.Policies = map[manifest.HexString][]string{ manifest.HexString("ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb"): {"a1", "a2"}, @@ -212,7 +212,7 @@ func TestManifestSet(t *testing.T) { assert := assert.New(t) require := require.New(t) - coordinator := coordAPIServer{ + coordinator := userAPIServer{ manifSetGetter: tc.mSGetter, caChainGetter: tc.caGetter, policyTextStore: memstore.New[manifest.HexString, manifest.Policy](), @@ -278,7 +278,7 @@ func TestGetManifests(t *testing.T) { policyStore.Set(k, v) } - coordinator := coordAPIServer{ + coordinator := userAPIServer{ manifSetGetter: tc.mSGetter, caChainGetter: tc.caGetter, policyTextStore: policyStore, @@ -286,7 +286,7 @@ func TestGetManifests(t *testing.T) { } ctx := context.Background() - resp, err := coordinator.GetManifests(ctx, &coordapi.GetManifestsRequest{}) + resp, err := coordinator.GetManifests(ctx, &userapi.GetManifestsRequest{}) if tc.wantErr { assert.Error(err) @@ -300,9 +300,9 @@ func TestGetManifests(t *testing.T) { } } -// TestCoordAPIConcurrent tests potential synchronization problems between the different +// TestUserAPIConcurrent tests potential synchronization problems between the different // gRPCs of the server. -func TestCoordAPIConcurrent(t *testing.T) { +func TestUserAPIConcurrent(t *testing.T) { newBaseManifest := func() manifest.Manifest { return manifest.Default() } @@ -316,13 +316,13 @@ func TestCoordAPIConcurrent(t *testing.T) { return b } - coordinator := coordAPIServer{ + coordinator := userAPIServer{ manifSetGetter: &stubManifestSetGetter{}, caChainGetter: &stubCertChainGetter{}, policyTextStore: memstore.New[manifest.HexString, manifest.Policy](), logger: slog.Default(), } - setReq := &coordapi.SetManifestRequest{ + setReq := &userapi.SetManifestRequest{ Manifest: newManifestBytes(func(m *manifest.Manifest) { m.Policies = map[manifest.HexString][]string{ manifest.HexString("ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb"): {"a1", "a2"}, @@ -344,7 +344,7 @@ func TestCoordAPIConcurrent(t *testing.T) { } get := func() { defer wg.Done() - _, _ = coordinator.GetManifests(ctx, &coordapi.GetManifestsRequest{}) + _, _ = coordinator.GetManifests(ctx, &userapi.GetManifestsRequest{}) } wg.Add(12) diff --git a/deployments/emojivoto/coordinator.yml b/deployments/emojivoto/coordinator.yml index 9584070f02..bdd57534c6 100644 --- a/deployments/emojivoto/coordinator.yml +++ b/deployments/emojivoto/coordinator.yml @@ -41,7 +41,7 @@ spec: - name: meshapi port: 7777 protocol: TCP - - name: coordapi + - name: userapi port: 1313 protocol: TCP selector: diff --git a/deployments/openssl/coordinator.yml b/deployments/openssl/coordinator.yml index 9584070f02..bdd57534c6 100644 --- a/deployments/openssl/coordinator.yml +++ b/deployments/openssl/coordinator.yml @@ -41,7 +41,7 @@ spec: - name: meshapi port: 7777 protocol: TCP - - name: coordapi + - name: userapi port: 1313 protocol: TCP selector: diff --git a/deployments/simple/coordinator.yml b/deployments/simple/coordinator.yml index 9584070f02..bdd57534c6 100644 --- a/deployments/simple/coordinator.yml +++ b/deployments/simple/coordinator.yml @@ -41,7 +41,7 @@ spec: - name: meshapi port: 7777 protocol: TCP - - name: coordapi + - name: userapi port: 1313 protocol: TCP selector: diff --git a/internal/coordapi/coordapi_grpc.pb.go b/internal/coordapi/coordapi_grpc.pb.go deleted file mode 100644 index 27003e6872..0000000000 --- a/internal/coordapi/coordapi_grpc.pb.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 -// source: coordapi.proto - -package coordapi - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - CoordAPI_SetManifest_FullMethodName = "/coordapi.CoordAPI/SetManifest" - CoordAPI_GetManifests_FullMethodName = "/coordapi.CoordAPI/GetManifests" -) - -// CoordAPIClient is the client API for CoordAPI service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type CoordAPIClient interface { - SetManifest(ctx context.Context, in *SetManifestRequest, opts ...grpc.CallOption) (*SetManifestResponse, error) - GetManifests(ctx context.Context, in *GetManifestsRequest, opts ...grpc.CallOption) (*GetManifestsResponse, error) -} - -type coordAPIClient struct { - cc grpc.ClientConnInterface -} - -func NewCoordAPIClient(cc grpc.ClientConnInterface) CoordAPIClient { - return &coordAPIClient{cc} -} - -func (c *coordAPIClient) SetManifest(ctx context.Context, in *SetManifestRequest, opts ...grpc.CallOption) (*SetManifestResponse, error) { - out := new(SetManifestResponse) - err := c.cc.Invoke(ctx, CoordAPI_SetManifest_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *coordAPIClient) GetManifests(ctx context.Context, in *GetManifestsRequest, opts ...grpc.CallOption) (*GetManifestsResponse, error) { - out := new(GetManifestsResponse) - err := c.cc.Invoke(ctx, CoordAPI_GetManifests_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// CoordAPIServer is the server API for CoordAPI service. -// All implementations must embed UnimplementedCoordAPIServer -// for forward compatibility -type CoordAPIServer interface { - SetManifest(context.Context, *SetManifestRequest) (*SetManifestResponse, error) - GetManifests(context.Context, *GetManifestsRequest) (*GetManifestsResponse, error) - mustEmbedUnimplementedCoordAPIServer() -} - -// UnimplementedCoordAPIServer must be embedded to have forward compatible implementations. -type UnimplementedCoordAPIServer struct { -} - -func (UnimplementedCoordAPIServer) SetManifest(context.Context, *SetManifestRequest) (*SetManifestResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetManifest not implemented") -} -func (UnimplementedCoordAPIServer) GetManifests(context.Context, *GetManifestsRequest) (*GetManifestsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetManifests not implemented") -} -func (UnimplementedCoordAPIServer) mustEmbedUnimplementedCoordAPIServer() {} - -// UnsafeCoordAPIServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to CoordAPIServer will -// result in compilation errors. -type UnsafeCoordAPIServer interface { - mustEmbedUnimplementedCoordAPIServer() -} - -func RegisterCoordAPIServer(s grpc.ServiceRegistrar, srv CoordAPIServer) { - s.RegisterService(&CoordAPI_ServiceDesc, srv) -} - -func _CoordAPI_SetManifest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SetManifestRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CoordAPIServer).SetManifest(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CoordAPI_SetManifest_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CoordAPIServer).SetManifest(ctx, req.(*SetManifestRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CoordAPI_GetManifests_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetManifestsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CoordAPIServer).GetManifests(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CoordAPI_GetManifests_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CoordAPIServer).GetManifests(ctx, req.(*GetManifestsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// CoordAPI_ServiceDesc is the grpc.ServiceDesc for CoordAPI service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var CoordAPI_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "coordapi.CoordAPI", - HandlerType: (*CoordAPIServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "SetManifest", - Handler: _CoordAPI_SetManifest_Handler, - }, - { - MethodName: "GetManifests", - Handler: _CoordAPI_GetManifests_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "coordapi.proto", -} diff --git a/internal/coordapi/coordapi.go b/internal/userapi/userapi.go similarity index 61% rename from internal/coordapi/coordapi.go rename to internal/userapi/userapi.go index 08a0b94707..2f8e81c0ac 100644 --- a/internal/coordapi/coordapi.go +++ b/internal/userapi/userapi.go @@ -1,6 +1,6 @@ -package coordapi +package userapi -//go:generate protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative coordapi.proto +//go:generate protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative userapi.proto // Port is the port of the coordinator API. const Port = "1313" diff --git a/internal/coordapi/coordapi.pb.go b/internal/userapi/userapi.pb.go similarity index 56% rename from internal/coordapi/coordapi.pb.go rename to internal/userapi/userapi.pb.go index 52e87fa539..48a5890811 100644 --- a/internal/coordapi/coordapi.pb.go +++ b/internal/userapi/userapi.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.32.0 // protoc v4.24.4 -// source: coordapi.proto +// source: userapi.proto -package coordapi +package userapi import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -32,7 +32,7 @@ type SetManifestRequest struct { func (x *SetManifestRequest) Reset() { *x = SetManifestRequest{} if protoimpl.UnsafeEnabled { - mi := &file_coordapi_proto_msgTypes[0] + mi := &file_userapi_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -45,7 +45,7 @@ func (x *SetManifestRequest) String() string { func (*SetManifestRequest) ProtoMessage() {} func (x *SetManifestRequest) ProtoReflect() protoreflect.Message { - mi := &file_coordapi_proto_msgTypes[0] + mi := &file_userapi_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -58,7 +58,7 @@ func (x *SetManifestRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SetManifestRequest.ProtoReflect.Descriptor instead. func (*SetManifestRequest) Descriptor() ([]byte, []int) { - return file_coordapi_proto_rawDescGZIP(), []int{0} + return file_userapi_proto_rawDescGZIP(), []int{0} } func (x *SetManifestRequest) GetManifest() []byte { @@ -89,7 +89,7 @@ type SetManifestResponse struct { func (x *SetManifestResponse) Reset() { *x = SetManifestResponse{} if protoimpl.UnsafeEnabled { - mi := &file_coordapi_proto_msgTypes[1] + mi := &file_userapi_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102,7 +102,7 @@ func (x *SetManifestResponse) String() string { func (*SetManifestResponse) ProtoMessage() {} func (x *SetManifestResponse) ProtoReflect() protoreflect.Message { - mi := &file_coordapi_proto_msgTypes[1] + mi := &file_userapi_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115,7 +115,7 @@ func (x *SetManifestResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SetManifestResponse.ProtoReflect.Descriptor instead. func (*SetManifestResponse) Descriptor() ([]byte, []int) { - return file_coordapi_proto_rawDescGZIP(), []int{1} + return file_userapi_proto_rawDescGZIP(), []int{1} } func (x *SetManifestResponse) GetCACert() []byte { @@ -141,7 +141,7 @@ type GetManifestsRequest struct { func (x *GetManifestsRequest) Reset() { *x = GetManifestsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_coordapi_proto_msgTypes[2] + mi := &file_userapi_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -154,7 +154,7 @@ func (x *GetManifestsRequest) String() string { func (*GetManifestsRequest) ProtoMessage() {} func (x *GetManifestsRequest) ProtoReflect() protoreflect.Message { - mi := &file_coordapi_proto_msgTypes[2] + mi := &file_userapi_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -167,7 +167,7 @@ func (x *GetManifestsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetManifestsRequest.ProtoReflect.Descriptor instead. func (*GetManifestsRequest) Descriptor() ([]byte, []int) { - return file_coordapi_proto_rawDescGZIP(), []int{2} + return file_userapi_proto_rawDescGZIP(), []int{2} } type GetManifestsResponse struct { @@ -186,7 +186,7 @@ type GetManifestsResponse struct { func (x *GetManifestsResponse) Reset() { *x = GetManifestsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_coordapi_proto_msgTypes[3] + mi := &file_userapi_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -199,7 +199,7 @@ func (x *GetManifestsResponse) String() string { func (*GetManifestsResponse) ProtoMessage() {} func (x *GetManifestsResponse) ProtoReflect() protoreflect.Message { - mi := &file_coordapi_proto_msgTypes[3] + mi := &file_userapi_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -212,7 +212,7 @@ func (x *GetManifestsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetManifestsResponse.ProtoReflect.Descriptor instead. func (*GetManifestsResponse) Descriptor() ([]byte, []int) { - return file_coordapi_proto_rawDescGZIP(), []int{3} + return file_userapi_proto_rawDescGZIP(), []int{3} } func (x *GetManifestsResponse) GetManifests() [][]byte { @@ -243,71 +243,71 @@ func (x *GetManifestsResponse) GetIntermCert() []byte { return nil } -var File_coordapi_proto protoreflect.FileDescriptor - -var file_coordapi_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x08, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x61, 0x70, 0x69, 0x22, 0x4c, 0x0a, 0x12, 0x53, 0x65, - 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x08, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, - 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, - 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x22, 0x4d, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x4d, - 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x43, 0x41, 0x43, 0x65, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, +var File_userapi_proto protoreflect.FileDescriptor + +var file_userapi_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x07, 0x75, 0x73, 0x65, 0x72, 0x61, 0x70, 0x69, 0x22, 0x4c, 0x0a, 0x12, 0x53, 0x65, 0x74, 0x4d, + 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, + 0x0a, 0x08, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x08, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6f, + 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x50, 0x6f, + 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x22, 0x4d, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x6e, + 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x43, 0x41, 0x43, 0x65, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x43, + 0x41, 0x43, 0x65, 0x72, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x43, + 0x65, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x49, 0x6e, 0x74, 0x65, 0x72, + 0x6d, 0x43, 0x65, 0x72, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, + 0x66, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x88, 0x01, 0x0a, + 0x14, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, + 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, + 0x73, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, + 0x16, 0x0a, 0x06, 0x43, 0x41, 0x43, 0x65, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x43, 0x41, 0x43, 0x65, 0x72, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e, 0x74, 0x65, 0x72, - 0x6d, 0x43, 0x65, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x6d, 0x43, 0x65, 0x72, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4d, 0x61, - 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x88, - 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x61, 0x6e, 0x69, 0x66, - 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x4d, 0x61, 0x6e, 0x69, - 0x66, 0x65, 0x73, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, - 0x73, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x41, 0x43, 0x65, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x06, 0x43, 0x41, 0x43, 0x65, 0x72, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x6d, 0x43, 0x65, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x49, - 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x43, 0x65, 0x72, 0x74, 0x32, 0xa5, 0x01, 0x0a, 0x08, 0x43, 0x6f, - 0x6f, 0x72, 0x64, 0x41, 0x50, 0x49, 0x12, 0x4a, 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x6e, - 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x2e, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x61, 0x70, 0x69, - 0x2e, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x61, 0x70, 0x69, 0x2e, 0x53, - 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, - 0x74, 0x73, 0x12, 0x1d, 0x2e, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, - 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1e, 0x2e, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, - 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x42, 0x30, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x65, 0x64, 0x67, 0x65, 0x6c, 0x65, 0x73, 0x73, 0x73, 0x79, 0x73, 0x2f, 0x6e, 0x75, 0x6e, 0x6b, - 0x69, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6f, 0x6f, 0x72, 0x64, - 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x43, 0x65, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x6d, 0x43, 0x65, 0x72, 0x74, 0x32, 0xa0, 0x01, 0x0a, 0x07, 0x55, 0x73, 0x65, 0x72, + 0x41, 0x50, 0x49, 0x12, 0x48, 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, + 0x73, 0x74, 0x12, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x74, + 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x74, 0x4d, 0x61, 0x6e, + 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, + 0x0c, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x73, 0x12, 0x1c, 0x2e, + 0x75, 0x73, 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, + 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x75, 0x73, + 0x65, 0x72, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x64, 0x67, 0x65, 0x6c, 0x65, 0x73, + 0x73, 0x73, 0x79, 0x73, 0x2f, 0x6e, 0x75, 0x6e, 0x6b, 0x69, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( - file_coordapi_proto_rawDescOnce sync.Once - file_coordapi_proto_rawDescData = file_coordapi_proto_rawDesc + file_userapi_proto_rawDescOnce sync.Once + file_userapi_proto_rawDescData = file_userapi_proto_rawDesc ) -func file_coordapi_proto_rawDescGZIP() []byte { - file_coordapi_proto_rawDescOnce.Do(func() { - file_coordapi_proto_rawDescData = protoimpl.X.CompressGZIP(file_coordapi_proto_rawDescData) +func file_userapi_proto_rawDescGZIP() []byte { + file_userapi_proto_rawDescOnce.Do(func() { + file_userapi_proto_rawDescData = protoimpl.X.CompressGZIP(file_userapi_proto_rawDescData) }) - return file_coordapi_proto_rawDescData + return file_userapi_proto_rawDescData } -var file_coordapi_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_coordapi_proto_goTypes = []interface{}{ - (*SetManifestRequest)(nil), // 0: coordapi.SetManifestRequest - (*SetManifestResponse)(nil), // 1: coordapi.SetManifestResponse - (*GetManifestsRequest)(nil), // 2: coordapi.GetManifestsRequest - (*GetManifestsResponse)(nil), // 3: coordapi.GetManifestsResponse +var file_userapi_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_userapi_proto_goTypes = []interface{}{ + (*SetManifestRequest)(nil), // 0: userapi.SetManifestRequest + (*SetManifestResponse)(nil), // 1: userapi.SetManifestResponse + (*GetManifestsRequest)(nil), // 2: userapi.GetManifestsRequest + (*GetManifestsResponse)(nil), // 3: userapi.GetManifestsResponse } -var file_coordapi_proto_depIdxs = []int32{ - 0, // 0: coordapi.CoordAPI.SetManifest:input_type -> coordapi.SetManifestRequest - 2, // 1: coordapi.CoordAPI.GetManifests:input_type -> coordapi.GetManifestsRequest - 1, // 2: coordapi.CoordAPI.SetManifest:output_type -> coordapi.SetManifestResponse - 3, // 3: coordapi.CoordAPI.GetManifests:output_type -> coordapi.GetManifestsResponse +var file_userapi_proto_depIdxs = []int32{ + 0, // 0: userapi.UserAPI.SetManifest:input_type -> userapi.SetManifestRequest + 2, // 1: userapi.UserAPI.GetManifests:input_type -> userapi.GetManifestsRequest + 1, // 2: userapi.UserAPI.SetManifest:output_type -> userapi.SetManifestResponse + 3, // 3: userapi.UserAPI.GetManifests:output_type -> userapi.GetManifestsResponse 2, // [2:4] is the sub-list for method output_type 0, // [0:2] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -315,13 +315,13 @@ var file_coordapi_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_coordapi_proto_init() } -func file_coordapi_proto_init() { - if File_coordapi_proto != nil { +func init() { file_userapi_proto_init() } +func file_userapi_proto_init() { + if File_userapi_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_coordapi_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_userapi_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SetManifestRequest); i { case 0: return &v.state @@ -333,7 +333,7 @@ func file_coordapi_proto_init() { return nil } } - file_coordapi_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_userapi_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SetManifestResponse); i { case 0: return &v.state @@ -345,7 +345,7 @@ func file_coordapi_proto_init() { return nil } } - file_coordapi_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_userapi_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetManifestsRequest); i { case 0: return &v.state @@ -357,7 +357,7 @@ func file_coordapi_proto_init() { return nil } } - file_coordapi_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_userapi_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetManifestsResponse); i { case 0: return &v.state @@ -374,18 +374,18 @@ func file_coordapi_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_coordapi_proto_rawDesc, + RawDescriptor: file_userapi_proto_rawDesc, NumEnums: 0, NumMessages: 4, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_coordapi_proto_goTypes, - DependencyIndexes: file_coordapi_proto_depIdxs, - MessageInfos: file_coordapi_proto_msgTypes, + GoTypes: file_userapi_proto_goTypes, + DependencyIndexes: file_userapi_proto_depIdxs, + MessageInfos: file_userapi_proto_msgTypes, }.Build() - File_coordapi_proto = out.File - file_coordapi_proto_rawDesc = nil - file_coordapi_proto_goTypes = nil - file_coordapi_proto_depIdxs = nil + File_userapi_proto = out.File + file_userapi_proto_rawDesc = nil + file_userapi_proto_goTypes = nil + file_userapi_proto_depIdxs = nil } diff --git a/internal/coordapi/coordapi.proto b/internal/userapi/userapi.proto similarity index 85% rename from internal/coordapi/coordapi.proto rename to internal/userapi/userapi.proto index 02e7d21f05..37e1b7cf3f 100644 --- a/internal/coordapi/coordapi.proto +++ b/internal/userapi/userapi.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -package coordapi; +package userapi; -option go_package = "github.com/edgelesssys/nunki/internal/coordapi"; +option go_package = "github.com/edgelesssys/nunki/internal/userapi"; -service CoordAPI { +service UserAPI { rpc SetManifest(SetManifestRequest) returns (SetManifestResponse); rpc GetManifests(GetManifestsRequest) returns (GetManifestsResponse); } diff --git a/internal/userapi/userapi_grpc.pb.go b/internal/userapi/userapi_grpc.pb.go new file mode 100644 index 0000000000..8d55ab00d2 --- /dev/null +++ b/internal/userapi/userapi_grpc.pb.go @@ -0,0 +1,146 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.24.4 +// source: userapi.proto + +package userapi + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + UserAPI_SetManifest_FullMethodName = "/userapi.UserAPI/SetManifest" + UserAPI_GetManifests_FullMethodName = "/userapi.UserAPI/GetManifests" +) + +// UserAPIClient is the client API for UserAPI service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type UserAPIClient interface { + SetManifest(ctx context.Context, in *SetManifestRequest, opts ...grpc.CallOption) (*SetManifestResponse, error) + GetManifests(ctx context.Context, in *GetManifestsRequest, opts ...grpc.CallOption) (*GetManifestsResponse, error) +} + +type userAPIClient struct { + cc grpc.ClientConnInterface +} + +func NewUserAPIClient(cc grpc.ClientConnInterface) UserAPIClient { + return &userAPIClient{cc} +} + +func (c *userAPIClient) SetManifest(ctx context.Context, in *SetManifestRequest, opts ...grpc.CallOption) (*SetManifestResponse, error) { + out := new(SetManifestResponse) + err := c.cc.Invoke(ctx, UserAPI_SetManifest_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userAPIClient) GetManifests(ctx context.Context, in *GetManifestsRequest, opts ...grpc.CallOption) (*GetManifestsResponse, error) { + out := new(GetManifestsResponse) + err := c.cc.Invoke(ctx, UserAPI_GetManifests_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// UserAPIServer is the server API for UserAPI service. +// All implementations must embed UnimplementedUserAPIServer +// for forward compatibility +type UserAPIServer interface { + SetManifest(context.Context, *SetManifestRequest) (*SetManifestResponse, error) + GetManifests(context.Context, *GetManifestsRequest) (*GetManifestsResponse, error) + mustEmbedUnimplementedUserAPIServer() +} + +// UnimplementedUserAPIServer must be embedded to have forward compatible implementations. +type UnimplementedUserAPIServer struct { +} + +func (UnimplementedUserAPIServer) SetManifest(context.Context, *SetManifestRequest) (*SetManifestResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetManifest not implemented") +} +func (UnimplementedUserAPIServer) GetManifests(context.Context, *GetManifestsRequest) (*GetManifestsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetManifests not implemented") +} +func (UnimplementedUserAPIServer) mustEmbedUnimplementedUserAPIServer() {} + +// UnsafeUserAPIServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to UserAPIServer will +// result in compilation errors. +type UnsafeUserAPIServer interface { + mustEmbedUnimplementedUserAPIServer() +} + +func RegisterUserAPIServer(s grpc.ServiceRegistrar, srv UserAPIServer) { + s.RegisterService(&UserAPI_ServiceDesc, srv) +} + +func _UserAPI_SetManifest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetManifestRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserAPIServer).SetManifest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserAPI_SetManifest_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserAPIServer).SetManifest(ctx, req.(*SetManifestRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserAPI_GetManifests_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetManifestsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserAPIServer).GetManifests(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserAPI_GetManifests_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserAPIServer).GetManifests(ctx, req.(*GetManifestsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// UserAPI_ServiceDesc is the grpc.ServiceDesc for UserAPI service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var UserAPI_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "userapi.UserAPI", + HandlerType: (*UserAPIServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SetManifest", + Handler: _UserAPI_SetManifest_Handler, + }, + { + MethodName: "GetManifests", + Handler: _UserAPI_GetManifests_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "userapi.proto", +}