Add system shutdown subcommand

This commit is contained in:
2022-05-13 23:43:35 +02:00
parent 7b1565e6a4
commit 2d078228c9
5 changed files with 299 additions and 84 deletions

View File

@@ -648,6 +648,99 @@ func (x *SystemRebootResponse) GetMessage() string {
return ""
}
type SystemShutdownRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *SystemShutdownRequest) Reset() {
*x = SystemShutdownRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_portal_portal_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SystemShutdownRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SystemShutdownRequest) ProtoMessage() {}
func (x *SystemShutdownRequest) ProtoReflect() protoreflect.Message {
mi := &file_portal_portal_proto_msgTypes[11]
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 SystemShutdownRequest.ProtoReflect.Descriptor instead.
func (*SystemShutdownRequest) Descriptor() ([]byte, []int) {
return file_portal_portal_proto_rawDescGZIP(), []int{11}
}
type SystemShutdownResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
State State `protobuf:"varint,1,opt,name=state,proto3,enum=portal.State" json:"state,omitempty"`
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
}
func (x *SystemShutdownResponse) Reset() {
*x = SystemShutdownResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_portal_portal_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SystemShutdownResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SystemShutdownResponse) ProtoMessage() {}
func (x *SystemShutdownResponse) ProtoReflect() protoreflect.Message {
mi := &file_portal_portal_proto_msgTypes[12]
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 SystemShutdownResponse.ProtoReflect.Descriptor instead.
func (*SystemShutdownResponse) Descriptor() ([]byte, []int) {
return file_portal_portal_proto_rawDescGZIP(), []int{12}
}
func (x *SystemShutdownResponse) GetState() State {
if x != nil {
return x.State
}
return State_UNKNOWN
}
func (x *SystemShutdownResponse) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
var File_portal_portal_proto protoreflect.FileDescriptor
var file_portal_portal_proto_rawDesc = []byte{
@@ -701,48 +794,60 @@ var file_portal_portal_proto_rawDesc = []byte{
0x0e, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65,
0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x2a, 0x30, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e,
0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x48, 0x41, 0x4e, 0x47,
0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45,
0x44, 0x10, 0x02, 0x32, 0xac, 0x04, 0x0a, 0x06, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x12, 0x43,
0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74,
0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61,
0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74,
0x61, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x6f,
0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53,
0x65, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x68, 0x75, 0x74, 0x64,
0x6f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x57, 0x0a, 0x16, 0x53, 0x79,
0x73, 0x74, 0x65, 0x6d, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x74, 0x61,
0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x2a, 0x30, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07,
0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x48, 0x41,
0x4e, 0x47, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x43, 0x48, 0x41, 0x4e,
0x47, 0x45, 0x44, 0x10, 0x02, 0x32, 0xff, 0x04, 0x0a, 0x06, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c,
0x12, 0x43, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x74, 0x61,
0x72, 0x74, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x6f, 0x72,
0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e,
0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74,
0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x00, 0x12, 0x3f, 0x0a, 0x0a, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64,
0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61,
0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08, 0x43, 0x50, 0x55, 0x75, 0x73, 0x61, 0x67, 0x65, 0x12,
0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x43, 0x50, 0x55, 0x75, 0x73, 0x61, 0x67,
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61,
0x6c, 0x2e, 0x43, 0x50, 0x55, 0x75, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x61, 0x64,
0x12, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65,
0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x6f, 0x72, 0x74,
0x61, 0x6c, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0c, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52,
0x65, 0x62, 0x6f, 0x6f, 0x74, 0x12, 0x1b, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53,
0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x79, 0x73, 0x74,
0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x00, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
0x2f, 0x64, 0x70, 0x6f, 0x67, 0x6f, 0x72, 0x7a, 0x65, 0x6c, 0x73, 0x6b, 0x69, 0x2f, 0x73, 0x70,
0x65, 0x65, 0x64, 0x72, 0x75, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6f, 0x72,
0x74, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c,
0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x0d, 0x53, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x70, 0x6f,
0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x0a, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61,
0x6e, 0x64, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d,
0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x6f, 0x72,
0x74, 0x61, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08, 0x43, 0x50, 0x55, 0x75, 0x73, 0x61, 0x67,
0x65, 0x12, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x43, 0x50, 0x55, 0x75, 0x73,
0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x6f, 0x72,
0x74, 0x61, 0x6c, 0x2e, 0x43, 0x50, 0x55, 0x75, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65,
0x61, 0x64, 0x12, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x46, 0x69, 0x6c, 0x65,
0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x6f,
0x72, 0x74, 0x61, 0x6c, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0c, 0x53, 0x79, 0x73, 0x74, 0x65,
0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x12, 0x1b, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c,
0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x79,
0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x68,
0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x1d, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e,
0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53,
0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x70, 0x6f, 0x67, 0x6f, 0x72, 0x7a, 0x65, 0x6c, 0x73,
0x6b, 0x69, 0x2f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x72, 0x75, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2f, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -758,20 +863,22 @@ func file_portal_portal_proto_rawDescGZIP() []byte {
}
var file_portal_portal_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_portal_portal_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_portal_portal_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_portal_portal_proto_goTypes = []interface{}{
(State)(0), // 0: portal.State
(*CommandRequest)(nil), // 1: portal.CommandRequest
(*CommandResponse)(nil), // 2: portal.CommandResponse
(*ServiceRequest)(nil), // 3: portal.ServiceRequest
(*ServiceResponse)(nil), // 4: portal.ServiceResponse
(*ServiceStatusResponse)(nil), // 5: portal.ServiceStatusResponse
(*CPUusageRequest)(nil), // 6: portal.CPUusageRequest
(*CPUusageResponse)(nil), // 7: portal.CPUusageResponse
(*FileReadRequest)(nil), // 8: portal.FileReadRequest
(*FileReadResponse)(nil), // 9: portal.FileReadResponse
(*SystemRebootRequest)(nil), // 10: portal.SystemRebootRequest
(*SystemRebootResponse)(nil), // 11: portal.SystemRebootResponse
(State)(0), // 0: portal.State
(*CommandRequest)(nil), // 1: portal.CommandRequest
(*CommandResponse)(nil), // 2: portal.CommandResponse
(*ServiceRequest)(nil), // 3: portal.ServiceRequest
(*ServiceResponse)(nil), // 4: portal.ServiceResponse
(*ServiceStatusResponse)(nil), // 5: portal.ServiceStatusResponse
(*CPUusageRequest)(nil), // 6: portal.CPUusageRequest
(*CPUusageResponse)(nil), // 7: portal.CPUusageResponse
(*FileReadRequest)(nil), // 8: portal.FileReadRequest
(*FileReadResponse)(nil), // 9: portal.FileReadResponse
(*SystemRebootRequest)(nil), // 10: portal.SystemRebootRequest
(*SystemRebootResponse)(nil), // 11: portal.SystemRebootResponse
(*SystemShutdownRequest)(nil), // 12: portal.SystemShutdownRequest
(*SystemShutdownResponse)(nil), // 13: portal.SystemShutdownResponse
}
var file_portal_portal_proto_depIdxs = []int32{
0, // 0: portal.CommandResponse.state:type_name -> portal.State
@@ -779,27 +886,30 @@ var file_portal_portal_proto_depIdxs = []int32{
0, // 2: portal.ServiceStatusResponse.state:type_name -> portal.State
0, // 3: portal.FileReadResponse.state:type_name -> portal.State
0, // 4: portal.SystemRebootResponse.state:type_name -> portal.State
3, // 5: portal.Portal.ServiceRestart:input_type -> portal.ServiceRequest
3, // 6: portal.Portal.ServiceStart:input_type -> portal.ServiceRequest
3, // 7: portal.Portal.ServiceStop:input_type -> portal.ServiceRequest
3, // 8: portal.Portal.ServiceStatus:input_type -> portal.ServiceRequest
1, // 9: portal.Portal.RunCommand:input_type -> portal.CommandRequest
6, // 10: portal.Portal.CPUusage:input_type -> portal.CPUusageRequest
8, // 11: portal.Portal.FileRead:input_type -> portal.FileReadRequest
10, // 12: portal.Portal.SystemReboot:input_type -> portal.SystemRebootRequest
4, // 13: portal.Portal.ServiceRestart:output_type -> portal.ServiceResponse
4, // 14: portal.Portal.ServiceStart:output_type -> portal.ServiceResponse
4, // 15: portal.Portal.ServiceStop:output_type -> portal.ServiceResponse
5, // 16: portal.Portal.ServiceStatus:output_type -> portal.ServiceStatusResponse
2, // 17: portal.Portal.RunCommand:output_type -> portal.CommandResponse
7, // 18: portal.Portal.CPUusage:output_type -> portal.CPUusageResponse
9, // 19: portal.Portal.FileRead:output_type -> portal.FileReadResponse
11, // 20: portal.Portal.SystemReboot:output_type -> portal.SystemRebootResponse
13, // [13:21] is the sub-list for method output_type
5, // [5:13] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
0, // 5: portal.SystemShutdownResponse.state:type_name -> portal.State
3, // 6: portal.Portal.ServiceRestart:input_type -> portal.ServiceRequest
3, // 7: portal.Portal.ServiceStart:input_type -> portal.ServiceRequest
3, // 8: portal.Portal.ServiceStop:input_type -> portal.ServiceRequest
3, // 9: portal.Portal.ServiceStatus:input_type -> portal.ServiceRequest
1, // 10: portal.Portal.RunCommand:input_type -> portal.CommandRequest
6, // 11: portal.Portal.CPUusage:input_type -> portal.CPUusageRequest
8, // 12: portal.Portal.FileRead:input_type -> portal.FileReadRequest
10, // 13: portal.Portal.SystemReboot:input_type -> portal.SystemRebootRequest
12, // 14: portal.Portal.SystemShutdown:input_type -> portal.SystemShutdownRequest
4, // 15: portal.Portal.ServiceRestart:output_type -> portal.ServiceResponse
4, // 16: portal.Portal.ServiceStart:output_type -> portal.ServiceResponse
4, // 17: portal.Portal.ServiceStop:output_type -> portal.ServiceResponse
5, // 18: portal.Portal.ServiceStatus:output_type -> portal.ServiceStatusResponse
2, // 19: portal.Portal.RunCommand:output_type -> portal.CommandResponse
7, // 20: portal.Portal.CPUusage:output_type -> portal.CPUusageResponse
9, // 21: portal.Portal.FileRead:output_type -> portal.FileReadResponse
11, // 22: portal.Portal.SystemReboot:output_type -> portal.SystemRebootResponse
13, // 23: portal.Portal.SystemShutdown:output_type -> portal.SystemShutdownResponse
15, // [15:24] is the sub-list for method output_type
6, // [6:15] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
}
func init() { file_portal_portal_proto_init() }
@@ -940,6 +1050,30 @@ func file_portal_portal_proto_init() {
return nil
}
}
file_portal_portal_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemShutdownRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_portal_portal_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemShutdownResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -947,7 +1081,7 @@ func file_portal_portal_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_portal_portal_proto_rawDesc,
NumEnums: 1,
NumMessages: 11,
NumMessages: 13,
NumExtensions: 0,
NumServices: 1,
},

View File

@@ -58,6 +58,13 @@ message SystemRebootResponse {
string message = 2;
}
message SystemShutdownRequest {}
message SystemShutdownResponse {
State state = 1;
string message = 2;
}
service Portal {
rpc ServiceRestart(ServiceRequest) returns (ServiceResponse) {}
rpc ServiceStart(ServiceRequest) returns (ServiceResponse) {}
@@ -67,6 +74,7 @@ service Portal {
rpc CPUusage(CPUusageRequest) returns (CPUusageResponse) {}
rpc FileRead(FileReadRequest) returns (FileReadResponse) {}
rpc SystemReboot(SystemRebootRequest) returns (SystemRebootResponse) {}
rpc SystemShutdown(SystemShutdownRequest) returns (SystemShutdownResponse) {}
// --target group1 --target group2
// rpc CPUProfile(CPUProfileRequest) returns (CPUProfileResponse) {}
// rpc MemProfile(MemProfileRequest) returns (MemProfileResponse) {}

View File

@@ -46,6 +46,7 @@ type DRPCPortalClient interface {
CPUusage(ctx context.Context, in *CPUusageRequest) (*CPUusageResponse, error)
FileRead(ctx context.Context, in *FileReadRequest) (*FileReadResponse, error)
SystemReboot(ctx context.Context, in *SystemRebootRequest) (*SystemRebootResponse, error)
SystemShutdown(ctx context.Context, in *SystemShutdownRequest) (*SystemShutdownResponse, error)
}
type drpcPortalClient struct {
@@ -130,6 +131,15 @@ func (c *drpcPortalClient) SystemReboot(ctx context.Context, in *SystemRebootReq
return out, nil
}
func (c *drpcPortalClient) SystemShutdown(ctx context.Context, in *SystemShutdownRequest) (*SystemShutdownResponse, error) {
out := new(SystemShutdownResponse)
err := c.cc.Invoke(ctx, "/portal.Portal/SystemShutdown", drpcEncoding_File_portal_portal_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
type DRPCPortalServer interface {
ServiceRestart(context.Context, *ServiceRequest) (*ServiceResponse, error)
ServiceStart(context.Context, *ServiceRequest) (*ServiceResponse, error)
@@ -139,6 +149,7 @@ type DRPCPortalServer interface {
CPUusage(context.Context, *CPUusageRequest) (*CPUusageResponse, error)
FileRead(context.Context, *FileReadRequest) (*FileReadResponse, error)
SystemReboot(context.Context, *SystemRebootRequest) (*SystemRebootResponse, error)
SystemShutdown(context.Context, *SystemShutdownRequest) (*SystemShutdownResponse, error)
}
type DRPCPortalUnimplementedServer struct{}
@@ -175,9 +186,13 @@ func (s *DRPCPortalUnimplementedServer) SystemReboot(context.Context, *SystemReb
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
func (s *DRPCPortalUnimplementedServer) SystemShutdown(context.Context, *SystemShutdownRequest) (*SystemShutdownResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
type DRPCPortalDescription struct{}
func (DRPCPortalDescription) NumMethods() int { return 8 }
func (DRPCPortalDescription) NumMethods() int { return 9 }
func (DRPCPortalDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
switch n {
@@ -253,6 +268,15 @@ func (DRPCPortalDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver
in1.(*SystemRebootRequest),
)
}, DRPCPortalServer.SystemReboot, true
case 8:
return "/portal.Portal/SystemShutdown", drpcEncoding_File_portal_portal_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPortalServer).
SystemShutdown(
ctx,
in1.(*SystemShutdownRequest),
)
}, DRPCPortalServer.SystemShutdown, true
default:
return "", nil, nil, nil, false
}
@@ -389,3 +413,19 @@ func (x *drpcPortal_SystemRebootStream) SendAndClose(m *SystemRebootResponse) er
}
return x.CloseSend()
}
type DRPCPortal_SystemShutdownStream interface {
drpc.Stream
SendAndClose(*SystemShutdownResponse) error
}
type drpcPortal_SystemShutdownStream struct {
drpc.Stream
}
func (x *drpcPortal_SystemShutdownStream) SendAndClose(m *SystemShutdownResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_portal_portal_proto{}); err != nil {
return err
}
return x.CloseSend()
}