1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-27 07:31:46 +01:00

feat: supports container actions for agents (#3164)

This commit is contained in:
Amir Raminfar
2024-07-29 12:16:38 -07:00
committed by GitHub
parent f09e294f38
commit 638889ed58
9 changed files with 410 additions and 120 deletions

View File

@@ -368,6 +368,25 @@ func (c *Client) Host() (docker.Host, error) {
}, nil
}
func (c *Client) ContainerAction(containerId string, action docker.ContainerAction) error {
var containerAction pb.ContainerAction
switch action {
case docker.Start:
containerAction = pb.ContainerAction_Start
case docker.Stop:
containerAction = pb.ContainerAction_Stop
case docker.Restart:
containerAction = pb.ContainerAction_Restart
}
_, err := c.client.ContainerAction(context.Background(), &pb.ContainerActionRequest{ContainerId: containerId, Action: containerAction})
return err
}
func (c *Client) Close() error {
return c.conn.Close()
}

View File

@@ -839,6 +839,99 @@ func (x *StreamContainerStartedResponse) GetContainer() *Container {
return nil
}
type ContainerActionRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ContainerId string `protobuf:"bytes,1,opt,name=containerId,proto3" json:"containerId,omitempty"`
Action ContainerAction `protobuf:"varint,2,opt,name=action,proto3,enum=protobuf.ContainerAction" json:"action,omitempty"`
}
func (x *ContainerActionRequest) Reset() {
*x = ContainerActionRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ContainerActionRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ContainerActionRequest) ProtoMessage() {}
func (x *ContainerActionRequest) ProtoReflect() protoreflect.Message {
mi := &file_rpc_proto_msgTypes[17]
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 ContainerActionRequest.ProtoReflect.Descriptor instead.
func (*ContainerActionRequest) Descriptor() ([]byte, []int) {
return file_rpc_proto_rawDescGZIP(), []int{17}
}
func (x *ContainerActionRequest) GetContainerId() string {
if x != nil {
return x.ContainerId
}
return ""
}
func (x *ContainerActionRequest) GetAction() ContainerAction {
if x != nil {
return x.Action
}
return ContainerAction_Start
}
type ContainerActionResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ContainerActionResponse) Reset() {
*x = ContainerActionResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ContainerActionResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ContainerActionResponse) ProtoMessage() {}
func (x *ContainerActionResponse) ProtoReflect() protoreflect.Message {
mi := &file_rpc_proto_msgTypes[18]
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 ContainerActionResponse.ProtoReflect.Descriptor instead.
func (*ContainerActionResponse) Descriptor() ([]byte, []int) {
return file_rpc_proto_rawDescGZIP(), []int{18}
}
var File_rpc_proto protoreflect.FileDescriptor
var file_rpc_proto_rawDesc = []byte{
@@ -924,58 +1017,72 @@ var file_rpc_proto_rawDesc = []byte{
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74,
0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x32, 0x91, 0x06, 0x0a, 0x0c,
0x41, 0x67, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x55, 0x0a, 0x0e,
0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x12, 0x1f,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f,
0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43,
0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x0d, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61,
0x69, 0x6e, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x46, 0x69, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x46, 0x69, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74,
0x72, 0x65, 0x61, 0x6d, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x00, 0x30, 0x01, 0x12, 0x57, 0x0a, 0x10, 0x4c, 0x6f, 0x67, 0x73, 0x42, 0x65, 0x74, 0x77,
0x65, 0x65, 0x6e, 0x44, 0x61, 0x74, 0x65, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x62, 0x75, 0x66, 0x2e, 0x4c, 0x6f, 0x67, 0x73, 0x42, 0x65, 0x74, 0x77, 0x65, 0x65, 0x6e, 0x44,
0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4c, 0x6f, 0x67,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x57, 0x0a,
0x0e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x61, 0x77, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12,
0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x52, 0x61, 0x77, 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x65,
0x61, 0x6d, 0x52, 0x61, 0x77, 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x51, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,
0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x4e, 0x0a, 0x0b, 0x53, 0x74, 0x72,
0x65, 0x61, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x6f, 0x0a, 0x16, 0x53, 0x74, 0x72,
0x65, 0x61, 0x6d, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x74, 0x61, 0x72,
0x74, 0x65, 0x64, 0x12, 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53,
0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x74,
0x61, 0x72, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f,
0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x43, 0x0a, 0x08, 0x48, 0x6f,
0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x48, 0x6f, 0x73,
0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42,
0x13, 0x5a, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x61, 0x67, 0x65, 0x6e,
0x74, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x22, 0x6d, 0x0a, 0x16, 0x43,
0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74,
0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x41, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x19, 0x0a, 0x17, 0x43, 0x6f,
0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xeb, 0x06, 0x0a, 0x0c, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x53,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x55, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f,
0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a,
0x0d, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x1e,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x6f,
0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x6f,
0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x00, 0x12, 0x4b, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4c, 0x6f, 0x67, 0x73, 0x12,
0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4c, 0x6f,
0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x57,
0x0a, 0x10, 0x4c, 0x6f, 0x67, 0x73, 0x42, 0x65, 0x74, 0x77, 0x65, 0x65, 0x6e, 0x44, 0x61, 0x74,
0x65, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x6f,
0x67, 0x73, 0x42, 0x65, 0x74, 0x77, 0x65, 0x65, 0x6e, 0x44, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x57, 0x0a, 0x0e, 0x53, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x52, 0x61, 0x77, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x61, 0x77, 0x42, 0x79,
0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x61, 0x77, 0x42,
0x79, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01,
0x12, 0x51, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73,
0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x65,
0x61, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x00, 0x30, 0x01, 0x12, 0x4e, 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x74, 0x61,
0x74, 0x73, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74,
0x72, 0x65, 0x61, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x65,
0x61, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x00, 0x30, 0x01, 0x12, 0x6f, 0x0a, 0x16, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, 0x6e,
0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, 0x27, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43,
0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x72, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x00, 0x30, 0x01, 0x12, 0x43, 0x0a, 0x08, 0x48, 0x6f, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f,
0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x48, 0x6f, 0x73, 0x74,
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x58, 0x0a, 0x0f, 0x43, 0x6f, 0x6e,
0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69,
0x6e, 0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x00, 0x42, 0x13, 0x5a, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f,
0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -990,7 +1097,7 @@ func file_rpc_proto_rawDescGZIP() []byte {
return file_rpc_proto_rawDescData
}
var file_rpc_proto_msgTypes = make([]protoimpl.MessageInfo, 17)
var file_rpc_proto_msgTypes = make([]protoimpl.MessageInfo, 19)
var file_rpc_proto_goTypes = []any{
(*ListContainersRequest)(nil), // 0: protobuf.ListContainersRequest
(*ListContainersResponse)(nil), // 1: protobuf.ListContainersResponse
@@ -1009,49 +1116,55 @@ var file_rpc_proto_goTypes = []any{
(*HostInfoResponse)(nil), // 14: protobuf.HostInfoResponse
(*StreamContainerStartedRequest)(nil), // 15: protobuf.StreamContainerStartedRequest
(*StreamContainerStartedResponse)(nil), // 16: protobuf.StreamContainerStartedResponse
(*Container)(nil), // 17: protobuf.Container
(*timestamppb.Timestamp)(nil), // 18: google.protobuf.Timestamp
(*LogEvent)(nil), // 19: protobuf.LogEvent
(*ContainerEvent)(nil), // 20: protobuf.ContainerEvent
(*ContainerStat)(nil), // 21: protobuf.ContainerStat
(*Host)(nil), // 22: protobuf.Host
(*ContainerActionRequest)(nil), // 17: protobuf.ContainerActionRequest
(*ContainerActionResponse)(nil), // 18: protobuf.ContainerActionResponse
(*Container)(nil), // 19: protobuf.Container
(*timestamppb.Timestamp)(nil), // 20: google.protobuf.Timestamp
(*LogEvent)(nil), // 21: protobuf.LogEvent
(*ContainerEvent)(nil), // 22: protobuf.ContainerEvent
(*ContainerStat)(nil), // 23: protobuf.ContainerStat
(*Host)(nil), // 24: protobuf.Host
(ContainerAction)(0), // 25: protobuf.ContainerAction
}
var file_rpc_proto_depIdxs = []int32{
17, // 0: protobuf.ListContainersResponse.containers:type_name -> protobuf.Container
17, // 1: protobuf.FindContainerResponse.container:type_name -> protobuf.Container
18, // 2: protobuf.StreamLogsRequest.since:type_name -> google.protobuf.Timestamp
19, // 3: protobuf.StreamLogsResponse.event:type_name -> protobuf.LogEvent
18, // 4: protobuf.LogsBetweenDatesRequest.since:type_name -> google.protobuf.Timestamp
18, // 5: protobuf.LogsBetweenDatesRequest.until:type_name -> google.protobuf.Timestamp
18, // 6: protobuf.StreamRawBytesRequest.since:type_name -> google.protobuf.Timestamp
18, // 7: protobuf.StreamRawBytesRequest.until:type_name -> google.protobuf.Timestamp
20, // 8: protobuf.StreamEventsResponse.event:type_name -> protobuf.ContainerEvent
21, // 9: protobuf.StreamStatsResponse.stat:type_name -> protobuf.ContainerStat
22, // 10: protobuf.HostInfoResponse.host:type_name -> protobuf.Host
17, // 11: protobuf.StreamContainerStartedResponse.container:type_name -> protobuf.Container
0, // 12: protobuf.AgentService.ListContainers:input_type -> protobuf.ListContainersRequest
2, // 13: protobuf.AgentService.FindContainer:input_type -> protobuf.FindContainerRequest
4, // 14: protobuf.AgentService.StreamLogs:input_type -> protobuf.StreamLogsRequest
6, // 15: protobuf.AgentService.LogsBetweenDates:input_type -> protobuf.LogsBetweenDatesRequest
7, // 16: protobuf.AgentService.StreamRawBytes:input_type -> protobuf.StreamRawBytesRequest
9, // 17: protobuf.AgentService.StreamEvents:input_type -> protobuf.StreamEventsRequest
11, // 18: protobuf.AgentService.StreamStats:input_type -> protobuf.StreamStatsRequest
15, // 19: protobuf.AgentService.StreamContainerStarted:input_type -> protobuf.StreamContainerStartedRequest
13, // 20: protobuf.AgentService.HostInfo:input_type -> protobuf.HostInfoRequest
1, // 21: protobuf.AgentService.ListContainers:output_type -> protobuf.ListContainersResponse
3, // 22: protobuf.AgentService.FindContainer:output_type -> protobuf.FindContainerResponse
5, // 23: protobuf.AgentService.StreamLogs:output_type -> protobuf.StreamLogsResponse
5, // 24: protobuf.AgentService.LogsBetweenDates:output_type -> protobuf.StreamLogsResponse
8, // 25: protobuf.AgentService.StreamRawBytes:output_type -> protobuf.StreamRawBytesResponse
10, // 26: protobuf.AgentService.StreamEvents:output_type -> protobuf.StreamEventsResponse
12, // 27: protobuf.AgentService.StreamStats:output_type -> protobuf.StreamStatsResponse
16, // 28: protobuf.AgentService.StreamContainerStarted:output_type -> protobuf.StreamContainerStartedResponse
14, // 29: protobuf.AgentService.HostInfo:output_type -> protobuf.HostInfoResponse
21, // [21:30] is the sub-list for method output_type
12, // [12:21] 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
19, // 0: protobuf.ListContainersResponse.containers:type_name -> protobuf.Container
19, // 1: protobuf.FindContainerResponse.container:type_name -> protobuf.Container
20, // 2: protobuf.StreamLogsRequest.since:type_name -> google.protobuf.Timestamp
21, // 3: protobuf.StreamLogsResponse.event:type_name -> protobuf.LogEvent
20, // 4: protobuf.LogsBetweenDatesRequest.since:type_name -> google.protobuf.Timestamp
20, // 5: protobuf.LogsBetweenDatesRequest.until:type_name -> google.protobuf.Timestamp
20, // 6: protobuf.StreamRawBytesRequest.since:type_name -> google.protobuf.Timestamp
20, // 7: protobuf.StreamRawBytesRequest.until:type_name -> google.protobuf.Timestamp
22, // 8: protobuf.StreamEventsResponse.event:type_name -> protobuf.ContainerEvent
23, // 9: protobuf.StreamStatsResponse.stat:type_name -> protobuf.ContainerStat
24, // 10: protobuf.HostInfoResponse.host:type_name -> protobuf.Host
19, // 11: protobuf.StreamContainerStartedResponse.container:type_name -> protobuf.Container
25, // 12: protobuf.ContainerActionRequest.action:type_name -> protobuf.ContainerAction
0, // 13: protobuf.AgentService.ListContainers:input_type -> protobuf.ListContainersRequest
2, // 14: protobuf.AgentService.FindContainer:input_type -> protobuf.FindContainerRequest
4, // 15: protobuf.AgentService.StreamLogs:input_type -> protobuf.StreamLogsRequest
6, // 16: protobuf.AgentService.LogsBetweenDates:input_type -> protobuf.LogsBetweenDatesRequest
7, // 17: protobuf.AgentService.StreamRawBytes:input_type -> protobuf.StreamRawBytesRequest
9, // 18: protobuf.AgentService.StreamEvents:input_type -> protobuf.StreamEventsRequest
11, // 19: protobuf.AgentService.StreamStats:input_type -> protobuf.StreamStatsRequest
15, // 20: protobuf.AgentService.StreamContainerStarted:input_type -> protobuf.StreamContainerStartedRequest
13, // 21: protobuf.AgentService.HostInfo:input_type -> protobuf.HostInfoRequest
17, // 22: protobuf.AgentService.ContainerAction:input_type -> protobuf.ContainerActionRequest
1, // 23: protobuf.AgentService.ListContainers:output_type -> protobuf.ListContainersResponse
3, // 24: protobuf.AgentService.FindContainer:output_type -> protobuf.FindContainerResponse
5, // 25: protobuf.AgentService.StreamLogs:output_type -> protobuf.StreamLogsResponse
5, // 26: protobuf.AgentService.LogsBetweenDates:output_type -> protobuf.StreamLogsResponse
8, // 27: protobuf.AgentService.StreamRawBytes:output_type -> protobuf.StreamRawBytesResponse
10, // 28: protobuf.AgentService.StreamEvents:output_type -> protobuf.StreamEventsResponse
12, // 29: protobuf.AgentService.StreamStats:output_type -> protobuf.StreamStatsResponse
16, // 30: protobuf.AgentService.StreamContainerStarted:output_type -> protobuf.StreamContainerStartedResponse
14, // 31: protobuf.AgentService.HostInfo:output_type -> protobuf.HostInfoResponse
18, // 32: protobuf.AgentService.ContainerAction:output_type -> protobuf.ContainerActionResponse
23, // [23:33] is the sub-list for method output_type
13, // [13:23] is the sub-list for method input_type
13, // [13:13] is the sub-list for extension type_name
13, // [13:13] is the sub-list for extension extendee
0, // [0:13] is the sub-list for field type_name
}
func init() { file_rpc_proto_init() }
@@ -1265,6 +1378,30 @@ func file_rpc_proto_init() {
return nil
}
}
file_rpc_proto_msgTypes[17].Exporter = func(v any, i int) any {
switch v := v.(*ContainerActionRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_proto_msgTypes[18].Exporter = func(v any, i int) any {
switch v := v.(*ContainerActionResponse); 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{
@@ -1272,7 +1409,7 @@ func file_rpc_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_rpc_proto_rawDesc,
NumEnums: 0,
NumMessages: 17,
NumMessages: 19,
NumExtensions: 0,
NumServices: 1,
},

View File

@@ -28,6 +28,7 @@ const (
AgentService_StreamStats_FullMethodName = "/protobuf.AgentService/StreamStats"
AgentService_StreamContainerStarted_FullMethodName = "/protobuf.AgentService/StreamContainerStarted"
AgentService_HostInfo_FullMethodName = "/protobuf.AgentService/HostInfo"
AgentService_ContainerAction_FullMethodName = "/protobuf.AgentService/ContainerAction"
)
// AgentServiceClient is the client API for AgentService service.
@@ -43,6 +44,7 @@ type AgentServiceClient interface {
StreamStats(ctx context.Context, in *StreamStatsRequest, opts ...grpc.CallOption) (AgentService_StreamStatsClient, error)
StreamContainerStarted(ctx context.Context, in *StreamContainerStartedRequest, opts ...grpc.CallOption) (AgentService_StreamContainerStartedClient, error)
HostInfo(ctx context.Context, in *HostInfoRequest, opts ...grpc.CallOption) (*HostInfoResponse, error)
ContainerAction(ctx context.Context, in *ContainerActionRequest, opts ...grpc.CallOption) (*ContainerActionResponse, error)
}
type agentServiceClient struct {
@@ -281,6 +283,16 @@ func (c *agentServiceClient) HostInfo(ctx context.Context, in *HostInfoRequest,
return out, nil
}
func (c *agentServiceClient) ContainerAction(ctx context.Context, in *ContainerActionRequest, opts ...grpc.CallOption) (*ContainerActionResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ContainerActionResponse)
err := c.cc.Invoke(ctx, AgentService_ContainerAction_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AgentServiceServer is the server API for AgentService service.
// All implementations must embed UnimplementedAgentServiceServer
// for forward compatibility
@@ -294,6 +306,7 @@ type AgentServiceServer interface {
StreamStats(*StreamStatsRequest, AgentService_StreamStatsServer) error
StreamContainerStarted(*StreamContainerStartedRequest, AgentService_StreamContainerStartedServer) error
HostInfo(context.Context, *HostInfoRequest) (*HostInfoResponse, error)
ContainerAction(context.Context, *ContainerActionRequest) (*ContainerActionResponse, error)
mustEmbedUnimplementedAgentServiceServer()
}
@@ -328,6 +341,9 @@ func (UnimplementedAgentServiceServer) StreamContainerStarted(*StreamContainerSt
func (UnimplementedAgentServiceServer) HostInfo(context.Context, *HostInfoRequest) (*HostInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method HostInfo not implemented")
}
func (UnimplementedAgentServiceServer) ContainerAction(context.Context, *ContainerActionRequest) (*ContainerActionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ContainerAction not implemented")
}
func (UnimplementedAgentServiceServer) mustEmbedUnimplementedAgentServiceServer() {}
// UnsafeAgentServiceServer may be embedded to opt out of forward compatibility for this service.
@@ -521,6 +537,24 @@ func _AgentService_HostInfo_Handler(srv interface{}, ctx context.Context, dec fu
return interceptor(ctx, in, info, handler)
}
func _AgentService_ContainerAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ContainerActionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServiceServer).ContainerAction(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AgentService_ContainerAction_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServiceServer).ContainerAction(ctx, req.(*ContainerActionRequest))
}
return interceptor(ctx, in, info, handler)
}
// AgentService_ServiceDesc is the grpc.ServiceDesc for AgentService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -540,6 +574,10 @@ var AgentService_ServiceDesc = grpc.ServiceDesc{
MethodName: "HostInfo",
Handler: _AgentService_HostInfo_Handler,
},
{
MethodName: "ContainerAction",
Handler: _AgentService_ContainerAction_Handler,
},
},
Streams: []grpc.StreamDesc{
{

View File

@@ -22,6 +22,55 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ContainerAction int32
const (
ContainerAction_Start ContainerAction = 0
ContainerAction_Stop ContainerAction = 1
ContainerAction_Restart ContainerAction = 2
)
// Enum value maps for ContainerAction.
var (
ContainerAction_name = map[int32]string{
0: "Start",
1: "Stop",
2: "Restart",
}
ContainerAction_value = map[string]int32{
"Start": 0,
"Stop": 1,
"Restart": 2,
}
)
func (x ContainerAction) Enum() *ContainerAction {
p := new(ContainerAction)
*p = x
return p
}
func (x ContainerAction) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ContainerAction) Descriptor() protoreflect.EnumDescriptor {
return file_types_proto_enumTypes[0].Descriptor()
}
func (ContainerAction) Type() protoreflect.EnumType {
return &file_types_proto_enumTypes[0]
}
func (x ContainerAction) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use ContainerAction.Descriptor instead.
func (ContainerAction) EnumDescriptor() ([]byte, []int) {
return file_types_proto_rawDescGZIP(), []int{0}
}
type Container struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -741,9 +790,12 @@ var file_types_proto_rawDesc = []byte{
0x65, 0x6c, 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, 0x42, 0x13, 0x5a, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
0x3a, 0x02, 0x38, 0x01, 0x2a, 0x33, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74,
0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x74, 0x6f, 0x70, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07,
0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x10, 0x02, 0x42, 0x13, 0x5a, 0x11, 0x69, 0x6e, 0x74,
0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -758,28 +810,30 @@ func file_types_proto_rawDescGZIP() []byte {
return file_types_proto_rawDescData
}
var file_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_types_proto_goTypes = []any{
(*Container)(nil), // 0: protobuf.Container
(*ContainerStat)(nil), // 1: protobuf.ContainerStat
(*LogEvent)(nil), // 2: protobuf.LogEvent
(*SimpleMessage)(nil), // 3: protobuf.SimpleMessage
(*ComplexMessage)(nil), // 4: protobuf.ComplexMessage
(*ContainerEvent)(nil), // 5: protobuf.ContainerEvent
(*Host)(nil), // 6: protobuf.Host
nil, // 7: protobuf.Container.LabelsEntry
nil, // 8: protobuf.Host.LabelsEntry
(*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp
(*anypb.Any)(nil), // 10: google.protobuf.Any
(ContainerAction)(0), // 0: protobuf.ContainerAction
(*Container)(nil), // 1: protobuf.Container
(*ContainerStat)(nil), // 2: protobuf.ContainerStat
(*LogEvent)(nil), // 3: protobuf.LogEvent
(*SimpleMessage)(nil), // 4: protobuf.SimpleMessage
(*ComplexMessage)(nil), // 5: protobuf.ComplexMessage
(*ContainerEvent)(nil), // 6: protobuf.ContainerEvent
(*Host)(nil), // 7: protobuf.Host
nil, // 8: protobuf.Container.LabelsEntry
nil, // 9: protobuf.Host.LabelsEntry
(*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp
(*anypb.Any)(nil), // 11: google.protobuf.Any
}
var file_types_proto_depIdxs = []int32{
9, // 0: protobuf.Container.created:type_name -> google.protobuf.Timestamp
9, // 1: protobuf.Container.started:type_name -> google.protobuf.Timestamp
7, // 2: protobuf.Container.labels:type_name -> protobuf.Container.LabelsEntry
1, // 3: protobuf.Container.stats:type_name -> protobuf.ContainerStat
10, // 4: protobuf.LogEvent.message:type_name -> google.protobuf.Any
9, // 5: protobuf.LogEvent.timestamp:type_name -> google.protobuf.Timestamp
8, // 6: protobuf.Host.labels:type_name -> protobuf.Host.LabelsEntry
10, // 0: protobuf.Container.created:type_name -> google.protobuf.Timestamp
10, // 1: protobuf.Container.started:type_name -> google.protobuf.Timestamp
8, // 2: protobuf.Container.labels:type_name -> protobuf.Container.LabelsEntry
2, // 3: protobuf.Container.stats:type_name -> protobuf.ContainerStat
11, // 4: protobuf.LogEvent.message:type_name -> google.protobuf.Any
10, // 5: protobuf.LogEvent.timestamp:type_name -> google.protobuf.Timestamp
9, // 6: protobuf.Host.labels:type_name -> protobuf.Host.LabelsEntry
7, // [7:7] is the sub-list for method output_type
7, // [7:7] is the sub-list for method input_type
7, // [7:7] is the sub-list for extension type_name
@@ -883,13 +937,14 @@ func file_types_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_types_proto_rawDesc,
NumEnums: 0,
NumEnums: 1,
NumMessages: 9,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_types_proto_goTypes,
DependencyIndexes: file_types_proto_depIdxs,
EnumInfos: file_types_proto_enumTypes,
MessageInfos: file_types_proto_msgTypes,
}.Build()
File_types_proto = out.File

View File

@@ -285,6 +285,31 @@ func (s *server) StreamContainerStarted(in *pb.StreamContainerStartedRequest, ou
}
}
func (s *server) ContainerAction(ctx context.Context, in *pb.ContainerActionRequest) (*pb.ContainerActionResponse, error) {
var action docker.ContainerAction
switch in.Action {
case pb.ContainerAction_Start:
action = docker.Start
case pb.ContainerAction_Stop:
action = docker.Stop
case pb.ContainerAction_Restart:
action = docker.Restart
default:
return nil, status.Error(codes.InvalidArgument, "invalid action")
}
err := s.client.ContainerActions(action, in.ContainerId)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
return &pb.ContainerActionResponse{}, nil
}
func NewServer(client docker.Client, certificates tls.Certificate, dozzleVersion string) *grpc.Server {
caCertPool := x509.NewCertPool()
c, err := x509.ParseCertificate(certificates.Certificate[0])

View File

@@ -65,5 +65,5 @@ func (d *agentService) SubscribeContainersStarted(ctx context.Context, container
}
func (a *agentService) ContainerAction(container docker.Container, action docker.ContainerAction) error {
panic("not implemented")
return a.client.ContainerAction(container.ID, action)
}

View File

@@ -107,12 +107,12 @@ func (m *RetriableClientManager) RetryAndList() ([]ClientService, []error) {
host.Available = true
// We don't want to block the subscribers in event.go
go func() {
go func(host docker.Host) {
select {
case channel <- host:
case <-ctx.Done():
}
}()
}(host)
return true
})

View File

@@ -19,6 +19,8 @@ service AgentService {
rpc StreamContainerStarted(StreamContainerStartedRequest)
returns (stream StreamContainerStartedResponse) {}
rpc HostInfo(HostInfoRequest) returns (HostInfoResponse) {}
rpc ContainerAction(ContainerActionRequest)
returns (ContainerActionResponse) {}
}
message ListContainersRequest {}
@@ -64,3 +66,11 @@ message HostInfoResponse { Host host = 1; }
message StreamContainerStartedRequest {}
message StreamContainerStartedResponse { Container container = 1; }
message ContainerActionRequest {
string containerId = 1;
ContainerAction action = 2;
}
message ContainerActionResponse {
}

View File

@@ -65,3 +65,9 @@ message Host {
string agentVersion = 11;
string dockerVersion = 12;
}
enum ContainerAction {
Start = 0;
Stop = 1;
Restart = 2;
}