diff --git a/components/agent/internal/grpc/client.go b/components/agent/internal/grpc/client.go index 3d3cd40a29..af174b91fb 100644 --- a/components/agent/internal/grpc/client.go +++ b/components/agent/internal/grpc/client.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc/metadata" controllererrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/watch" ) type K8SClient interface { @@ -27,6 +28,7 @@ type K8SClient interface { Create(ctx context.Context, stack *v1beta3.Stack) (*v1beta3.Stack, error) Update(ctx context.Context, stack *v1beta3.Stack) (*v1beta3.Stack, error) Delete(ctx context.Context, name string) error + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) } type Authenticator interface { @@ -94,16 +96,22 @@ func (client *client) Connect(ctx context.Context) error { return errors.Wrap(err, "authenticating client") } + md.Append("id", client.id) + md.Append("baseUrl", client.baseUrl.String()) + md.Append("production", func() string { + if client.production { + return "true" + } + return "false" + }()) + connectContext := metadata.NewOutgoingContext(client.connectContext, md) - connectClient, err := client.grpcClient.Connect(connectContext, &generated.ConnectRequest{ - Id: client.id, - BaseUrl: client.baseUrl.String(), - Production: client.production, - }) + connectClient, err := client.grpcClient.Join(connectContext) if err != nil { return err } client.connectClient = connectClient + return nil } @@ -149,14 +157,20 @@ func (client *client) Start(ctx context.Context) error { ctx, cancel := context.WithCancel(ctx) defer cancel() + watcher, err := client.k8sClient.Watch(ctx, metav1.ListOptions{}) + if err != nil { + return err + } + defer watcher.Stop() + var ( closed = false errCh = make(chan error, 1) - msgs = make(chan *generated.ConnectResponse) + msgs = make(chan *generated.Order) ) go func() { for { - msg := &generated.ConnectResponse{} + msg := &generated.Order{} if err := client.connectClient.RecvMsg(msg); err != nil { if err == io.EOF { if !closed { @@ -188,7 +202,7 @@ func (client *client) Start(ctx context.Context) error { } client.connectCancel() for { - msg := &generated.ConnectResponse{} + msg := &generated.Order{} if err := client.connectClient.RecvMsg(msg); err != nil { // Drain messages break } @@ -199,9 +213,23 @@ func (client *client) Start(ctx context.Context) error { case err := <-errCh: sharedlogging.FromContext(ctx).Errorf("Stream closed with error: %s", err) return err + case k8sUpdate := <-watcher.ResultChan(): + stack := k8sUpdate.Object.(*v1beta3.Stack) + sharedlogging.FromContext(ctx).Infof("Got update for stack '%s'", stack.Name) + if err := client.connectClient.SendMsg(&generated.StatusChanged{ + StackId: stack.Name, + Status: func() generated.StackStatus { + if stack.IsReady() { + return generated.StackStatus_Ready + } + return generated.StackStatus_Progressing + }(), + }); err != nil { + sharedlogging.FromContext(ctx).Errorf("Unable to send stack status to server: %s", err) + } case msg := <-msgs: switch msg := msg.Message.(type) { - case *generated.ConnectResponse_ExistingStack: + case *generated.Order_ExistingStack: crd := client.k8sStackFromProtobuf(msg.ExistingStack) existingStack, err := client.k8sClient.Get(ctx, crd.Name, metav1.GetOptions{}) if err != nil { @@ -222,12 +250,12 @@ func (client *client) Start(ctx context.Context) error { } sharedlogging.FromContext(ctx).Infof("stack %s updated", crd.Name) - case *generated.ConnectResponse_DeletedStack: + case *generated.Order_DeletedStack: if err := client.k8sClient.Delete(ctx, msg.DeletedStack.ClusterName); err != nil { sharedlogging.FromContext(ctx).Errorf("creating deleting cluster side: %s", err) } sharedlogging.FromContext(ctx).Infof("stack %s deleted", msg.DeletedStack.ClusterName) - case *generated.ConnectResponse_DisabledStack: + case *generated.Order_DisabledStack: existingStack, err := client.k8sClient.Get(ctx, msg.DisabledStack.ClusterName, metav1.GetOptions{}) if err != nil { if controllererrors.IsNotFound(err) { @@ -243,7 +271,7 @@ func (client *client) Start(ctx context.Context) error { continue } sharedlogging.FromContext(ctx).Infof("stack %s disabled", msg.DisabledStack.ClusterName) - case *generated.ConnectResponse_EnabledStack: + case *generated.Order_EnabledStack: existingStack, err := client.k8sClient.Get(ctx, msg.EnabledStack.ClusterName, metav1.GetOptions{}) if err != nil { if controllererrors.IsNotFound(err) { @@ -259,7 +287,7 @@ func (client *client) Start(ctx context.Context) error { continue } sharedlogging.FromContext(ctx).Infof("stack %s enabled", msg.EnabledStack.ClusterName) - case *generated.ConnectResponse_UpdateUsageReport: + case *generated.Order_UpdateUsageReport: total, err := CountDocument(msg.UpdateUsageReport.ClusterName) if err != nil { sharedlogging.FromContext(ctx).Errorf("counting documents: %s", err) diff --git a/components/agent/internal/grpc/generated/server.pb.go b/components/agent/internal/grpc/generated/server.pb.go index 455dbfca51..a4f9d61fd3 100644 --- a/components/agent/internal/grpc/generated/server.pb.go +++ b/components/agent/internal/grpc/generated/server.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.30.0 // protoc v3.21.12 // source: server.proto @@ -20,6 +20,52 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type StackStatus int32 + +const ( + StackStatus_Progressing StackStatus = 0 + StackStatus_Ready StackStatus = 1 +) + +// Enum value maps for StackStatus. +var ( + StackStatus_name = map[int32]string{ + 0: "Progressing", + 1: "Ready", + } + StackStatus_value = map[string]int32{ + "Progressing": 0, + "Ready": 1, + } +) + +func (x StackStatus) Enum() *StackStatus { + p := new(StackStatus) + *p = x + return p +} + +func (x StackStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StackStatus) Descriptor() protoreflect.EnumDescriptor { + return file_server_proto_enumTypes[0].Descriptor() +} + +func (StackStatus) Type() protoreflect.EnumType { + return &file_server_proto_enumTypes[0] +} + +func (x StackStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use StackStatus.Descriptor instead. +func (StackStatus) EnumDescriptor() ([]byte, []int) { + return file_server_proto_rawDescGZIP(), []int{0} +} + type ConnectRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -91,24 +137,25 @@ func (x *ConnectRequest) GetProduction() bool { return false } -type ConnectResponse struct { +type Order struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to Message: - // *ConnectResponse_Connected - // *ConnectResponse_ExistingStack - // *ConnectResponse_DeletedStack - // *ConnectResponse_Ping - // *ConnectResponse_UpdateUsageReport - // *ConnectResponse_DisabledStack - // *ConnectResponse_EnabledStack - Message isConnectResponse_Message `protobuf_oneof:"message"` -} - -func (x *ConnectResponse) Reset() { - *x = ConnectResponse{} + // + // *Order_Connected + // *Order_ExistingStack + // *Order_DeletedStack + // *Order_Ping + // *Order_UpdateUsageReport + // *Order_DisabledStack + // *Order_EnabledStack + Message isOrder_Message `protobuf_oneof:"message"` +} + +func (x *Order) Reset() { + *x = Order{} if protoimpl.UnsafeEnabled { mi := &file_server_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -116,13 +163,13 @@ func (x *ConnectResponse) Reset() { } } -func (x *ConnectResponse) String() string { +func (x *Order) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ConnectResponse) ProtoMessage() {} +func (*Order) ProtoMessage() {} -func (x *ConnectResponse) ProtoReflect() protoreflect.Message { +func (x *Order) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -134,112 +181,112 @@ func (x *ConnectResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ConnectResponse.ProtoReflect.Descriptor instead. -func (*ConnectResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use Order.ProtoReflect.Descriptor instead. +func (*Order) Descriptor() ([]byte, []int) { return file_server_proto_rawDescGZIP(), []int{1} } -func (m *ConnectResponse) GetMessage() isConnectResponse_Message { +func (m *Order) GetMessage() isOrder_Message { if m != nil { return m.Message } return nil } -func (x *ConnectResponse) GetConnected() *Connected { - if x, ok := x.GetMessage().(*ConnectResponse_Connected); ok { +func (x *Order) GetConnected() *Connected { + if x, ok := x.GetMessage().(*Order_Connected); ok { return x.Connected } return nil } -func (x *ConnectResponse) GetExistingStack() *Stack { - if x, ok := x.GetMessage().(*ConnectResponse_ExistingStack); ok { +func (x *Order) GetExistingStack() *Stack { + if x, ok := x.GetMessage().(*Order_ExistingStack); ok { return x.ExistingStack } return nil } -func (x *ConnectResponse) GetDeletedStack() *DeletedStack { - if x, ok := x.GetMessage().(*ConnectResponse_DeletedStack); ok { +func (x *Order) GetDeletedStack() *DeletedStack { + if x, ok := x.GetMessage().(*Order_DeletedStack); ok { return x.DeletedStack } return nil } -func (x *ConnectResponse) GetPing() *Ping { - if x, ok := x.GetMessage().(*ConnectResponse_Ping); ok { +func (x *Order) GetPing() *Ping { + if x, ok := x.GetMessage().(*Order_Ping); ok { return x.Ping } return nil } -func (x *ConnectResponse) GetUpdateUsageReport() *UpdateUsageReport { - if x, ok := x.GetMessage().(*ConnectResponse_UpdateUsageReport); ok { +func (x *Order) GetUpdateUsageReport() *UpdateUsageReport { + if x, ok := x.GetMessage().(*Order_UpdateUsageReport); ok { return x.UpdateUsageReport } return nil } -func (x *ConnectResponse) GetDisabledStack() *DisabledStack { - if x, ok := x.GetMessage().(*ConnectResponse_DisabledStack); ok { +func (x *Order) GetDisabledStack() *DisabledStack { + if x, ok := x.GetMessage().(*Order_DisabledStack); ok { return x.DisabledStack } return nil } -func (x *ConnectResponse) GetEnabledStack() *EnabledStack { - if x, ok := x.GetMessage().(*ConnectResponse_EnabledStack); ok { +func (x *Order) GetEnabledStack() *EnabledStack { + if x, ok := x.GetMessage().(*Order_EnabledStack); ok { return x.EnabledStack } return nil } -type isConnectResponse_Message interface { - isConnectResponse_Message() +type isOrder_Message interface { + isOrder_Message() } -type ConnectResponse_Connected struct { +type Order_Connected struct { Connected *Connected `protobuf:"bytes,1,opt,name=connected,proto3,oneof"` } -type ConnectResponse_ExistingStack struct { +type Order_ExistingStack struct { ExistingStack *Stack `protobuf:"bytes,2,opt,name=existingStack,proto3,oneof"` } -type ConnectResponse_DeletedStack struct { +type Order_DeletedStack struct { DeletedStack *DeletedStack `protobuf:"bytes,3,opt,name=deletedStack,proto3,oneof"` } -type ConnectResponse_Ping struct { +type Order_Ping struct { Ping *Ping `protobuf:"bytes,4,opt,name=ping,proto3,oneof"` } -type ConnectResponse_UpdateUsageReport struct { +type Order_UpdateUsageReport struct { UpdateUsageReport *UpdateUsageReport `protobuf:"bytes,5,opt,name=updateUsageReport,proto3,oneof"` } -type ConnectResponse_DisabledStack struct { +type Order_DisabledStack struct { DisabledStack *DisabledStack `protobuf:"bytes,6,opt,name=disabledStack,proto3,oneof"` } -type ConnectResponse_EnabledStack struct { +type Order_EnabledStack struct { EnabledStack *EnabledStack `protobuf:"bytes,7,opt,name=enabledStack,proto3,oneof"` } -func (*ConnectResponse_Connected) isConnectResponse_Message() {} +func (*Order_Connected) isOrder_Message() {} -func (*ConnectResponse_ExistingStack) isConnectResponse_Message() {} +func (*Order_ExistingStack) isOrder_Message() {} -func (*ConnectResponse_DeletedStack) isConnectResponse_Message() {} +func (*Order_DeletedStack) isOrder_Message() {} -func (*ConnectResponse_Ping) isConnectResponse_Message() {} +func (*Order_Ping) isOrder_Message() {} -func (*ConnectResponse_UpdateUsageReport) isConnectResponse_Message() {} +func (*Order_UpdateUsageReport) isOrder_Message() {} -func (*ConnectResponse_DisabledStack) isConnectResponse_Message() {} +func (*Order_DisabledStack) isOrder_Message() {} -func (*ConnectResponse_EnabledStack) isConnectResponse_Message() {} +func (*Order_EnabledStack) isOrder_Message() {} type Connected struct { state protoimpl.MessageState @@ -396,6 +443,61 @@ func (x *Stack) GetStargateConfig() *StargateConfig { return nil } +type StatusChanged struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StackId string `protobuf:"bytes,1,opt,name=stackId,proto3" json:"stackId,omitempty"` + Status StackStatus `protobuf:"varint,2,opt,name=status,proto3,enum=server.StackStatus" json:"status,omitempty"` +} + +func (x *StatusChanged) Reset() { + *x = StatusChanged{} + if protoimpl.UnsafeEnabled { + mi := &file_server_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatusChanged) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusChanged) ProtoMessage() {} + +func (x *StatusChanged) ProtoReflect() protoreflect.Message { + mi := &file_server_proto_msgTypes[5] + 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 StatusChanged.ProtoReflect.Descriptor instead. +func (*StatusChanged) Descriptor() ([]byte, []int) { + return file_server_proto_rawDescGZIP(), []int{5} +} + +func (x *StatusChanged) GetStackId() string { + if x != nil { + return x.StackId + } + return "" +} + +func (x *StatusChanged) GetStatus() StackStatus { + if x != nil { + return x.Status + } + return StackStatus_Progressing +} + type StargateConfig struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -408,7 +510,7 @@ type StargateConfig struct { func (x *StargateConfig) Reset() { *x = StargateConfig{} if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[5] + mi := &file_server_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -421,7 +523,7 @@ func (x *StargateConfig) String() string { func (*StargateConfig) ProtoMessage() {} func (x *StargateConfig) ProtoReflect() protoreflect.Message { - mi := &file_server_proto_msgTypes[5] + mi := &file_server_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -434,7 +536,7 @@ func (x *StargateConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use StargateConfig.ProtoReflect.Descriptor instead. func (*StargateConfig) Descriptor() ([]byte, []int) { - return file_server_proto_rawDescGZIP(), []int{5} + return file_server_proto_rawDescGZIP(), []int{6} } func (x *StargateConfig) GetEnabled() bool { @@ -462,7 +564,7 @@ type DeletedStack struct { func (x *DeletedStack) Reset() { *x = DeletedStack{} if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[6] + mi := &file_server_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -475,7 +577,7 @@ func (x *DeletedStack) String() string { func (*DeletedStack) ProtoMessage() {} func (x *DeletedStack) ProtoReflect() protoreflect.Message { - mi := &file_server_proto_msgTypes[6] + mi := &file_server_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -488,7 +590,7 @@ func (x *DeletedStack) ProtoReflect() protoreflect.Message { // Deprecated: Use DeletedStack.ProtoReflect.Descriptor instead. func (*DeletedStack) Descriptor() ([]byte, []int) { - return file_server_proto_rawDescGZIP(), []int{6} + return file_server_proto_rawDescGZIP(), []int{7} } func (x *DeletedStack) GetClusterName() string { @@ -509,7 +611,7 @@ type DisabledStack struct { func (x *DisabledStack) Reset() { *x = DisabledStack{} if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[7] + mi := &file_server_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -522,7 +624,7 @@ func (x *DisabledStack) String() string { func (*DisabledStack) ProtoMessage() {} func (x *DisabledStack) ProtoReflect() protoreflect.Message { - mi := &file_server_proto_msgTypes[7] + mi := &file_server_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -535,7 +637,7 @@ func (x *DisabledStack) ProtoReflect() protoreflect.Message { // Deprecated: Use DisabledStack.ProtoReflect.Descriptor instead. func (*DisabledStack) Descriptor() ([]byte, []int) { - return file_server_proto_rawDescGZIP(), []int{7} + return file_server_proto_rawDescGZIP(), []int{8} } func (x *DisabledStack) GetClusterName() string { @@ -556,7 +658,7 @@ type EnabledStack struct { func (x *EnabledStack) Reset() { *x = EnabledStack{} if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[8] + mi := &file_server_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -569,7 +671,7 @@ func (x *EnabledStack) String() string { func (*EnabledStack) ProtoMessage() {} func (x *EnabledStack) ProtoReflect() protoreflect.Message { - mi := &file_server_proto_msgTypes[8] + mi := &file_server_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -582,7 +684,7 @@ func (x *EnabledStack) ProtoReflect() protoreflect.Message { // Deprecated: Use EnabledStack.ProtoReflect.Descriptor instead. func (*EnabledStack) Descriptor() ([]byte, []int) { - return file_server_proto_rawDescGZIP(), []int{8} + return file_server_proto_rawDescGZIP(), []int{9} } func (x *EnabledStack) GetClusterName() string { @@ -605,7 +707,7 @@ type UpdateUsageReport struct { func (x *UpdateUsageReport) Reset() { *x = UpdateUsageReport{} if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[9] + mi := &file_server_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -618,7 +720,7 @@ func (x *UpdateUsageReport) String() string { func (*UpdateUsageReport) ProtoMessage() {} func (x *UpdateUsageReport) ProtoReflect() protoreflect.Message { - mi := &file_server_proto_msgTypes[9] + mi := &file_server_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -631,7 +733,7 @@ func (x *UpdateUsageReport) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateUsageReport.ProtoReflect.Descriptor instead. func (*UpdateUsageReport) Descriptor() ([]byte, []int) { - return file_server_proto_rawDescGZIP(), []int{9} + return file_server_proto_rawDescGZIP(), []int{10} } func (x *UpdateUsageReport) GetClusterName() string { @@ -668,7 +770,7 @@ type AuthConfig struct { func (x *AuthConfig) Reset() { *x = AuthConfig{} if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[10] + mi := &file_server_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -681,7 +783,7 @@ func (x *AuthConfig) String() string { func (*AuthConfig) ProtoMessage() {} func (x *AuthConfig) ProtoReflect() protoreflect.Message { - mi := &file_server_proto_msgTypes[10] + mi := &file_server_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -694,7 +796,7 @@ func (x *AuthConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use AuthConfig.ProtoReflect.Descriptor instead. func (*AuthConfig) Descriptor() ([]byte, []int) { - return file_server_proto_rawDescGZIP(), []int{10} + return file_server_proto_rawDescGZIP(), []int{11} } func (x *AuthConfig) GetClientId() string { @@ -730,7 +832,7 @@ type AuthClient struct { func (x *AuthClient) Reset() { *x = AuthClient{} if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[11] + mi := &file_server_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -743,7 +845,7 @@ func (x *AuthClient) String() string { func (*AuthClient) ProtoMessage() {} func (x *AuthClient) ProtoReflect() protoreflect.Message { - mi := &file_server_proto_msgTypes[11] + mi := &file_server_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -756,7 +858,7 @@ func (x *AuthClient) ProtoReflect() protoreflect.Message { // Deprecated: Use AuthClient.ProtoReflect.Descriptor instead. func (*AuthClient) Descriptor() ([]byte, []int) { - return file_server_proto_rawDescGZIP(), []int{11} + return file_server_proto_rawDescGZIP(), []int{12} } func (x *AuthClient) GetPublic() bool { @@ -790,90 +892,100 @@ var file_server_proto_rawDesc = []byte{ 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x22, 0xac, 0x03, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x09, - 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x0d, 0x65, 0x78, 0x69, - 0x73, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x48, - 0x00, 0x52, 0x0d, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x63, 0x6b, - 0x12, 0x3a, 0x0a, 0x0c, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0c, - 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x04, - 0x70, 0x69, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x04, 0x70, 0x69, 0x6e, 0x67, - 0x12, 0x49, 0x0a, 0x11, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, - 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x48, 0x00, 0x52, 0x11, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x3d, 0x0a, 0x0d, 0x64, - 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x61, - 0x62, 0x6c, 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0d, 0x64, 0x69, 0x73, - 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x12, 0x3a, 0x0a, 0x0c, 0x65, 0x6e, - 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, - 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0c, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, - 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x22, 0x0b, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x22, 0x06, - 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x22, 0xeb, 0x01, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x63, 0x6b, + 0x38, 0x01, 0x22, 0xa2, 0x03, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x09, + 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x11, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x65, 0x64, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, + 0x35, 0x0a, 0x0d, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x63, 0x6b, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, + 0x53, 0x74, 0x61, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0d, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x12, 0x3a, 0x0a, 0x0c, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x53, 0x74, 0x61, + 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0c, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x53, 0x74, 0x61, + 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x04, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x48, 0x00, + 0x52, 0x04, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x49, 0x0a, 0x11, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x48, 0x00, 0x52, 0x11, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x12, 0x3d, 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x74, 0x61, + 0x63, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x48, + 0x00, 0x52, 0x0d, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, + 0x12, 0x3a, 0x0a, 0x0c, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x0c, + 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x42, 0x09, 0x0a, 0x07, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x0b, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x65, 0x64, 0x22, 0x06, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x22, 0xeb, 0x01, 0x0a, + 0x05, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, + 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x65, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x65, 0x65, 0x64, 0x12, 0x32, 0x0a, 0x0a, + 0x61, 0x75, 0x74, 0x68, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x12, 0x38, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x41, 0x75, 0x74, 0x68, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x0d, 0x73, 0x74, 0x61, + 0x74, 0x69, 0x63, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x3e, 0x0a, 0x0e, 0x73, 0x74, + 0x61, 0x72, 0x67, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x72, + 0x67, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x72, + 0x67, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x56, 0x0a, 0x0d, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, + 0x74, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x74, + 0x61, 0x63, 0x6b, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, + 0x74, 0x61, 0x63, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x22, 0x3c, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x72, 0x67, 0x61, 0x74, 0x65, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x10, + 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, + 0x22, 0x30, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x73, 0x65, 0x65, 0x64, 0x12, 0x32, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0a, - 0x61, 0x75, 0x74, 0x68, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x38, 0x0a, 0x0d, 0x73, 0x74, - 0x61, 0x74, 0x69, 0x63, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x43, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x73, 0x12, 0x3e, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x72, 0x67, 0x61, 0x74, 0x65, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x67, 0x61, 0x74, 0x65, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x72, 0x67, 0x61, 0x74, 0x65, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x22, 0x3c, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x72, 0x67, 0x61, 0x74, 0x65, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, - 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, - 0x72, 0x6c, 0x22, 0x30, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x53, 0x74, 0x61, - 0x63, 0x6b, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, - 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x31, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x6d, 0x65, 0x22, 0x31, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x74, + 0x61, 0x63, 0x6b, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, + 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x30, 0x0a, 0x0c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, - 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x30, 0x0a, 0x0c, 0x45, 0x6e, 0x61, 0x62, 0x6c, - 0x65, 0x64, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, - 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, - 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x11, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, - 0x20, 0x0a, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x72, 0x69, 0x70, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x72, 0x69, 0x70, 0x65, 0x4b, 0x65, 0x79, 0x12, - 0x32, 0x0a, 0x14, 0x73, 0x74, 0x72, 0x69, 0x70, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x73, - 0x74, 0x72, 0x69, 0x70, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x49, 0x64, 0x22, 0x64, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x22, 0x0a, - 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, - 0x74, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x22, 0x34, 0x0a, 0x0a, 0x41, 0x75, 0x74, - 0x68, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, - 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x32, - 0x48, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x3e, 0x0a, 0x07, 0x43, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x12, 0x16, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, - 0x68, 0x71, 0x2f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x2f, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x20, 0x0a, + 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x72, 0x69, 0x70, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x72, 0x69, 0x70, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x32, 0x0a, + 0x14, 0x73, 0x74, 0x72, 0x69, 0x70, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x73, 0x74, 0x72, + 0x69, 0x70, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x22, 0x64, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, + 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, + 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x22, 0x34, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x43, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x2a, 0x29, 0x0a, + 0x0b, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0f, 0x0a, 0x0b, + 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x10, 0x00, 0x12, 0x09, 0x0a, + 0x05, 0x52, 0x65, 0x61, 0x64, 0x79, 0x10, 0x01, 0x32, 0x72, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x12, 0x34, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x16, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4f, + 0x72, 0x64, 0x65, 0x72, 0x22, 0x00, 0x30, 0x01, 0x12, 0x32, 0x0a, 0x04, 0x4a, 0x6f, 0x69, 0x6e, + 0x12, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x1a, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x3a, 0x5a, 0x38, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x6f, 0x72, 0x6d, 0x61, + 0x6e, 0x63, 0x65, 0x68, 0x71, 0x2f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, + 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -888,41 +1000,47 @@ func file_server_proto_rawDescGZIP() []byte { return file_server_proto_rawDescData } -var file_server_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_server_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_server_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_server_proto_goTypes = []interface{}{ - (*ConnectRequest)(nil), // 0: server.ConnectRequest - (*ConnectResponse)(nil), // 1: server.ConnectResponse - (*Connected)(nil), // 2: server.Connected - (*Ping)(nil), // 3: server.Ping - (*Stack)(nil), // 4: server.Stack - (*StargateConfig)(nil), // 5: server.StargateConfig - (*DeletedStack)(nil), // 6: server.DeletedStack - (*DisabledStack)(nil), // 7: server.DisabledStack - (*EnabledStack)(nil), // 8: server.EnabledStack - (*UpdateUsageReport)(nil), // 9: server.UpdateUsageReport - (*AuthConfig)(nil), // 10: server.AuthConfig - (*AuthClient)(nil), // 11: server.AuthClient - nil, // 12: server.ConnectRequest.TagsEntry + (StackStatus)(0), // 0: server.StackStatus + (*ConnectRequest)(nil), // 1: server.ConnectRequest + (*Order)(nil), // 2: server.Order + (*Connected)(nil), // 3: server.Connected + (*Ping)(nil), // 4: server.Ping + (*Stack)(nil), // 5: server.Stack + (*StatusChanged)(nil), // 6: server.StatusChanged + (*StargateConfig)(nil), // 7: server.StargateConfig + (*DeletedStack)(nil), // 8: server.DeletedStack + (*DisabledStack)(nil), // 9: server.DisabledStack + (*EnabledStack)(nil), // 10: server.EnabledStack + (*UpdateUsageReport)(nil), // 11: server.UpdateUsageReport + (*AuthConfig)(nil), // 12: server.AuthConfig + (*AuthClient)(nil), // 13: server.AuthClient + nil, // 14: server.ConnectRequest.TagsEntry } var file_server_proto_depIdxs = []int32{ - 12, // 0: server.ConnectRequest.tags:type_name -> server.ConnectRequest.TagsEntry - 2, // 1: server.ConnectResponse.connected:type_name -> server.Connected - 4, // 2: server.ConnectResponse.existingStack:type_name -> server.Stack - 6, // 3: server.ConnectResponse.deletedStack:type_name -> server.DeletedStack - 3, // 4: server.ConnectResponse.ping:type_name -> server.Ping - 9, // 5: server.ConnectResponse.updateUsageReport:type_name -> server.UpdateUsageReport - 7, // 6: server.ConnectResponse.disabledStack:type_name -> server.DisabledStack - 8, // 7: server.ConnectResponse.enabledStack:type_name -> server.EnabledStack - 10, // 8: server.Stack.authConfig:type_name -> server.AuthConfig - 11, // 9: server.Stack.staticClients:type_name -> server.AuthClient - 5, // 10: server.Stack.stargateConfig:type_name -> server.StargateConfig - 0, // 11: server.Server.Connect:input_type -> server.ConnectRequest - 1, // 12: server.Server.Connect:output_type -> server.ConnectResponse - 12, // [12:13] is the sub-list for method output_type - 11, // [11:12] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name + 14, // 0: server.ConnectRequest.tags:type_name -> server.ConnectRequest.TagsEntry + 3, // 1: server.Order.connected:type_name -> server.Connected + 5, // 2: server.Order.existingStack:type_name -> server.Stack + 8, // 3: server.Order.deletedStack:type_name -> server.DeletedStack + 4, // 4: server.Order.ping:type_name -> server.Ping + 11, // 5: server.Order.updateUsageReport:type_name -> server.UpdateUsageReport + 9, // 6: server.Order.disabledStack:type_name -> server.DisabledStack + 10, // 7: server.Order.enabledStack:type_name -> server.EnabledStack + 12, // 8: server.Stack.authConfig:type_name -> server.AuthConfig + 13, // 9: server.Stack.staticClients:type_name -> server.AuthClient + 7, // 10: server.Stack.stargateConfig:type_name -> server.StargateConfig + 0, // 11: server.StatusChanged.status:type_name -> server.StackStatus + 1, // 12: server.Server.Connect:input_type -> server.ConnectRequest + 6, // 13: server.Server.Join:input_type -> server.StatusChanged + 2, // 14: server.Server.Connect:output_type -> server.Order + 2, // 15: server.Server.Join:output_type -> server.Order + 14, // [14:16] is the sub-list for method output_type + 12, // [12:14] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name } func init() { file_server_proto_init() } @@ -944,7 +1062,7 @@ func file_server_proto_init() { } } file_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConnectResponse); i { + switch v := v.(*Order); i { case 0: return &v.state case 1: @@ -992,7 +1110,7 @@ func file_server_proto_init() { } } file_server_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StargateConfig); i { + switch v := v.(*StatusChanged); i { case 0: return &v.state case 1: @@ -1004,7 +1122,7 @@ func file_server_proto_init() { } } file_server_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeletedStack); i { + switch v := v.(*StargateConfig); i { case 0: return &v.state case 1: @@ -1016,7 +1134,7 @@ func file_server_proto_init() { } } file_server_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DisabledStack); i { + switch v := v.(*DeletedStack); i { case 0: return &v.state case 1: @@ -1028,7 +1146,7 @@ func file_server_proto_init() { } } file_server_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnabledStack); i { + switch v := v.(*DisabledStack); i { case 0: return &v.state case 1: @@ -1040,7 +1158,7 @@ func file_server_proto_init() { } } file_server_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateUsageReport); i { + switch v := v.(*EnabledStack); i { case 0: return &v.state case 1: @@ -1052,7 +1170,7 @@ func file_server_proto_init() { } } file_server_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthConfig); i { + switch v := v.(*UpdateUsageReport); i { case 0: return &v.state case 1: @@ -1064,6 +1182,18 @@ func file_server_proto_init() { } } file_server_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_server_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AuthClient); i { case 0: return &v.state @@ -1077,26 +1207,27 @@ func file_server_proto_init() { } } file_server_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*ConnectResponse_Connected)(nil), - (*ConnectResponse_ExistingStack)(nil), - (*ConnectResponse_DeletedStack)(nil), - (*ConnectResponse_Ping)(nil), - (*ConnectResponse_UpdateUsageReport)(nil), - (*ConnectResponse_DisabledStack)(nil), - (*ConnectResponse_EnabledStack)(nil), + (*Order_Connected)(nil), + (*Order_ExistingStack)(nil), + (*Order_DeletedStack)(nil), + (*Order_Ping)(nil), + (*Order_UpdateUsageReport)(nil), + (*Order_DisabledStack)(nil), + (*Order_EnabledStack)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_server_proto_rawDesc, - NumEnums: 0, - NumMessages: 13, + NumEnums: 1, + NumMessages: 14, NumExtensions: 0, NumServices: 1, }, GoTypes: file_server_proto_goTypes, DependencyIndexes: file_server_proto_depIdxs, + EnumInfos: file_server_proto_enumTypes, MessageInfos: file_server_proto_msgTypes, }.Build() File_server_proto = out.File diff --git a/components/agent/internal/grpc/generated/server_grpc.pb.go b/components/agent/internal/grpc/generated/server_grpc.pb.go index 4173e9bfe5..716f14da46 100644 --- a/components/agent/internal/grpc/generated/server_grpc.pb.go +++ b/components/agent/internal/grpc/generated/server_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 +// - protoc-gen-go-grpc v1.3.0 // - protoc v3.21.12 // source: server.proto @@ -18,11 +18,17 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + Server_Connect_FullMethodName = "/server.Server/Connect" + Server_Join_FullMethodName = "/server.Server/Join" +) + // ServerClient is the client API for Server 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 ServerClient interface { Connect(ctx context.Context, in *ConnectRequest, opts ...grpc.CallOption) (Server_ConnectClient, error) + Join(ctx context.Context, opts ...grpc.CallOption) (Server_JoinClient, error) } type serverClient struct { @@ -34,7 +40,7 @@ func NewServerClient(cc grpc.ClientConnInterface) ServerClient { } func (c *serverClient) Connect(ctx context.Context, in *ConnectRequest, opts ...grpc.CallOption) (Server_ConnectClient, error) { - stream, err := c.cc.NewStream(ctx, &Server_ServiceDesc.Streams[0], "/server.Server/Connect", opts...) + stream, err := c.cc.NewStream(ctx, &Server_ServiceDesc.Streams[0], Server_Connect_FullMethodName, opts...) if err != nil { return nil, err } @@ -49,7 +55,7 @@ func (c *serverClient) Connect(ctx context.Context, in *ConnectRequest, opts ... } type Server_ConnectClient interface { - Recv() (*ConnectResponse, error) + Recv() (*Order, error) grpc.ClientStream } @@ -57,8 +63,39 @@ type serverConnectClient struct { grpc.ClientStream } -func (x *serverConnectClient) Recv() (*ConnectResponse, error) { - m := new(ConnectResponse) +func (x *serverConnectClient) Recv() (*Order, error) { + m := new(Order) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *serverClient) Join(ctx context.Context, opts ...grpc.CallOption) (Server_JoinClient, error) { + stream, err := c.cc.NewStream(ctx, &Server_ServiceDesc.Streams[1], Server_Join_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &serverJoinClient{stream} + return x, nil +} + +type Server_JoinClient interface { + Send(*StatusChanged) error + Recv() (*Order, error) + grpc.ClientStream +} + +type serverJoinClient struct { + grpc.ClientStream +} + +func (x *serverJoinClient) Send(m *StatusChanged) error { + return x.ClientStream.SendMsg(m) +} + +func (x *serverJoinClient) Recv() (*Order, error) { + m := new(Order) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } @@ -70,6 +107,7 @@ func (x *serverConnectClient) Recv() (*ConnectResponse, error) { // for forward compatibility type ServerServer interface { Connect(*ConnectRequest, Server_ConnectServer) error + Join(Server_JoinServer) error mustEmbedUnimplementedServerServer() } @@ -80,6 +118,9 @@ type UnimplementedServerServer struct { func (UnimplementedServerServer) Connect(*ConnectRequest, Server_ConnectServer) error { return status.Errorf(codes.Unimplemented, "method Connect not implemented") } +func (UnimplementedServerServer) Join(Server_JoinServer) error { + return status.Errorf(codes.Unimplemented, "method Join not implemented") +} func (UnimplementedServerServer) mustEmbedUnimplementedServerServer() {} // UnsafeServerServer may be embedded to opt out of forward compatibility for this service. @@ -102,7 +143,7 @@ func _Server_Connect_Handler(srv interface{}, stream grpc.ServerStream) error { } type Server_ConnectServer interface { - Send(*ConnectResponse) error + Send(*Order) error grpc.ServerStream } @@ -110,10 +151,36 @@ type serverConnectServer struct { grpc.ServerStream } -func (x *serverConnectServer) Send(m *ConnectResponse) error { +func (x *serverConnectServer) Send(m *Order) error { return x.ServerStream.SendMsg(m) } +func _Server_Join_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ServerServer).Join(&serverJoinServer{stream}) +} + +type Server_JoinServer interface { + Send(*Order) error + Recv() (*StatusChanged, error) + grpc.ServerStream +} + +type serverJoinServer struct { + grpc.ServerStream +} + +func (x *serverJoinServer) Send(m *Order) error { + return x.ServerStream.SendMsg(m) +} + +func (x *serverJoinServer) Recv() (*StatusChanged, error) { + m := new(StatusChanged) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // Server_ServiceDesc is the grpc.ServiceDesc for Server service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -127,6 +194,12 @@ var Server_ServiceDesc = grpc.ServiceDesc{ Handler: _Server_Connect_Handler, ServerStreams: true, }, + { + StreamName: "Join", + Handler: _Server_Join_Handler, + ServerStreams: true, + ClientStreams: true, + }, }, Metadata: "server.proto", } diff --git a/components/agent/internal/grpc/module_test.go b/components/agent/internal/grpc/module_test.go index 38d960b53b..c02b1c6317 100644 --- a/components/agent/internal/grpc/module_test.go +++ b/components/agent/internal/grpc/module_test.go @@ -17,14 +17,15 @@ import ( "google.golang.org/grpc/credentials/insecure" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/watch" ) type mockServer struct { generated.UnimplementedServerServer - connectServer generated.Server_ConnectServer + connectServer generated.Server_JoinServer } -func (m *mockServer) Connect(request *generated.ConnectRequest, server generated.Server_ConnectServer) error { +func (m *mockServer) Join(server generated.Server_JoinServer) error { m.connectServer = server <-server.Context().Done() return nil @@ -34,6 +35,10 @@ type k8sClient struct { stacks map[string]*v1beta3.Stack } +func (k *k8sClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return watch.NewFake(), nil +} + func (k *k8sClient) Get(ctx context.Context, name string, options metav1.GetOptions) (*v1beta3.Stack, error) { stack, ok := k.stacks[name] if !ok { @@ -114,8 +119,8 @@ func TestModule(t *testing.T) { Id: uuid.NewString(), }}, } - require.NoError(t, mockServer.connectServer.Send(&generated.ConnectResponse{ - Message: &generated.ConnectResponse_ExistingStack{ + require.NoError(t, mockServer.connectServer.Send(&generated.Order{ + Message: &generated.Order_ExistingStack{ ExistingStack: &createdStack, }, })) diff --git a/components/agent/server.proto b/components/agent/server.proto index ad85df3f85..ff091a494f 100644 --- a/components/agent/server.proto +++ b/components/agent/server.proto @@ -5,7 +5,8 @@ option go_package = "github.com/formancehq/membership/internal/grpc/generated"; package server; service Server { - rpc Connect(ConnectRequest) returns (stream ConnectResponse) {} + rpc Connect(ConnectRequest) returns (stream Order) {} + rpc Join(stream StatusChanged) returns (stream Order) {} } message ConnectRequest { @@ -15,7 +16,7 @@ message ConnectRequest { bool production = 4; } -message ConnectResponse { +message Order { oneof message { Connected connected = 1; Stack existingStack = 2; @@ -39,6 +40,16 @@ message Stack { StargateConfig stargateConfig = 5; } +enum StackStatus { + Progressing = 0; + Ready = 1; +} + +message StatusChanged { + string stackId = 1; + StackStatus status = 2; +} + message StargateConfig { bool enabled = 1; string url = 2;