diff --git a/api/grpc/mpi/v1/command.pb.go b/api/grpc/mpi/v1/command.pb.go index 31e94ea7d..dddaa6b8b 100644 --- a/api/grpc/mpi/v1/command.pb.go +++ b/api/grpc/mpi/v1/command.pb.go @@ -85,7 +85,7 @@ func (x InstanceHealth_InstanceHealthStatus) Number() protoreflect.EnumNumber { // Deprecated: Use InstanceHealth_InstanceHealthStatus.Descriptor instead. func (InstanceHealth_InstanceHealthStatus) EnumDescriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{8, 0} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{9, 0} } // the types of instances possible @@ -150,7 +150,63 @@ func (x InstanceMeta_InstanceType) Number() protoreflect.EnumNumber { // Deprecated: Use InstanceMeta_InstanceType.Descriptor instead. func (InstanceMeta_InstanceType) EnumDescriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{26, 0} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{27, 0} +} + +type Log_LogLevel int32 + +const ( + // Info log level + Log_LOG_LEVEL_INFO Log_LogLevel = 0 + // Error log level + Log_LOG_LEVEL_ERROR Log_LogLevel = 1 + // Warning log level + Log_LOG_LEVEL_WARN Log_LogLevel = 2 + // Debug log level + Log_LOG_LEVEL_DEBUG Log_LogLevel = 3 +) + +// Enum value maps for Log_LogLevel. +var ( + Log_LogLevel_name = map[int32]string{ + 0: "LOG_LEVEL_INFO", + 1: "LOG_LEVEL_ERROR", + 2: "LOG_LEVEL_WARN", + 3: "LOG_LEVEL_DEBUG", + } + Log_LogLevel_value = map[string]int32{ + "LOG_LEVEL_INFO": 0, + "LOG_LEVEL_ERROR": 1, + "LOG_LEVEL_WARN": 2, + "LOG_LEVEL_DEBUG": 3, + } +) + +func (x Log_LogLevel) Enum() *Log_LogLevel { + p := new(Log_LogLevel) + *p = x + return p +} + +func (x Log_LogLevel) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Log_LogLevel) Descriptor() protoreflect.EnumDescriptor { + return file_mpi_v1_command_proto_enumTypes[2].Descriptor() +} + +func (Log_LogLevel) Type() protoreflect.EnumType { + return &file_mpi_v1_command_proto_enumTypes[2] +} + +func (x Log_LogLevel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Log_LogLevel.Descriptor instead. +func (Log_LogLevel) EnumDescriptor() ([]byte, []int) { + return file_mpi_v1_command_proto_rawDescGZIP(), []int{37, 0} } // The connection request is an initial handshake to establish a connection, sending NGINX Agent instance information @@ -670,6 +726,60 @@ func (*UpdateDataPlaneStatusResponse) Descriptor() ([]byte, []int) { return file_mpi_v1_command_proto_rawDescGZIP(), []int{7} } +type UpdateAgentConfigRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Meta-information associated with a message + MessageMeta *MessageMeta `protobuf:"bytes,1,opt,name=message_meta,json=messageMeta,proto3" json:"message_meta,omitempty"` + // The NGINX Agent configuration to update + AgentConfig *AgentConfig `protobuf:"bytes,2,opt,name=agent_config,json=agentConfig,proto3" json:"agent_config,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateAgentConfigRequest) Reset() { + *x = UpdateAgentConfigRequest{} + mi := &file_mpi_v1_command_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateAgentConfigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateAgentConfigRequest) ProtoMessage() {} + +func (x *UpdateAgentConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_mpi_v1_command_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateAgentConfigRequest.ProtoReflect.Descriptor instead. +func (*UpdateAgentConfigRequest) Descriptor() ([]byte, []int) { + return file_mpi_v1_command_proto_rawDescGZIP(), []int{8} +} + +func (x *UpdateAgentConfigRequest) GetMessageMeta() *MessageMeta { + if x != nil { + return x.MessageMeta + } + return nil +} + +func (x *UpdateAgentConfigRequest) GetAgentConfig() *AgentConfig { + if x != nil { + return x.AgentConfig + } + return nil +} + type InstanceHealth struct { state protoimpl.MessageState `protogen:"open.v1"` InstanceId string `protobuf:"bytes,1,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` @@ -683,7 +793,7 @@ type InstanceHealth struct { func (x *InstanceHealth) Reset() { *x = InstanceHealth{} - mi := &file_mpi_v1_command_proto_msgTypes[8] + mi := &file_mpi_v1_command_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -695,7 +805,7 @@ func (x *InstanceHealth) String() string { func (*InstanceHealth) ProtoMessage() {} func (x *InstanceHealth) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[8] + mi := &file_mpi_v1_command_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -708,7 +818,7 @@ func (x *InstanceHealth) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceHealth.ProtoReflect.Descriptor instead. func (*InstanceHealth) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{8} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{9} } func (x *InstanceHealth) GetInstanceId() string { @@ -745,7 +855,7 @@ type UpdateDataPlaneHealthRequest struct { func (x *UpdateDataPlaneHealthRequest) Reset() { *x = UpdateDataPlaneHealthRequest{} - mi := &file_mpi_v1_command_proto_msgTypes[9] + mi := &file_mpi_v1_command_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -757,7 +867,7 @@ func (x *UpdateDataPlaneHealthRequest) String() string { func (*UpdateDataPlaneHealthRequest) ProtoMessage() {} func (x *UpdateDataPlaneHealthRequest) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[9] + mi := &file_mpi_v1_command_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -770,7 +880,7 @@ func (x *UpdateDataPlaneHealthRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateDataPlaneHealthRequest.ProtoReflect.Descriptor instead. func (*UpdateDataPlaneHealthRequest) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{9} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{10} } func (x *UpdateDataPlaneHealthRequest) GetMessageMeta() *MessageMeta { @@ -796,7 +906,7 @@ type UpdateDataPlaneHealthResponse struct { func (x *UpdateDataPlaneHealthResponse) Reset() { *x = UpdateDataPlaneHealthResponse{} - mi := &file_mpi_v1_command_proto_msgTypes[10] + mi := &file_mpi_v1_command_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -808,7 +918,7 @@ func (x *UpdateDataPlaneHealthResponse) String() string { func (*UpdateDataPlaneHealthResponse) ProtoMessage() {} func (x *UpdateDataPlaneHealthResponse) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[10] + mi := &file_mpi_v1_command_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -821,7 +931,7 @@ func (x *UpdateDataPlaneHealthResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateDataPlaneHealthResponse.ProtoReflect.Descriptor instead. func (*UpdateDataPlaneHealthResponse) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{10} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{11} } // Reports the status of an associated command. This may be in response to a ManagementPlaneRequest @@ -839,7 +949,7 @@ type DataPlaneResponse struct { func (x *DataPlaneResponse) Reset() { *x = DataPlaneResponse{} - mi := &file_mpi_v1_command_proto_msgTypes[11] + mi := &file_mpi_v1_command_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -851,7 +961,7 @@ func (x *DataPlaneResponse) String() string { func (*DataPlaneResponse) ProtoMessage() {} func (x *DataPlaneResponse) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[11] + mi := &file_mpi_v1_command_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -864,7 +974,7 @@ func (x *DataPlaneResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DataPlaneResponse.ProtoReflect.Descriptor instead. func (*DataPlaneResponse) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{11} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{12} } func (x *DataPlaneResponse) GetMessageMeta() *MessageMeta { @@ -901,6 +1011,7 @@ type ManagementPlaneRequest struct { // *ManagementPlaneRequest_ConfigUploadRequest // *ManagementPlaneRequest_ActionRequest // *ManagementPlaneRequest_CommandStatusRequest + // *ManagementPlaneRequest_UpdateAgentConfigRequest Request isManagementPlaneRequest_Request `protobuf_oneof:"request"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -908,7 +1019,7 @@ type ManagementPlaneRequest struct { func (x *ManagementPlaneRequest) Reset() { *x = ManagementPlaneRequest{} - mi := &file_mpi_v1_command_proto_msgTypes[12] + mi := &file_mpi_v1_command_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -920,7 +1031,7 @@ func (x *ManagementPlaneRequest) String() string { func (*ManagementPlaneRequest) ProtoMessage() {} func (x *ManagementPlaneRequest) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[12] + mi := &file_mpi_v1_command_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -933,7 +1044,7 @@ func (x *ManagementPlaneRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ManagementPlaneRequest.ProtoReflect.Descriptor instead. func (*ManagementPlaneRequest) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{12} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{13} } func (x *ManagementPlaneRequest) GetMessageMeta() *MessageMeta { @@ -1004,6 +1115,15 @@ func (x *ManagementPlaneRequest) GetCommandStatusRequest() *CommandStatusRequest return nil } +func (x *ManagementPlaneRequest) GetUpdateAgentConfigRequest() *UpdateAgentConfigRequest { + if x != nil { + if x, ok := x.Request.(*ManagementPlaneRequest_UpdateAgentConfigRequest); ok { + return x.UpdateAgentConfigRequest + } + } + return nil +} + type isManagementPlaneRequest_Request interface { isManagementPlaneRequest_Request() } @@ -1039,6 +1159,11 @@ type ManagementPlaneRequest_CommandStatusRequest struct { CommandStatusRequest *CommandStatusRequest `protobuf:"bytes,8,opt,name=command_status_request,json=commandStatusRequest,proto3,oneof"` } +type ManagementPlaneRequest_UpdateAgentConfigRequest struct { + // triggers an update to the NGINX Agent configuration + UpdateAgentConfigRequest *UpdateAgentConfigRequest `protobuf:"bytes,9,opt,name=update_agent_config_request,json=updateAgentConfigRequest,proto3,oneof"` +} + func (*ManagementPlaneRequest_StatusRequest) isManagementPlaneRequest_Request() {} func (*ManagementPlaneRequest_HealthRequest) isManagementPlaneRequest_Request() {} @@ -1051,6 +1176,8 @@ func (*ManagementPlaneRequest_ActionRequest) isManagementPlaneRequest_Request() func (*ManagementPlaneRequest_CommandStatusRequest) isManagementPlaneRequest_Request() {} +func (*ManagementPlaneRequest_UpdateAgentConfigRequest) isManagementPlaneRequest_Request() {} + // Additional information associated with a StatusRequest type StatusRequest struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -1060,7 +1187,7 @@ type StatusRequest struct { func (x *StatusRequest) Reset() { *x = StatusRequest{} - mi := &file_mpi_v1_command_proto_msgTypes[13] + mi := &file_mpi_v1_command_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1072,7 +1199,7 @@ func (x *StatusRequest) String() string { func (*StatusRequest) ProtoMessage() {} func (x *StatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[13] + mi := &file_mpi_v1_command_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1085,7 +1212,7 @@ func (x *StatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. func (*StatusRequest) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{13} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{14} } // Additional information associated with a HealthRequest @@ -1097,7 +1224,7 @@ type HealthRequest struct { func (x *HealthRequest) Reset() { *x = HealthRequest{} - mi := &file_mpi_v1_command_proto_msgTypes[14] + mi := &file_mpi_v1_command_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1109,7 +1236,7 @@ func (x *HealthRequest) String() string { func (*HealthRequest) ProtoMessage() {} func (x *HealthRequest) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[14] + mi := &file_mpi_v1_command_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1122,7 +1249,7 @@ func (x *HealthRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use HealthRequest.ProtoReflect.Descriptor instead. func (*HealthRequest) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{14} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{15} } // Additional information associated with a ConfigApplyRequest @@ -1136,7 +1263,7 @@ type ConfigApplyRequest struct { func (x *ConfigApplyRequest) Reset() { *x = ConfigApplyRequest{} - mi := &file_mpi_v1_command_proto_msgTypes[15] + mi := &file_mpi_v1_command_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1148,7 +1275,7 @@ func (x *ConfigApplyRequest) String() string { func (*ConfigApplyRequest) ProtoMessage() {} func (x *ConfigApplyRequest) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[15] + mi := &file_mpi_v1_command_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1161,7 +1288,7 @@ func (x *ConfigApplyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ConfigApplyRequest.ProtoReflect.Descriptor instead. func (*ConfigApplyRequest) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{15} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{16} } func (x *ConfigApplyRequest) GetOverview() *FileOverview { @@ -1182,7 +1309,7 @@ type ConfigUploadRequest struct { func (x *ConfigUploadRequest) Reset() { *x = ConfigUploadRequest{} - mi := &file_mpi_v1_command_proto_msgTypes[16] + mi := &file_mpi_v1_command_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1194,7 +1321,7 @@ func (x *ConfigUploadRequest) String() string { func (*ConfigUploadRequest) ProtoMessage() {} func (x *ConfigUploadRequest) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[16] + mi := &file_mpi_v1_command_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1207,7 +1334,7 @@ func (x *ConfigUploadRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ConfigUploadRequest.ProtoReflect.Descriptor instead. func (*ConfigUploadRequest) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{16} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{17} } func (x *ConfigUploadRequest) GetOverview() *FileOverview { @@ -1234,7 +1361,7 @@ type APIActionRequest struct { func (x *APIActionRequest) Reset() { *x = APIActionRequest{} - mi := &file_mpi_v1_command_proto_msgTypes[17] + mi := &file_mpi_v1_command_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1246,7 +1373,7 @@ func (x *APIActionRequest) String() string { func (*APIActionRequest) ProtoMessage() {} func (x *APIActionRequest) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[17] + mi := &file_mpi_v1_command_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1259,7 +1386,7 @@ func (x *APIActionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use APIActionRequest.ProtoReflect.Descriptor instead. func (*APIActionRequest) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{17} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{18} } func (x *APIActionRequest) GetInstanceId() string { @@ -1314,7 +1441,7 @@ type NGINXPlusAction struct { func (x *NGINXPlusAction) Reset() { *x = NGINXPlusAction{} - mi := &file_mpi_v1_command_proto_msgTypes[18] + mi := &file_mpi_v1_command_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1326,7 +1453,7 @@ func (x *NGINXPlusAction) String() string { func (*NGINXPlusAction) ProtoMessage() {} func (x *NGINXPlusAction) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[18] + mi := &file_mpi_v1_command_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1339,7 +1466,7 @@ func (x *NGINXPlusAction) ProtoReflect() protoreflect.Message { // Deprecated: Use NGINXPlusAction.ProtoReflect.Descriptor instead. func (*NGINXPlusAction) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{18} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{19} } func (x *NGINXPlusAction) GetAction() isNGINXPlusAction_Action { @@ -1441,7 +1568,7 @@ type UpdateHTTPUpstreamServers struct { func (x *UpdateHTTPUpstreamServers) Reset() { *x = UpdateHTTPUpstreamServers{} - mi := &file_mpi_v1_command_proto_msgTypes[19] + mi := &file_mpi_v1_command_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1453,7 +1580,7 @@ func (x *UpdateHTTPUpstreamServers) String() string { func (*UpdateHTTPUpstreamServers) ProtoMessage() {} func (x *UpdateHTTPUpstreamServers) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[19] + mi := &file_mpi_v1_command_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1466,7 +1593,7 @@ func (x *UpdateHTTPUpstreamServers) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateHTTPUpstreamServers.ProtoReflect.Descriptor instead. func (*UpdateHTTPUpstreamServers) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{19} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{20} } func (x *UpdateHTTPUpstreamServers) GetHttpUpstreamName() string { @@ -1494,7 +1621,7 @@ type GetHTTPUpstreamServers struct { func (x *GetHTTPUpstreamServers) Reset() { *x = GetHTTPUpstreamServers{} - mi := &file_mpi_v1_command_proto_msgTypes[20] + mi := &file_mpi_v1_command_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1506,7 +1633,7 @@ func (x *GetHTTPUpstreamServers) String() string { func (*GetHTTPUpstreamServers) ProtoMessage() {} func (x *GetHTTPUpstreamServers) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[20] + mi := &file_mpi_v1_command_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1519,7 +1646,7 @@ func (x *GetHTTPUpstreamServers) ProtoReflect() protoreflect.Message { // Deprecated: Use GetHTTPUpstreamServers.ProtoReflect.Descriptor instead. func (*GetHTTPUpstreamServers) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{20} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{21} } func (x *GetHTTPUpstreamServers) GetHttpUpstreamName() string { @@ -1542,7 +1669,7 @@ type UpdateStreamServers struct { func (x *UpdateStreamServers) Reset() { *x = UpdateStreamServers{} - mi := &file_mpi_v1_command_proto_msgTypes[21] + mi := &file_mpi_v1_command_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1554,7 +1681,7 @@ func (x *UpdateStreamServers) String() string { func (*UpdateStreamServers) ProtoMessage() {} func (x *UpdateStreamServers) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[21] + mi := &file_mpi_v1_command_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1567,7 +1694,7 @@ func (x *UpdateStreamServers) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateStreamServers.ProtoReflect.Descriptor instead. func (*UpdateStreamServers) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{21} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{22} } func (x *UpdateStreamServers) GetUpstreamStreamName() string { @@ -1593,7 +1720,7 @@ type GetUpstreams struct { func (x *GetUpstreams) Reset() { *x = GetUpstreams{} - mi := &file_mpi_v1_command_proto_msgTypes[22] + mi := &file_mpi_v1_command_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1605,7 +1732,7 @@ func (x *GetUpstreams) String() string { func (*GetUpstreams) ProtoMessage() {} func (x *GetUpstreams) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[22] + mi := &file_mpi_v1_command_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1618,7 +1745,7 @@ func (x *GetUpstreams) ProtoReflect() protoreflect.Message { // Deprecated: Use GetUpstreams.ProtoReflect.Descriptor instead. func (*GetUpstreams) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{22} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{23} } // Get Stream Upstream Servers for an instance @@ -1630,7 +1757,7 @@ type GetStreamUpstreams struct { func (x *GetStreamUpstreams) Reset() { *x = GetStreamUpstreams{} - mi := &file_mpi_v1_command_proto_msgTypes[23] + mi := &file_mpi_v1_command_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1642,7 +1769,7 @@ func (x *GetStreamUpstreams) String() string { func (*GetStreamUpstreams) ProtoMessage() {} func (x *GetStreamUpstreams) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[23] + mi := &file_mpi_v1_command_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1655,7 +1782,7 @@ func (x *GetStreamUpstreams) ProtoReflect() protoreflect.Message { // Deprecated: Use GetStreamUpstreams.ProtoReflect.Descriptor instead. func (*GetStreamUpstreams) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{23} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{24} } // Request an update on a particular command @@ -1667,7 +1794,7 @@ type CommandStatusRequest struct { func (x *CommandStatusRequest) Reset() { *x = CommandStatusRequest{} - mi := &file_mpi_v1_command_proto_msgTypes[24] + mi := &file_mpi_v1_command_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1679,7 +1806,7 @@ func (x *CommandStatusRequest) String() string { func (*CommandStatusRequest) ProtoMessage() {} func (x *CommandStatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[24] + mi := &file_mpi_v1_command_proto_msgTypes[25] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1692,7 +1819,7 @@ func (x *CommandStatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CommandStatusRequest.ProtoReflect.Descriptor instead. func (*CommandStatusRequest) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{24} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{25} } // This represents an instance being reported on @@ -1710,7 +1837,7 @@ type Instance struct { func (x *Instance) Reset() { *x = Instance{} - mi := &file_mpi_v1_command_proto_msgTypes[25] + mi := &file_mpi_v1_command_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1722,7 +1849,7 @@ func (x *Instance) String() string { func (*Instance) ProtoMessage() {} func (x *Instance) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[25] + mi := &file_mpi_v1_command_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1735,7 +1862,7 @@ func (x *Instance) ProtoReflect() protoreflect.Message { // Deprecated: Use Instance.ProtoReflect.Descriptor instead. func (*Instance) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{25} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{26} } func (x *Instance) GetInstanceMeta() *InstanceMeta { @@ -1774,7 +1901,7 @@ type InstanceMeta struct { func (x *InstanceMeta) Reset() { *x = InstanceMeta{} - mi := &file_mpi_v1_command_proto_msgTypes[26] + mi := &file_mpi_v1_command_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1786,7 +1913,7 @@ func (x *InstanceMeta) String() string { func (*InstanceMeta) ProtoMessage() {} func (x *InstanceMeta) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[26] + mi := &file_mpi_v1_command_proto_msgTypes[27] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1799,7 +1926,7 @@ func (x *InstanceMeta) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceMeta.ProtoReflect.Descriptor instead. func (*InstanceMeta) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{26} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{27} } func (x *InstanceMeta) GetInstanceId() string { @@ -1838,7 +1965,7 @@ type InstanceConfig struct { func (x *InstanceConfig) Reset() { *x = InstanceConfig{} - mi := &file_mpi_v1_command_proto_msgTypes[27] + mi := &file_mpi_v1_command_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1850,7 +1977,7 @@ func (x *InstanceConfig) String() string { func (*InstanceConfig) ProtoMessage() {} func (x *InstanceConfig) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[27] + mi := &file_mpi_v1_command_proto_msgTypes[28] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1863,7 +1990,7 @@ func (x *InstanceConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceConfig.ProtoReflect.Descriptor instead. func (*InstanceConfig) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{27} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{28} } func (x *InstanceConfig) GetActions() []*InstanceAction { @@ -1924,7 +2051,7 @@ type InstanceRuntime struct { func (x *InstanceRuntime) Reset() { *x = InstanceRuntime{} - mi := &file_mpi_v1_command_proto_msgTypes[28] + mi := &file_mpi_v1_command_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1936,7 +2063,7 @@ func (x *InstanceRuntime) String() string { func (*InstanceRuntime) ProtoMessage() {} func (x *InstanceRuntime) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[28] + mi := &file_mpi_v1_command_proto_msgTypes[29] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1949,7 +2076,7 @@ func (x *InstanceRuntime) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceRuntime.ProtoReflect.Descriptor instead. func (*InstanceRuntime) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{28} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{29} } func (x *InstanceRuntime) GetProcessId() int32 { @@ -2049,7 +2176,7 @@ type InstanceChild struct { func (x *InstanceChild) Reset() { *x = InstanceChild{} - mi := &file_mpi_v1_command_proto_msgTypes[29] + mi := &file_mpi_v1_command_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2061,7 +2188,7 @@ func (x *InstanceChild) String() string { func (*InstanceChild) ProtoMessage() {} func (x *InstanceChild) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[29] + mi := &file_mpi_v1_command_proto_msgTypes[30] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2074,7 +2201,7 @@ func (x *InstanceChild) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceChild.ProtoReflect.Descriptor instead. func (*InstanceChild) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{29} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{30} } func (x *InstanceChild) GetProcessId() int32 { @@ -2103,7 +2230,7 @@ type NGINXRuntimeInfo struct { func (x *NGINXRuntimeInfo) Reset() { *x = NGINXRuntimeInfo{} - mi := &file_mpi_v1_command_proto_msgTypes[30] + mi := &file_mpi_v1_command_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2115,7 +2242,7 @@ func (x *NGINXRuntimeInfo) String() string { func (*NGINXRuntimeInfo) ProtoMessage() {} func (x *NGINXRuntimeInfo) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[30] + mi := &file_mpi_v1_command_proto_msgTypes[31] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2128,7 +2255,7 @@ func (x *NGINXRuntimeInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use NGINXRuntimeInfo.ProtoReflect.Descriptor instead. func (*NGINXRuntimeInfo) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{30} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{31} } func (x *NGINXRuntimeInfo) GetStubStatus() *APIDetails { @@ -2187,7 +2314,7 @@ type NGINXPlusRuntimeInfo struct { func (x *NGINXPlusRuntimeInfo) Reset() { *x = NGINXPlusRuntimeInfo{} - mi := &file_mpi_v1_command_proto_msgTypes[31] + mi := &file_mpi_v1_command_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2199,7 +2326,7 @@ func (x *NGINXPlusRuntimeInfo) String() string { func (*NGINXPlusRuntimeInfo) ProtoMessage() {} func (x *NGINXPlusRuntimeInfo) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[31] + mi := &file_mpi_v1_command_proto_msgTypes[32] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2212,7 +2339,7 @@ func (x *NGINXPlusRuntimeInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use NGINXPlusRuntimeInfo.ProtoReflect.Descriptor instead. func (*NGINXPlusRuntimeInfo) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{31} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{32} } func (x *NGINXPlusRuntimeInfo) GetStubStatus() *APIDetails { @@ -2271,7 +2398,7 @@ type APIDetails struct { func (x *APIDetails) Reset() { *x = APIDetails{} - mi := &file_mpi_v1_command_proto_msgTypes[32] + mi := &file_mpi_v1_command_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2283,7 +2410,7 @@ func (x *APIDetails) String() string { func (*APIDetails) ProtoMessage() {} func (x *APIDetails) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[32] + mi := &file_mpi_v1_command_proto_msgTypes[33] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2296,7 +2423,7 @@ func (x *APIDetails) ProtoReflect() protoreflect.Message { // Deprecated: Use APIDetails.ProtoReflect.Descriptor instead. func (*APIDetails) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{32} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{33} } func (x *APIDetails) GetLocation() string { @@ -2337,7 +2464,7 @@ type NGINXAppProtectRuntimeInfo struct { func (x *NGINXAppProtectRuntimeInfo) Reset() { *x = NGINXAppProtectRuntimeInfo{} - mi := &file_mpi_v1_command_proto_msgTypes[33] + mi := &file_mpi_v1_command_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2349,7 +2476,7 @@ func (x *NGINXAppProtectRuntimeInfo) String() string { func (*NGINXAppProtectRuntimeInfo) ProtoMessage() {} func (x *NGINXAppProtectRuntimeInfo) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[33] + mi := &file_mpi_v1_command_proto_msgTypes[34] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2362,7 +2489,7 @@ func (x *NGINXAppProtectRuntimeInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use NGINXAppProtectRuntimeInfo.ProtoReflect.Descriptor instead. func (*NGINXAppProtectRuntimeInfo) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{33} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{34} } func (x *NGINXAppProtectRuntimeInfo) GetRelease() string { @@ -2402,7 +2529,7 @@ type InstanceAction struct { func (x *InstanceAction) Reset() { *x = InstanceAction{} - mi := &file_mpi_v1_command_proto_msgTypes[34] + mi := &file_mpi_v1_command_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2414,7 +2541,7 @@ func (x *InstanceAction) String() string { func (*InstanceAction) ProtoMessage() {} func (x *InstanceAction) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[34] + mi := &file_mpi_v1_command_proto_msgTypes[35] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2427,7 +2554,7 @@ func (x *InstanceAction) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceAction.ProtoReflect.Descriptor instead. func (*InstanceAction) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{34} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{35} } // This contains a series of NGINX Agent configurations @@ -2447,13 +2574,15 @@ type AgentConfig struct { MessageBufferSize string `protobuf:"bytes,6,opt,name=message_buffer_size,json=messageBufferSize,proto3" json:"message_buffer_size,omitempty"` // Auxiliary Command server settings AuxiliaryCommand *AuxiliaryCommandServer `protobuf:"bytes,7,opt,name=auxiliary_command,json=auxiliaryCommand,proto3" json:"auxiliary_command,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // Log settings + Log *Log `protobuf:"bytes,8,opt,name=log,proto3" json:"log,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *AgentConfig) Reset() { *x = AgentConfig{} - mi := &file_mpi_v1_command_proto_msgTypes[35] + mi := &file_mpi_v1_command_proto_msgTypes[36] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2465,7 +2594,7 @@ func (x *AgentConfig) String() string { func (*AgentConfig) ProtoMessage() {} func (x *AgentConfig) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[35] + mi := &file_mpi_v1_command_proto_msgTypes[36] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2478,7 +2607,7 @@ func (x *AgentConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use AgentConfig.ProtoReflect.Descriptor instead. func (*AgentConfig) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{35} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{36} } func (x *AgentConfig) GetCommand() *CommandServer { @@ -2530,6 +2659,66 @@ func (x *AgentConfig) GetAuxiliaryCommand() *AuxiliaryCommandServer { return nil } +func (x *AgentConfig) GetLog() *Log { + if x != nil { + return x.Log + } + return nil +} + +// The log settings associated with NGINX Agent +type Log struct { + state protoimpl.MessageState `protogen:"open.v1"` + LogLevel Log_LogLevel `protobuf:"varint,1,opt,name=log_level,json=logLevel,proto3,enum=mpi.v1.Log_LogLevel" json:"log_level,omitempty"` + LogPath string `protobuf:"bytes,2,opt,name=log_path,json=logPath,proto3" json:"log_path,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Log) Reset() { + *x = Log{} + mi := &file_mpi_v1_command_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Log) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Log) ProtoMessage() {} + +func (x *Log) ProtoReflect() protoreflect.Message { + mi := &file_mpi_v1_command_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Log.ProtoReflect.Descriptor instead. +func (*Log) Descriptor() ([]byte, []int) { + return file_mpi_v1_command_proto_rawDescGZIP(), []int{37} +} + +func (x *Log) GetLogLevel() Log_LogLevel { + if x != nil { + return x.LogLevel + } + return Log_LOG_LEVEL_INFO +} + +func (x *Log) GetLogPath() string { + if x != nil { + return x.LogPath + } + return "" +} + // The command server settings, associated with messaging from an external source type CommandServer struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -2545,7 +2734,7 @@ type CommandServer struct { func (x *CommandServer) Reset() { *x = CommandServer{} - mi := &file_mpi_v1_command_proto_msgTypes[36] + mi := &file_mpi_v1_command_proto_msgTypes[38] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2557,7 +2746,7 @@ func (x *CommandServer) String() string { func (*CommandServer) ProtoMessage() {} func (x *CommandServer) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[36] + mi := &file_mpi_v1_command_proto_msgTypes[38] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2570,7 +2759,7 @@ func (x *CommandServer) ProtoReflect() protoreflect.Message { // Deprecated: Use CommandServer.ProtoReflect.Descriptor instead. func (*CommandServer) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{36} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{38} } func (x *CommandServer) GetServer() *ServerSettings { @@ -2609,7 +2798,7 @@ type AuxiliaryCommandServer struct { func (x *AuxiliaryCommandServer) Reset() { *x = AuxiliaryCommandServer{} - mi := &file_mpi_v1_command_proto_msgTypes[37] + mi := &file_mpi_v1_command_proto_msgTypes[39] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2621,7 +2810,7 @@ func (x *AuxiliaryCommandServer) String() string { func (*AuxiliaryCommandServer) ProtoMessage() {} func (x *AuxiliaryCommandServer) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[37] + mi := &file_mpi_v1_command_proto_msgTypes[39] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2634,7 +2823,7 @@ func (x *AuxiliaryCommandServer) ProtoReflect() protoreflect.Message { // Deprecated: Use AuxiliaryCommandServer.ProtoReflect.Descriptor instead. func (*AuxiliaryCommandServer) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{37} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{39} } func (x *AuxiliaryCommandServer) GetServer() *ServerSettings { @@ -2667,7 +2856,7 @@ type MetricsServer struct { func (x *MetricsServer) Reset() { *x = MetricsServer{} - mi := &file_mpi_v1_command_proto_msgTypes[38] + mi := &file_mpi_v1_command_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2679,7 +2868,7 @@ func (x *MetricsServer) String() string { func (*MetricsServer) ProtoMessage() {} func (x *MetricsServer) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[38] + mi := &file_mpi_v1_command_proto_msgTypes[40] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2692,7 +2881,7 @@ func (x *MetricsServer) ProtoReflect() protoreflect.Message { // Deprecated: Use MetricsServer.ProtoReflect.Descriptor instead. func (*MetricsServer) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{38} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{40} } // The file settings associated with file server for configurations @@ -2704,7 +2893,7 @@ type FileServer struct { func (x *FileServer) Reset() { *x = FileServer{} - mi := &file_mpi_v1_command_proto_msgTypes[39] + mi := &file_mpi_v1_command_proto_msgTypes[41] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2716,7 +2905,7 @@ func (x *FileServer) String() string { func (*FileServer) ProtoMessage() {} func (x *FileServer) ProtoReflect() protoreflect.Message { - mi := &file_mpi_v1_command_proto_msgTypes[39] + mi := &file_mpi_v1_command_proto_msgTypes[41] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2729,7 +2918,7 @@ func (x *FileServer) ProtoReflect() protoreflect.Message { // Deprecated: Use FileServer.ProtoReflect.Descriptor instead. func (*FileServer) Descriptor() ([]byte, []int) { - return file_mpi_v1_command_proto_rawDescGZIP(), []int{39} + return file_mpi_v1_command_proto_rawDescGZIP(), []int{41} } var File_mpi_v1_command_proto protoreflect.FileDescriptor @@ -2768,7 +2957,10 @@ const file_mpi_v1_command_proto_rawDesc = "" + "\x1cUpdateDataPlaneStatusRequest\x126\n" + "\fmessage_meta\x18\x01 \x01(\v2\x13.mpi.v1.MessageMetaR\vmessageMeta\x12,\n" + "\bresource\x18\x02 \x01(\v2\x10.mpi.v1.ResourceR\bresource\"\x1f\n" + - "\x1dUpdateDataPlaneStatusResponse\"\xf0\x02\n" + + "\x1dUpdateDataPlaneStatusResponse\"\x8a\x01\n" + + "\x18UpdateAgentConfigRequest\x126\n" + + "\fmessage_meta\x18\x01 \x01(\v2\x13.mpi.v1.MessageMetaR\vmessageMeta\x126\n" + + "\fagent_config\x18\x02 \x01(\v2\x13.mpi.v1.AgentConfigR\vagentConfig\"\xf0\x02\n" + "\x0eInstanceHealth\x12)\n" + "\vinstance_id\x18\x01 \x01(\tB\b\xbaH\x05r\x03\xb0\x01\x01R\n" + "instanceId\x12a\n" + @@ -2787,7 +2979,7 @@ const file_mpi_v1_command_proto_rawDesc = "" + "\fmessage_meta\x18\x01 \x01(\v2\x13.mpi.v1.MessageMetaR\vmessageMeta\x12B\n" + "\x10command_response\x18\x02 \x01(\v2\x17.mpi.v1.CommandResponseR\x0fcommandResponse\x12\x1f\n" + "\vinstance_id\x18\x03 \x01(\tR\n" + - "instanceId\"\x97\x04\n" + + "instanceId\"\xfa\x04\n" + "\x16ManagementPlaneRequest\x126\n" + "\fmessage_meta\x18\x01 \x01(\v2\x13.mpi.v1.MessageMetaR\vmessageMeta\x12>\n" + "\x0estatus_request\x18\x02 \x01(\v2\x15.mpi.v1.StatusRequestH\x00R\rstatusRequest\x12>\n" + @@ -2795,7 +2987,8 @@ const file_mpi_v1_command_proto_rawDesc = "" + "\x14config_apply_request\x18\x05 \x01(\v2\x1a.mpi.v1.ConfigApplyRequestH\x00R\x12configApplyRequest\x12Q\n" + "\x15config_upload_request\x18\x06 \x01(\v2\x1b.mpi.v1.ConfigUploadRequestH\x00R\x13configUploadRequest\x12A\n" + "\x0eaction_request\x18\a \x01(\v2\x18.mpi.v1.APIActionRequestH\x00R\ractionRequest\x12T\n" + - "\x16command_status_request\x18\b \x01(\v2\x1c.mpi.v1.CommandStatusRequestH\x00R\x14commandStatusRequestB\t\n" + + "\x16command_status_request\x18\b \x01(\v2\x1c.mpi.v1.CommandStatusRequestH\x00R\x14commandStatusRequest\x12a\n" + + "\x1bupdate_agent_config_request\x18\t \x01(\v2 .mpi.v1.UpdateAgentConfigRequestH\x00R\x18updateAgentConfigRequestB\t\n" + "\arequest\"\x0f\n" + "\rStatusRequest\"\x0f\n" + "\rHealthRequest\"F\n" + @@ -2892,7 +3085,7 @@ const file_mpi_v1_command_proto_rawDesc = "" + "\x18attack_signature_version\x18\x02 \x01(\tR\x16attackSignatureVersion\x126\n" + "\x17threat_campaign_version\x18\x03 \x01(\tR\x15threatCampaignVersion\x126\n" + "\x17enforcer_engine_version\x18\x04 \x01(\tR\x15enforcerEngineVersion\"\x10\n" + - "\x0eInstanceAction\"\xe1\x02\n" + + "\x0eInstanceAction\"\x80\x03\n" + "\vAgentConfig\x12/\n" + "\acommand\x18\x01 \x01(\v2\x15.mpi.v1.CommandServerR\acommand\x12/\n" + "\ametrics\x18\x02 \x01(\v2\x15.mpi.v1.MetricsServerR\ametrics\x12&\n" + @@ -2900,7 +3093,16 @@ const file_mpi_v1_command_proto_rawDesc = "" + "\x06labels\x18\x04 \x03(\v2\x17.google.protobuf.StructR\x06labels\x12\x1a\n" + "\bfeatures\x18\x05 \x03(\tR\bfeatures\x12.\n" + "\x13message_buffer_size\x18\x06 \x01(\tR\x11messageBufferSize\x12K\n" + - "\x11auxiliary_command\x18\a \x01(\v2\x1e.mpi.v1.AuxiliaryCommandServerR\x10auxiliaryCommand\"\x90\x01\n" + + "\x11auxiliary_command\x18\a \x01(\v2\x1e.mpi.v1.AuxiliaryCommandServerR\x10auxiliaryCommand\x12\x1d\n" + + "\x03log\x18\b \x01(\v2\v.mpi.v1.LogR\x03log\"\xb1\x01\n" + + "\x03Log\x121\n" + + "\tlog_level\x18\x01 \x01(\x0e2\x14.mpi.v1.Log.LogLevelR\blogLevel\x12\x19\n" + + "\blog_path\x18\x02 \x01(\tR\alogPath\"\\\n" + + "\bLogLevel\x12\x12\n" + + "\x0eLOG_LEVEL_INFO\x10\x00\x12\x13\n" + + "\x0fLOG_LEVEL_ERROR\x10\x01\x12\x12\n" + + "\x0eLOG_LEVEL_WARN\x10\x02\x12\x13\n" + + "\x0fLOG_LEVEL_DEBUG\x10\x03\"\x90\x01\n" + "\rCommandServer\x12.\n" + "\x06server\x18\x01 \x01(\v2\x16.mpi.v1.ServerSettingsR\x06server\x12(\n" + "\x04auth\x18\x02 \x01(\v2\x14.mpi.v1.AuthSettingsR\x04auth\x12%\n" + @@ -2930,130 +3132,138 @@ func file_mpi_v1_command_proto_rawDescGZIP() []byte { return file_mpi_v1_command_proto_rawDescData } -var file_mpi_v1_command_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_mpi_v1_command_proto_msgTypes = make([]protoimpl.MessageInfo, 40) +var file_mpi_v1_command_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_mpi_v1_command_proto_msgTypes = make([]protoimpl.MessageInfo, 42) var file_mpi_v1_command_proto_goTypes = []any{ (InstanceHealth_InstanceHealthStatus)(0), // 0: mpi.v1.InstanceHealth.InstanceHealthStatus (InstanceMeta_InstanceType)(0), // 1: mpi.v1.InstanceMeta.InstanceType - (*CreateConnectionRequest)(nil), // 2: mpi.v1.CreateConnectionRequest - (*Resource)(nil), // 3: mpi.v1.Resource - (*HostInfo)(nil), // 4: mpi.v1.HostInfo - (*ReleaseInfo)(nil), // 5: mpi.v1.ReleaseInfo - (*ContainerInfo)(nil), // 6: mpi.v1.ContainerInfo - (*CreateConnectionResponse)(nil), // 7: mpi.v1.CreateConnectionResponse - (*UpdateDataPlaneStatusRequest)(nil), // 8: mpi.v1.UpdateDataPlaneStatusRequest - (*UpdateDataPlaneStatusResponse)(nil), // 9: mpi.v1.UpdateDataPlaneStatusResponse - (*InstanceHealth)(nil), // 10: mpi.v1.InstanceHealth - (*UpdateDataPlaneHealthRequest)(nil), // 11: mpi.v1.UpdateDataPlaneHealthRequest - (*UpdateDataPlaneHealthResponse)(nil), // 12: mpi.v1.UpdateDataPlaneHealthResponse - (*DataPlaneResponse)(nil), // 13: mpi.v1.DataPlaneResponse - (*ManagementPlaneRequest)(nil), // 14: mpi.v1.ManagementPlaneRequest - (*StatusRequest)(nil), // 15: mpi.v1.StatusRequest - (*HealthRequest)(nil), // 16: mpi.v1.HealthRequest - (*ConfigApplyRequest)(nil), // 17: mpi.v1.ConfigApplyRequest - (*ConfigUploadRequest)(nil), // 18: mpi.v1.ConfigUploadRequest - (*APIActionRequest)(nil), // 19: mpi.v1.APIActionRequest - (*NGINXPlusAction)(nil), // 20: mpi.v1.NGINXPlusAction - (*UpdateHTTPUpstreamServers)(nil), // 21: mpi.v1.UpdateHTTPUpstreamServers - (*GetHTTPUpstreamServers)(nil), // 22: mpi.v1.GetHTTPUpstreamServers - (*UpdateStreamServers)(nil), // 23: mpi.v1.UpdateStreamServers - (*GetUpstreams)(nil), // 24: mpi.v1.GetUpstreams - (*GetStreamUpstreams)(nil), // 25: mpi.v1.GetStreamUpstreams - (*CommandStatusRequest)(nil), // 26: mpi.v1.CommandStatusRequest - (*Instance)(nil), // 27: mpi.v1.Instance - (*InstanceMeta)(nil), // 28: mpi.v1.InstanceMeta - (*InstanceConfig)(nil), // 29: mpi.v1.InstanceConfig - (*InstanceRuntime)(nil), // 30: mpi.v1.InstanceRuntime - (*InstanceChild)(nil), // 31: mpi.v1.InstanceChild - (*NGINXRuntimeInfo)(nil), // 32: mpi.v1.NGINXRuntimeInfo - (*NGINXPlusRuntimeInfo)(nil), // 33: mpi.v1.NGINXPlusRuntimeInfo - (*APIDetails)(nil), // 34: mpi.v1.APIDetails - (*NGINXAppProtectRuntimeInfo)(nil), // 35: mpi.v1.NGINXAppProtectRuntimeInfo - (*InstanceAction)(nil), // 36: mpi.v1.InstanceAction - (*AgentConfig)(nil), // 37: mpi.v1.AgentConfig - (*CommandServer)(nil), // 38: mpi.v1.CommandServer - (*AuxiliaryCommandServer)(nil), // 39: mpi.v1.AuxiliaryCommandServer - (*MetricsServer)(nil), // 40: mpi.v1.MetricsServer - (*FileServer)(nil), // 41: mpi.v1.FileServer - (*MessageMeta)(nil), // 42: mpi.v1.MessageMeta - (*CommandResponse)(nil), // 43: mpi.v1.CommandResponse - (*FileOverview)(nil), // 44: mpi.v1.FileOverview - (*structpb.Struct)(nil), // 45: google.protobuf.Struct - (*ServerSettings)(nil), // 46: mpi.v1.ServerSettings - (*AuthSettings)(nil), // 47: mpi.v1.AuthSettings - (*TLSSettings)(nil), // 48: mpi.v1.TLSSettings + (Log_LogLevel)(0), // 2: mpi.v1.Log.LogLevel + (*CreateConnectionRequest)(nil), // 3: mpi.v1.CreateConnectionRequest + (*Resource)(nil), // 4: mpi.v1.Resource + (*HostInfo)(nil), // 5: mpi.v1.HostInfo + (*ReleaseInfo)(nil), // 6: mpi.v1.ReleaseInfo + (*ContainerInfo)(nil), // 7: mpi.v1.ContainerInfo + (*CreateConnectionResponse)(nil), // 8: mpi.v1.CreateConnectionResponse + (*UpdateDataPlaneStatusRequest)(nil), // 9: mpi.v1.UpdateDataPlaneStatusRequest + (*UpdateDataPlaneStatusResponse)(nil), // 10: mpi.v1.UpdateDataPlaneStatusResponse + (*UpdateAgentConfigRequest)(nil), // 11: mpi.v1.UpdateAgentConfigRequest + (*InstanceHealth)(nil), // 12: mpi.v1.InstanceHealth + (*UpdateDataPlaneHealthRequest)(nil), // 13: mpi.v1.UpdateDataPlaneHealthRequest + (*UpdateDataPlaneHealthResponse)(nil), // 14: mpi.v1.UpdateDataPlaneHealthResponse + (*DataPlaneResponse)(nil), // 15: mpi.v1.DataPlaneResponse + (*ManagementPlaneRequest)(nil), // 16: mpi.v1.ManagementPlaneRequest + (*StatusRequest)(nil), // 17: mpi.v1.StatusRequest + (*HealthRequest)(nil), // 18: mpi.v1.HealthRequest + (*ConfigApplyRequest)(nil), // 19: mpi.v1.ConfigApplyRequest + (*ConfigUploadRequest)(nil), // 20: mpi.v1.ConfigUploadRequest + (*APIActionRequest)(nil), // 21: mpi.v1.APIActionRequest + (*NGINXPlusAction)(nil), // 22: mpi.v1.NGINXPlusAction + (*UpdateHTTPUpstreamServers)(nil), // 23: mpi.v1.UpdateHTTPUpstreamServers + (*GetHTTPUpstreamServers)(nil), // 24: mpi.v1.GetHTTPUpstreamServers + (*UpdateStreamServers)(nil), // 25: mpi.v1.UpdateStreamServers + (*GetUpstreams)(nil), // 26: mpi.v1.GetUpstreams + (*GetStreamUpstreams)(nil), // 27: mpi.v1.GetStreamUpstreams + (*CommandStatusRequest)(nil), // 28: mpi.v1.CommandStatusRequest + (*Instance)(nil), // 29: mpi.v1.Instance + (*InstanceMeta)(nil), // 30: mpi.v1.InstanceMeta + (*InstanceConfig)(nil), // 31: mpi.v1.InstanceConfig + (*InstanceRuntime)(nil), // 32: mpi.v1.InstanceRuntime + (*InstanceChild)(nil), // 33: mpi.v1.InstanceChild + (*NGINXRuntimeInfo)(nil), // 34: mpi.v1.NGINXRuntimeInfo + (*NGINXPlusRuntimeInfo)(nil), // 35: mpi.v1.NGINXPlusRuntimeInfo + (*APIDetails)(nil), // 36: mpi.v1.APIDetails + (*NGINXAppProtectRuntimeInfo)(nil), // 37: mpi.v1.NGINXAppProtectRuntimeInfo + (*InstanceAction)(nil), // 38: mpi.v1.InstanceAction + (*AgentConfig)(nil), // 39: mpi.v1.AgentConfig + (*Log)(nil), // 40: mpi.v1.Log + (*CommandServer)(nil), // 41: mpi.v1.CommandServer + (*AuxiliaryCommandServer)(nil), // 42: mpi.v1.AuxiliaryCommandServer + (*MetricsServer)(nil), // 43: mpi.v1.MetricsServer + (*FileServer)(nil), // 44: mpi.v1.FileServer + (*MessageMeta)(nil), // 45: mpi.v1.MessageMeta + (*CommandResponse)(nil), // 46: mpi.v1.CommandResponse + (*FileOverview)(nil), // 47: mpi.v1.FileOverview + (*structpb.Struct)(nil), // 48: google.protobuf.Struct + (*ServerSettings)(nil), // 49: mpi.v1.ServerSettings + (*AuthSettings)(nil), // 50: mpi.v1.AuthSettings + (*TLSSettings)(nil), // 51: mpi.v1.TLSSettings } var file_mpi_v1_command_proto_depIdxs = []int32{ - 42, // 0: mpi.v1.CreateConnectionRequest.message_meta:type_name -> mpi.v1.MessageMeta - 3, // 1: mpi.v1.CreateConnectionRequest.resource:type_name -> mpi.v1.Resource - 27, // 2: mpi.v1.Resource.instances:type_name -> mpi.v1.Instance - 4, // 3: mpi.v1.Resource.host_info:type_name -> mpi.v1.HostInfo - 6, // 4: mpi.v1.Resource.container_info:type_name -> mpi.v1.ContainerInfo - 5, // 5: mpi.v1.HostInfo.release_info:type_name -> mpi.v1.ReleaseInfo - 5, // 6: mpi.v1.ContainerInfo.release_info:type_name -> mpi.v1.ReleaseInfo - 43, // 7: mpi.v1.CreateConnectionResponse.response:type_name -> mpi.v1.CommandResponse - 37, // 8: mpi.v1.CreateConnectionResponse.agent_config:type_name -> mpi.v1.AgentConfig - 42, // 9: mpi.v1.UpdateDataPlaneStatusRequest.message_meta:type_name -> mpi.v1.MessageMeta - 3, // 10: mpi.v1.UpdateDataPlaneStatusRequest.resource:type_name -> mpi.v1.Resource - 0, // 11: mpi.v1.InstanceHealth.instance_health_status:type_name -> mpi.v1.InstanceHealth.InstanceHealthStatus - 42, // 12: mpi.v1.UpdateDataPlaneHealthRequest.message_meta:type_name -> mpi.v1.MessageMeta - 10, // 13: mpi.v1.UpdateDataPlaneHealthRequest.instance_healths:type_name -> mpi.v1.InstanceHealth - 42, // 14: mpi.v1.DataPlaneResponse.message_meta:type_name -> mpi.v1.MessageMeta - 43, // 15: mpi.v1.DataPlaneResponse.command_response:type_name -> mpi.v1.CommandResponse - 42, // 16: mpi.v1.ManagementPlaneRequest.message_meta:type_name -> mpi.v1.MessageMeta - 15, // 17: mpi.v1.ManagementPlaneRequest.status_request:type_name -> mpi.v1.StatusRequest - 16, // 18: mpi.v1.ManagementPlaneRequest.health_request:type_name -> mpi.v1.HealthRequest - 17, // 19: mpi.v1.ManagementPlaneRequest.config_apply_request:type_name -> mpi.v1.ConfigApplyRequest - 18, // 20: mpi.v1.ManagementPlaneRequest.config_upload_request:type_name -> mpi.v1.ConfigUploadRequest - 19, // 21: mpi.v1.ManagementPlaneRequest.action_request:type_name -> mpi.v1.APIActionRequest - 26, // 22: mpi.v1.ManagementPlaneRequest.command_status_request:type_name -> mpi.v1.CommandStatusRequest - 44, // 23: mpi.v1.ConfigApplyRequest.overview:type_name -> mpi.v1.FileOverview - 44, // 24: mpi.v1.ConfigUploadRequest.overview:type_name -> mpi.v1.FileOverview - 20, // 25: mpi.v1.APIActionRequest.nginx_plus_action:type_name -> mpi.v1.NGINXPlusAction - 21, // 26: mpi.v1.NGINXPlusAction.update_http_upstream_servers:type_name -> mpi.v1.UpdateHTTPUpstreamServers - 22, // 27: mpi.v1.NGINXPlusAction.get_http_upstream_servers:type_name -> mpi.v1.GetHTTPUpstreamServers - 23, // 28: mpi.v1.NGINXPlusAction.update_stream_servers:type_name -> mpi.v1.UpdateStreamServers - 24, // 29: mpi.v1.NGINXPlusAction.get_upstreams:type_name -> mpi.v1.GetUpstreams - 25, // 30: mpi.v1.NGINXPlusAction.get_stream_upstreams:type_name -> mpi.v1.GetStreamUpstreams - 45, // 31: mpi.v1.UpdateHTTPUpstreamServers.servers:type_name -> google.protobuf.Struct - 45, // 32: mpi.v1.UpdateStreamServers.servers:type_name -> google.protobuf.Struct - 28, // 33: mpi.v1.Instance.instance_meta:type_name -> mpi.v1.InstanceMeta - 29, // 34: mpi.v1.Instance.instance_config:type_name -> mpi.v1.InstanceConfig - 30, // 35: mpi.v1.Instance.instance_runtime:type_name -> mpi.v1.InstanceRuntime - 1, // 36: mpi.v1.InstanceMeta.instance_type:type_name -> mpi.v1.InstanceMeta.InstanceType - 36, // 37: mpi.v1.InstanceConfig.actions:type_name -> mpi.v1.InstanceAction - 37, // 38: mpi.v1.InstanceConfig.agent_config:type_name -> mpi.v1.AgentConfig - 32, // 39: mpi.v1.InstanceRuntime.nginx_runtime_info:type_name -> mpi.v1.NGINXRuntimeInfo - 33, // 40: mpi.v1.InstanceRuntime.nginx_plus_runtime_info:type_name -> mpi.v1.NGINXPlusRuntimeInfo - 35, // 41: mpi.v1.InstanceRuntime.nginx_app_protect_runtime_info:type_name -> mpi.v1.NGINXAppProtectRuntimeInfo - 31, // 42: mpi.v1.InstanceRuntime.instance_children:type_name -> mpi.v1.InstanceChild - 34, // 43: mpi.v1.NGINXRuntimeInfo.stub_status:type_name -> mpi.v1.APIDetails - 34, // 44: mpi.v1.NGINXPlusRuntimeInfo.stub_status:type_name -> mpi.v1.APIDetails - 34, // 45: mpi.v1.NGINXPlusRuntimeInfo.plus_api:type_name -> mpi.v1.APIDetails - 38, // 46: mpi.v1.AgentConfig.command:type_name -> mpi.v1.CommandServer - 40, // 47: mpi.v1.AgentConfig.metrics:type_name -> mpi.v1.MetricsServer - 41, // 48: mpi.v1.AgentConfig.file:type_name -> mpi.v1.FileServer - 45, // 49: mpi.v1.AgentConfig.labels:type_name -> google.protobuf.Struct - 39, // 50: mpi.v1.AgentConfig.auxiliary_command:type_name -> mpi.v1.AuxiliaryCommandServer - 46, // 51: mpi.v1.CommandServer.server:type_name -> mpi.v1.ServerSettings - 47, // 52: mpi.v1.CommandServer.auth:type_name -> mpi.v1.AuthSettings - 48, // 53: mpi.v1.CommandServer.tls:type_name -> mpi.v1.TLSSettings - 46, // 54: mpi.v1.AuxiliaryCommandServer.server:type_name -> mpi.v1.ServerSettings - 47, // 55: mpi.v1.AuxiliaryCommandServer.auth:type_name -> mpi.v1.AuthSettings - 48, // 56: mpi.v1.AuxiliaryCommandServer.tls:type_name -> mpi.v1.TLSSettings - 2, // 57: mpi.v1.CommandService.CreateConnection:input_type -> mpi.v1.CreateConnectionRequest - 8, // 58: mpi.v1.CommandService.UpdateDataPlaneStatus:input_type -> mpi.v1.UpdateDataPlaneStatusRequest - 11, // 59: mpi.v1.CommandService.UpdateDataPlaneHealth:input_type -> mpi.v1.UpdateDataPlaneHealthRequest - 13, // 60: mpi.v1.CommandService.Subscribe:input_type -> mpi.v1.DataPlaneResponse - 7, // 61: mpi.v1.CommandService.CreateConnection:output_type -> mpi.v1.CreateConnectionResponse - 9, // 62: mpi.v1.CommandService.UpdateDataPlaneStatus:output_type -> mpi.v1.UpdateDataPlaneStatusResponse - 12, // 63: mpi.v1.CommandService.UpdateDataPlaneHealth:output_type -> mpi.v1.UpdateDataPlaneHealthResponse - 14, // 64: mpi.v1.CommandService.Subscribe:output_type -> mpi.v1.ManagementPlaneRequest - 61, // [61:65] is the sub-list for method output_type - 57, // [57:61] is the sub-list for method input_type - 57, // [57:57] is the sub-list for extension type_name - 57, // [57:57] is the sub-list for extension extendee - 0, // [0:57] is the sub-list for field type_name + 45, // 0: mpi.v1.CreateConnectionRequest.message_meta:type_name -> mpi.v1.MessageMeta + 4, // 1: mpi.v1.CreateConnectionRequest.resource:type_name -> mpi.v1.Resource + 29, // 2: mpi.v1.Resource.instances:type_name -> mpi.v1.Instance + 5, // 3: mpi.v1.Resource.host_info:type_name -> mpi.v1.HostInfo + 7, // 4: mpi.v1.Resource.container_info:type_name -> mpi.v1.ContainerInfo + 6, // 5: mpi.v1.HostInfo.release_info:type_name -> mpi.v1.ReleaseInfo + 6, // 6: mpi.v1.ContainerInfo.release_info:type_name -> mpi.v1.ReleaseInfo + 46, // 7: mpi.v1.CreateConnectionResponse.response:type_name -> mpi.v1.CommandResponse + 39, // 8: mpi.v1.CreateConnectionResponse.agent_config:type_name -> mpi.v1.AgentConfig + 45, // 9: mpi.v1.UpdateDataPlaneStatusRequest.message_meta:type_name -> mpi.v1.MessageMeta + 4, // 10: mpi.v1.UpdateDataPlaneStatusRequest.resource:type_name -> mpi.v1.Resource + 45, // 11: mpi.v1.UpdateAgentConfigRequest.message_meta:type_name -> mpi.v1.MessageMeta + 39, // 12: mpi.v1.UpdateAgentConfigRequest.agent_config:type_name -> mpi.v1.AgentConfig + 0, // 13: mpi.v1.InstanceHealth.instance_health_status:type_name -> mpi.v1.InstanceHealth.InstanceHealthStatus + 45, // 14: mpi.v1.UpdateDataPlaneHealthRequest.message_meta:type_name -> mpi.v1.MessageMeta + 12, // 15: mpi.v1.UpdateDataPlaneHealthRequest.instance_healths:type_name -> mpi.v1.InstanceHealth + 45, // 16: mpi.v1.DataPlaneResponse.message_meta:type_name -> mpi.v1.MessageMeta + 46, // 17: mpi.v1.DataPlaneResponse.command_response:type_name -> mpi.v1.CommandResponse + 45, // 18: mpi.v1.ManagementPlaneRequest.message_meta:type_name -> mpi.v1.MessageMeta + 17, // 19: mpi.v1.ManagementPlaneRequest.status_request:type_name -> mpi.v1.StatusRequest + 18, // 20: mpi.v1.ManagementPlaneRequest.health_request:type_name -> mpi.v1.HealthRequest + 19, // 21: mpi.v1.ManagementPlaneRequest.config_apply_request:type_name -> mpi.v1.ConfigApplyRequest + 20, // 22: mpi.v1.ManagementPlaneRequest.config_upload_request:type_name -> mpi.v1.ConfigUploadRequest + 21, // 23: mpi.v1.ManagementPlaneRequest.action_request:type_name -> mpi.v1.APIActionRequest + 28, // 24: mpi.v1.ManagementPlaneRequest.command_status_request:type_name -> mpi.v1.CommandStatusRequest + 11, // 25: mpi.v1.ManagementPlaneRequest.update_agent_config_request:type_name -> mpi.v1.UpdateAgentConfigRequest + 47, // 26: mpi.v1.ConfigApplyRequest.overview:type_name -> mpi.v1.FileOverview + 47, // 27: mpi.v1.ConfigUploadRequest.overview:type_name -> mpi.v1.FileOverview + 22, // 28: mpi.v1.APIActionRequest.nginx_plus_action:type_name -> mpi.v1.NGINXPlusAction + 23, // 29: mpi.v1.NGINXPlusAction.update_http_upstream_servers:type_name -> mpi.v1.UpdateHTTPUpstreamServers + 24, // 30: mpi.v1.NGINXPlusAction.get_http_upstream_servers:type_name -> mpi.v1.GetHTTPUpstreamServers + 25, // 31: mpi.v1.NGINXPlusAction.update_stream_servers:type_name -> mpi.v1.UpdateStreamServers + 26, // 32: mpi.v1.NGINXPlusAction.get_upstreams:type_name -> mpi.v1.GetUpstreams + 27, // 33: mpi.v1.NGINXPlusAction.get_stream_upstreams:type_name -> mpi.v1.GetStreamUpstreams + 48, // 34: mpi.v1.UpdateHTTPUpstreamServers.servers:type_name -> google.protobuf.Struct + 48, // 35: mpi.v1.UpdateStreamServers.servers:type_name -> google.protobuf.Struct + 30, // 36: mpi.v1.Instance.instance_meta:type_name -> mpi.v1.InstanceMeta + 31, // 37: mpi.v1.Instance.instance_config:type_name -> mpi.v1.InstanceConfig + 32, // 38: mpi.v1.Instance.instance_runtime:type_name -> mpi.v1.InstanceRuntime + 1, // 39: mpi.v1.InstanceMeta.instance_type:type_name -> mpi.v1.InstanceMeta.InstanceType + 38, // 40: mpi.v1.InstanceConfig.actions:type_name -> mpi.v1.InstanceAction + 39, // 41: mpi.v1.InstanceConfig.agent_config:type_name -> mpi.v1.AgentConfig + 34, // 42: mpi.v1.InstanceRuntime.nginx_runtime_info:type_name -> mpi.v1.NGINXRuntimeInfo + 35, // 43: mpi.v1.InstanceRuntime.nginx_plus_runtime_info:type_name -> mpi.v1.NGINXPlusRuntimeInfo + 37, // 44: mpi.v1.InstanceRuntime.nginx_app_protect_runtime_info:type_name -> mpi.v1.NGINXAppProtectRuntimeInfo + 33, // 45: mpi.v1.InstanceRuntime.instance_children:type_name -> mpi.v1.InstanceChild + 36, // 46: mpi.v1.NGINXRuntimeInfo.stub_status:type_name -> mpi.v1.APIDetails + 36, // 47: mpi.v1.NGINXPlusRuntimeInfo.stub_status:type_name -> mpi.v1.APIDetails + 36, // 48: mpi.v1.NGINXPlusRuntimeInfo.plus_api:type_name -> mpi.v1.APIDetails + 41, // 49: mpi.v1.AgentConfig.command:type_name -> mpi.v1.CommandServer + 43, // 50: mpi.v1.AgentConfig.metrics:type_name -> mpi.v1.MetricsServer + 44, // 51: mpi.v1.AgentConfig.file:type_name -> mpi.v1.FileServer + 48, // 52: mpi.v1.AgentConfig.labels:type_name -> google.protobuf.Struct + 42, // 53: mpi.v1.AgentConfig.auxiliary_command:type_name -> mpi.v1.AuxiliaryCommandServer + 40, // 54: mpi.v1.AgentConfig.log:type_name -> mpi.v1.Log + 2, // 55: mpi.v1.Log.log_level:type_name -> mpi.v1.Log.LogLevel + 49, // 56: mpi.v1.CommandServer.server:type_name -> mpi.v1.ServerSettings + 50, // 57: mpi.v1.CommandServer.auth:type_name -> mpi.v1.AuthSettings + 51, // 58: mpi.v1.CommandServer.tls:type_name -> mpi.v1.TLSSettings + 49, // 59: mpi.v1.AuxiliaryCommandServer.server:type_name -> mpi.v1.ServerSettings + 50, // 60: mpi.v1.AuxiliaryCommandServer.auth:type_name -> mpi.v1.AuthSettings + 51, // 61: mpi.v1.AuxiliaryCommandServer.tls:type_name -> mpi.v1.TLSSettings + 3, // 62: mpi.v1.CommandService.CreateConnection:input_type -> mpi.v1.CreateConnectionRequest + 9, // 63: mpi.v1.CommandService.UpdateDataPlaneStatus:input_type -> mpi.v1.UpdateDataPlaneStatusRequest + 13, // 64: mpi.v1.CommandService.UpdateDataPlaneHealth:input_type -> mpi.v1.UpdateDataPlaneHealthRequest + 15, // 65: mpi.v1.CommandService.Subscribe:input_type -> mpi.v1.DataPlaneResponse + 8, // 66: mpi.v1.CommandService.CreateConnection:output_type -> mpi.v1.CreateConnectionResponse + 10, // 67: mpi.v1.CommandService.UpdateDataPlaneStatus:output_type -> mpi.v1.UpdateDataPlaneStatusResponse + 14, // 68: mpi.v1.CommandService.UpdateDataPlaneHealth:output_type -> mpi.v1.UpdateDataPlaneHealthResponse + 16, // 69: mpi.v1.CommandService.Subscribe:output_type -> mpi.v1.ManagementPlaneRequest + 66, // [66:70] is the sub-list for method output_type + 62, // [62:66] is the sub-list for method input_type + 62, // [62:62] is the sub-list for extension type_name + 62, // [62:62] is the sub-list for extension extendee + 0, // [0:62] is the sub-list for field type_name } func init() { file_mpi_v1_command_proto_init() } @@ -3067,28 +3277,29 @@ func file_mpi_v1_command_proto_init() { (*Resource_HostInfo)(nil), (*Resource_ContainerInfo)(nil), } - file_mpi_v1_command_proto_msgTypes[12].OneofWrappers = []any{ + file_mpi_v1_command_proto_msgTypes[13].OneofWrappers = []any{ (*ManagementPlaneRequest_StatusRequest)(nil), (*ManagementPlaneRequest_HealthRequest)(nil), (*ManagementPlaneRequest_ConfigApplyRequest)(nil), (*ManagementPlaneRequest_ConfigUploadRequest)(nil), (*ManagementPlaneRequest_ActionRequest)(nil), (*ManagementPlaneRequest_CommandStatusRequest)(nil), + (*ManagementPlaneRequest_UpdateAgentConfigRequest)(nil), } - file_mpi_v1_command_proto_msgTypes[17].OneofWrappers = []any{ + file_mpi_v1_command_proto_msgTypes[18].OneofWrappers = []any{ (*APIActionRequest_NginxPlusAction)(nil), } - file_mpi_v1_command_proto_msgTypes[18].OneofWrappers = []any{ + file_mpi_v1_command_proto_msgTypes[19].OneofWrappers = []any{ (*NGINXPlusAction_UpdateHttpUpstreamServers)(nil), (*NGINXPlusAction_GetHttpUpstreamServers)(nil), (*NGINXPlusAction_UpdateStreamServers)(nil), (*NGINXPlusAction_GetUpstreams)(nil), (*NGINXPlusAction_GetStreamUpstreams)(nil), } - file_mpi_v1_command_proto_msgTypes[27].OneofWrappers = []any{ + file_mpi_v1_command_proto_msgTypes[28].OneofWrappers = []any{ (*InstanceConfig_AgentConfig)(nil), } - file_mpi_v1_command_proto_msgTypes[28].OneofWrappers = []any{ + file_mpi_v1_command_proto_msgTypes[29].OneofWrappers = []any{ (*InstanceRuntime_NginxRuntimeInfo)(nil), (*InstanceRuntime_NginxPlusRuntimeInfo)(nil), (*InstanceRuntime_NginxAppProtectRuntimeInfo)(nil), @@ -3098,8 +3309,8 @@ func file_mpi_v1_command_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_mpi_v1_command_proto_rawDesc), len(file_mpi_v1_command_proto_rawDesc)), - NumEnums: 2, - NumMessages: 40, + NumEnums: 3, + NumMessages: 42, NumExtensions: 0, NumServices: 1, }, diff --git a/api/grpc/mpi/v1/command.pb.validate.go b/api/grpc/mpi/v1/command.pb.validate.go index 81f716548..ab7777024 100644 --- a/api/grpc/mpi/v1/command.pb.validate.go +++ b/api/grpc/mpi/v1/command.pb.validate.go @@ -1215,6 +1215,166 @@ var _ interface { ErrorName() string } = UpdateDataPlaneStatusResponseValidationError{} +// Validate checks the field values on UpdateAgentConfigRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *UpdateAgentConfigRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpdateAgentConfigRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// UpdateAgentConfigRequestMultiError, or nil if none found. +func (m *UpdateAgentConfigRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *UpdateAgentConfigRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetMessageMeta()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, UpdateAgentConfigRequestValidationError{ + field: "MessageMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, UpdateAgentConfigRequestValidationError{ + field: "MessageMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetMessageMeta()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return UpdateAgentConfigRequestValidationError{ + field: "MessageMeta", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetAgentConfig()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, UpdateAgentConfigRequestValidationError{ + field: "AgentConfig", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, UpdateAgentConfigRequestValidationError{ + field: "AgentConfig", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetAgentConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return UpdateAgentConfigRequestValidationError{ + field: "AgentConfig", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return UpdateAgentConfigRequestMultiError(errors) + } + + return nil +} + +// UpdateAgentConfigRequestMultiError is an error wrapping multiple validation +// errors returned by UpdateAgentConfigRequest.ValidateAll() if the designated +// constraints aren't met. +type UpdateAgentConfigRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpdateAgentConfigRequestMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m UpdateAgentConfigRequestMultiError) AllErrors() []error { return m } + +// UpdateAgentConfigRequestValidationError is the validation error returned by +// UpdateAgentConfigRequest.Validate if the designated constraints aren't met. +type UpdateAgentConfigRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateAgentConfigRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateAgentConfigRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateAgentConfigRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateAgentConfigRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateAgentConfigRequestValidationError) ErrorName() string { + return "UpdateAgentConfigRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateAgentConfigRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUpdateAgentConfigRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateAgentConfigRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateAgentConfigRequestValidationError{} + // Validate checks the field values on InstanceHealth with the rules defined in // the proto definition for this message. If any rules are violated, the first // error encountered is returned, or nil if there are no violations. @@ -2050,6 +2210,47 @@ func (m *ManagementPlaneRequest) validate(all bool) error { } } + case *ManagementPlaneRequest_UpdateAgentConfigRequest: + if v == nil { + err := ManagementPlaneRequestValidationError{ + field: "Request", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetUpdateAgentConfigRequest()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ManagementPlaneRequestValidationError{ + field: "UpdateAgentConfigRequest", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ManagementPlaneRequestValidationError{ + field: "UpdateAgentConfigRequest", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUpdateAgentConfigRequest()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ManagementPlaneRequestValidationError{ + field: "UpdateAgentConfigRequest", + reason: "embedded message failed validation", + cause: err, + } + } + } + default: _ = v // ensures v is used } @@ -5356,6 +5557,35 @@ func (m *AgentConfig) validate(all bool) error { } } + if all { + switch v := interface{}(m.GetLog()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, AgentConfigValidationError{ + field: "Log", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, AgentConfigValidationError{ + field: "Log", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetLog()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AgentConfigValidationError{ + field: "Log", + reason: "embedded message failed validation", + cause: err, + } + } + } + if len(errors) > 0 { return AgentConfigMultiError(errors) } @@ -5433,6 +5663,108 @@ var _ interface { ErrorName() string } = AgentConfigValidationError{} +// Validate checks the field values on Log with the rules defined in the proto +// definition for this message. If any rules are violated, the first error +// encountered is returned, or nil if there are no violations. +func (m *Log) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Log with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in LogMultiError, or nil if none found. +func (m *Log) ValidateAll() error { + return m.validate(true) +} + +func (m *Log) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for LogLevel + + // no validation rules for LogPath + + if len(errors) > 0 { + return LogMultiError(errors) + } + + return nil +} + +// LogMultiError is an error wrapping multiple validation errors returned by +// Log.ValidateAll() if the designated constraints aren't met. +type LogMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m LogMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m LogMultiError) AllErrors() []error { return m } + +// LogValidationError is the validation error returned by Log.Validate if the +// designated constraints aren't met. +type LogValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e LogValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e LogValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e LogValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e LogValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e LogValidationError) ErrorName() string { return "LogValidationError" } + +// Error satisfies the builtin error interface +func (e LogValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sLog.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = LogValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = LogValidationError{} + // Validate checks the field values on CommandServer with the rules defined in // the proto definition for this message. If any rules are violated, the first // error encountered is returned, or nil if there are no violations. diff --git a/api/grpc/mpi/v1/command.proto b/api/grpc/mpi/v1/command.proto index 84fb6a020..0456757ad 100644 --- a/api/grpc/mpi/v1/command.proto +++ b/api/grpc/mpi/v1/command.proto @@ -113,6 +113,13 @@ message UpdateDataPlaneStatusRequest { // Respond to a UpdateDataPlaneStatusRequest - intentionally empty message UpdateDataPlaneStatusResponse {} +message UpdateAgentConfigRequest { + // Meta-information associated with a message + mpi.v1.MessageMeta message_meta = 1; + // The NGINX Agent configuration to update + AgentConfig agent_config = 2; +} + message InstanceHealth { // Health status enum enum InstanceHealthStatus { @@ -171,6 +178,8 @@ message ManagementPlaneRequest { APIActionRequest action_request = 7; // triggers a DataPlaneResponse with a command_response for a particular correlation_id CommandStatusRequest command_status_request = 8; + // triggers an update to the NGINX Agent configuration + UpdateAgentConfigRequest update_agent_config_request = 9; } } @@ -387,6 +396,24 @@ message AgentConfig { string message_buffer_size = 6; // Auxiliary Command server settings AuxiliaryCommandServer auxiliary_command = 7; + // Log settings + Log log = 8; +} + +// The log settings associated with NGINX Agent +message Log { + LogLevel log_level = 1; + enum LogLevel { + // Info log level + LOG_LEVEL_INFO = 0; + // Error log level + LOG_LEVEL_ERROR = 1; + // Warning log level + LOG_LEVEL_WARN = 2; + // Debug log level + LOG_LEVEL_DEBUG = 3; + } + string log_path = 2; } // The command server settings, associated with messaging from an external source diff --git a/docs/proto/protos.md b/docs/proto/protos.md index 3ae57f5e4..18301abd5 100644 --- a/docs/proto/protos.md +++ b/docs/proto/protos.md @@ -67,6 +67,7 @@ - [InstanceHealth](#mpi-v1-InstanceHealth) - [InstanceMeta](#mpi-v1-InstanceMeta) - [InstanceRuntime](#mpi-v1-InstanceRuntime) + - [Log](#mpi-v1-Log) - [ManagementPlaneRequest](#mpi-v1-ManagementPlaneRequest) - [MetricsServer](#mpi-v1-MetricsServer) - [NGINXAppProtectRuntimeInfo](#mpi-v1-NGINXAppProtectRuntimeInfo) @@ -76,6 +77,7 @@ - [ReleaseInfo](#mpi-v1-ReleaseInfo) - [Resource](#mpi-v1-Resource) - [StatusRequest](#mpi-v1-StatusRequest) + - [UpdateAgentConfigRequest](#mpi-v1-UpdateAgentConfigRequest) - [UpdateDataPlaneHealthRequest](#mpi-v1-UpdateDataPlaneHealthRequest) - [UpdateDataPlaneHealthResponse](#mpi-v1-UpdateDataPlaneHealthResponse) - [UpdateDataPlaneStatusRequest](#mpi-v1-UpdateDataPlaneStatusRequest) @@ -85,6 +87,7 @@ - [InstanceHealth.InstanceHealthStatus](#mpi-v1-InstanceHealth-InstanceHealthStatus) - [InstanceMeta.InstanceType](#mpi-v1-InstanceMeta-InstanceType) + - [Log.LogLevel](#mpi-v1-Log-LogLevel) - [CommandService](#mpi-v1-CommandService) @@ -718,6 +721,7 @@ This contains a series of NGINX Agent configurations | features | [string](#string) | repeated | A list of features that the NGINX Agent has | | message_buffer_size | [string](#string) | | Message buffer size, maximum not acknowledged messages from the subscribe perspective | | auxiliary_command | [AuxiliaryCommandServer](#mpi-v1-AuxiliaryCommandServer) | | Auxiliary Command server settings | +| log | [Log](#mpi-v1-Log) | | Log settings | @@ -1049,6 +1053,22 @@ Meta-information relating to the reported instance + + +### Log +The log settings associated with NGINX Agent + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| log_level | [Log.LogLevel](#mpi-v1-Log-LogLevel) | | | +| log_path | [string](#string) | | | + + + + + + ### ManagementPlaneRequest @@ -1064,6 +1084,7 @@ A Management Plane request for information, triggers an associated rpc on the Da | config_upload_request | [ConfigUploadRequest](#mpi-v1-ConfigUploadRequest) | | triggers a series of rpc UpdateFile(File) for that instances | | action_request | [APIActionRequest](#mpi-v1-APIActionRequest) | | triggers a DataPlaneResponse with a command_response for a particular action | | command_status_request | [CommandStatusRequest](#mpi-v1-CommandStatusRequest) | | triggers a DataPlaneResponse with a command_response for a particular correlation_id | +| update_agent_config_request | [UpdateAgentConfigRequest](#mpi-v1-UpdateAgentConfigRequest) | | triggers an update to the NGINX Agent configuration | @@ -1203,6 +1224,22 @@ Additional information associated with a StatusRequest + + +### UpdateAgentConfigRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| message_meta | [MessageMeta](#mpi-v1-MessageMeta) | | Meta-information associated with a message | +| agent_config | [AgentConfig](#mpi-v1-AgentConfig) | | The NGINX Agent configuration to update | + + + + + + ### UpdateDataPlaneHealthRequest @@ -1318,6 +1355,20 @@ the types of instances possible | INSTANCE_TYPE_NGINX_APP_PROTECT | 5 | NGINX App Protect | + + + +### Log.LogLevel + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| LOG_LEVEL_INFO | 0 | Info log level | +| LOG_LEVEL_ERROR | 1 | Error log level | +| LOG_LEVEL_WARN | 2 | Warning log level | +| LOG_LEVEL_DEBUG | 3 | Debug log level | + + diff --git a/internal/bus/topics.go b/internal/bus/topics.go index 5a778b27a..a4b0e341c 100644 --- a/internal/bus/topics.go +++ b/internal/bus/topics.go @@ -27,4 +27,5 @@ const ( DataPlaneHealthRequestTopic = "data-plane-health-request" DataPlaneHealthResponseTopic = "data-plane-health-response" APIActionRequestTopic = "api-action-request" + AgentConfigUpdateTopic = "agent-config-update" ) diff --git a/internal/collector/otel_collector_plugin.go b/internal/collector/otel_collector_plugin.go index b57696a5f..07a05f4db 100644 --- a/internal/collector/otel_collector_plugin.go +++ b/internal/collector/otel_collector_plugin.go @@ -55,6 +55,7 @@ type ( service types.CollectorInterface config *config.Config mu *sync.Mutex + agentConfigMutex *sync.Mutex cancel context.CancelFunc previousNAPSysLogServer string debugOTelConfigPath string @@ -100,6 +101,7 @@ func NewCollector(conf *config.Config) (*Collector, error) { service: oTelCollector, stopped: true, mu: &sync.Mutex{}, + agentConfigMutex: &sync.Mutex{}, previousNAPSysLogServer: "", debugOTelConfigPath: debugOTelConfigPath, }, nil @@ -192,6 +194,8 @@ func (oc *Collector) Process(ctx context.Context, msg *bus.Message) { oc.handleNginxConfigUpdate(ctx, msg) case bus.ResourceUpdateTopic: oc.handleResourceUpdate(ctx, msg) + case bus.AgentConfigUpdateTopic: + oc.handleAgentConfigUpdate(ctx, msg) default: slog.DebugContext(ctx, "OTel collector plugin unknown topic", "topic", msg.Topic) } @@ -202,6 +206,7 @@ func (oc *Collector) Subscriptions() []string { return []string{ bus.ResourceUpdateTopic, bus.NginxConfigUpdateTopic, + bus.AgentConfigUpdateTopic, } } @@ -329,6 +334,21 @@ func (oc *Collector) handleResourceUpdate(ctx context.Context, msg *bus.Message) } } +func (oc *Collector) handleAgentConfigUpdate(ctx context.Context, msg *bus.Message) { + slog.DebugContext(ctx, "OTel collector plugin received agent config update message") + + oc.agentConfigMutex.Lock() + defer oc.agentConfigMutex.Unlock() + + agentConfig, ok := msg.Data.(*config.Config) + if !ok { + slog.ErrorContext(ctx, "Unable to cast message payload to *config.Config", "payload", msg.Data) + return + } + + oc.config = agentConfig +} + func (oc *Collector) updateResourceProcessor(resourceUpdateContext *v1.Resource) bool { resourceProcessorUpdated := false diff --git a/internal/command/command_plugin.go b/internal/command/command_plugin.go index 616c48eb8..15537b0e5 100644 --- a/internal/command/command_plugin.go +++ b/internal/command/command_plugin.go @@ -37,6 +37,7 @@ type ( Subscribe(ctx context.Context) IsConnected() bool CreateConnection(ctx context.Context, resource *mpi.Resource) (*mpi.CreateConnectionResponse, error) + UpdateAgentConfig(ctx context.Context, request *mpi.AgentConfig) (*config.Config, error) } CommandPlugin struct { @@ -180,6 +181,24 @@ func (cp *CommandPlugin) createConnection(ctx context.Context, resource *mpi.Res Topic: bus.ConnectionCreatedTopic, Data: createConnectionResponse, }) + + if createConnectionResponse.GetAgentConfig() != nil { + newAgentConfig, updateConfigError := cp.commandService.UpdateAgentConfig( + ctx, + createConnectionResponse.GetAgentConfig(), + ) + if updateConfigError != nil { + slog.ErrorContext(ctx, "Unable to update agent configuration", "error", updateConfigError) + } else { + slog.DebugContext( + ctx, "Notifying other plugins of agent configuration update from create connection response", + ) + cp.messagePipe.Process(ctx, &bus.Message{ + Topic: bus.AgentConfigUpdateTopic, + Data: newAgentConfig, + }) + } + } } } @@ -262,7 +281,7 @@ func (cp *CommandPlugin) processConnectionReset(ctx context.Context, msg *bus.Me } } -//nolint:revive // cognitive complexity is 14 +//nolint:revive,cyclop // cognitive complexity is 14 func (cp *CommandPlugin) monitorSubscribeChannel(ctx context.Context) { for { select { @@ -305,6 +324,17 @@ func (cp *CommandPlugin) monitorSubscribeChannel(ctx context.Context) { } slog.InfoContext(ctx, "Received management plane action request") cp.handleAPIActionRequest(newCtx, message) + case *mpi.ManagementPlaneRequest_UpdateAgentConfigRequest: + slog.InfoContext(ctx, "Received management plane update agent config request") + if cp.commandServerType != model.Command { + slog.WarnContext(newCtx, "Auxiliary command server can not perform agent config update", + "command_server_type", cp.commandServerType.String()) + cp.handleInvalidRequest(newCtx, message, "Updating agent config failed", "") + + return + } + + cp.handleAgentConfigUpdateRequest(newCtx, message) default: slog.DebugContext(newCtx, "Management plane request not implemented yet") } @@ -408,6 +438,50 @@ func (cp *CommandPlugin) handleInvalidRequest(ctx context.Context, } } +func (cp *CommandPlugin) handleAgentConfigUpdateRequest(ctx context.Context, request *mpi.ManagementPlaneRequest) { + newAgentConfig, err := cp.commandService.UpdateAgentConfig( + ctx, + request.GetUpdateAgentConfigRequest().GetAgentConfig(), + ) + if err != nil { + slog.ErrorContext(ctx, "Unable to update agent configuration", "error", err) + + responseError := cp.commandService.SendDataPlaneResponse(ctx, &mpi.DataPlaneResponse{ + MessageMeta: &mpi.MessageMeta{ + MessageId: id.GenerateMessageID(), + CorrelationId: request.GetMessageMeta().GetCorrelationId(), + Timestamp: timestamppb.Now(), + }, + CommandResponse: &mpi.CommandResponse{ + Status: mpi.CommandResponse_COMMAND_STATUS_FAILURE, + Message: "Failed to update agent configuration", + }, + }) + + if responseError != nil { + slog.ErrorContext(ctx, "Unable to send data plane response", "error", responseError) + } + } else { + cp.messagePipe.Process(ctx, &bus.Message{Topic: bus.AgentConfigUpdateTopic, Data: newAgentConfig}) + + responseError := cp.commandService.SendDataPlaneResponse(ctx, &mpi.DataPlaneResponse{ + MessageMeta: &mpi.MessageMeta{ + MessageId: id.GenerateMessageID(), + CorrelationId: request.GetMessageMeta().GetCorrelationId(), + Timestamp: timestamppb.Now(), + }, + CommandResponse: &mpi.CommandResponse{ + Status: mpi.CommandResponse_COMMAND_STATUS_OK, + Message: "Successfully updated agent configuration", + }, + }) + + if responseError != nil { + slog.ErrorContext(ctx, "Unable to send data plane response", "error", responseError) + } + } +} + func (cp *CommandPlugin) createDataPlaneResponse(correlationID string, status mpi.CommandResponse_CommandStatus, message, err string, ) *mpi.DataPlaneResponse { diff --git a/internal/command/command_plugin_test.go b/internal/command/command_plugin_test.go index c51f3c579..885b4e979 100644 --- a/internal/command/command_plugin_test.go +++ b/internal/command/command_plugin_test.go @@ -8,6 +8,7 @@ package command import ( "bytes" "context" + "log/slog" "testing" "time" @@ -77,8 +78,20 @@ func TestCommandPlugin_Init(t *testing.T) { func TestCommandPlugin_createConnection(t *testing.T) { ctx := context.Background() + response := &mpi.CreateConnectionResponse{ + Response: &mpi.CommandResponse{ + Status: mpi.CommandResponse_COMMAND_STATUS_OK, + Message: "Connection created successfully", + }, + AgentConfig: &mpi.AgentConfig{ + Log: &mpi.Log{ + LogLevel: mpi.Log_LOG_LEVEL_DEBUG, + }, + }, + } + commandService := &commandfakes.FakeCommandService{} - commandService.CreateConnectionReturns(&mpi.CreateConnectionResponse{}, nil) + commandService.CreateConnectionReturns(response, nil) messagePipe := busfakes.NewFakeMessagePipe() commandPlugin := NewCommandPlugin(types.AgentConfig(), &grpcfakes.FakeGrpcConnectionInterface{}, model.Command) @@ -98,14 +111,15 @@ func TestCommandPlugin_createConnection(t *testing.T) { assert.Eventually( t, - func() bool { return len(messagePipe.Messages()) == 1 }, + func() bool { return len(messagePipe.Messages()) == 2 }, 2*time.Second, 10*time.Millisecond, ) messages := messagePipe.Messages() - assert.Len(t, messages, 1) + assert.Len(t, messages, 2) assert.Equal(t, bus.ConnectionCreatedTopic, messages[0].Topic) + assert.Equal(t, bus.AgentConfigUpdateTopic, messages[1].Topic) } func TestCommandPlugin_Process(t *testing.T) { @@ -154,6 +168,10 @@ func TestCommandPlugin_Process(t *testing.T) { } func TestCommandPlugin_monitorSubscribeChannel(t *testing.T) { + defer func() { + slog.SetDefault(slog.Default()) + }() + tests := []struct { managementPlaneRequest *mpi.ManagementPlaneRequest expectedTopic *bus.Message @@ -211,6 +229,24 @@ func TestCommandPlugin_monitorSubscribeChannel(t *testing.T) { pkg.FeatureAPIAction, }, }, + + { + name: "Test 5: Update Agent Config Request", + managementPlaneRequest: &mpi.ManagementPlaneRequest{ + Request: &mpi.ManagementPlaneRequest_UpdateAgentConfigRequest{ + UpdateAgentConfigRequest: &mpi.UpdateAgentConfigRequest{ + AgentConfig: &mpi.AgentConfig{ + Log: &mpi.Log{ + LogLevel: mpi.Log_LOG_LEVEL_DEBUG, + }, + }, + }, + }, + }, + expectedTopic: &bus.Message{Topic: bus.AgentConfigUpdateTopic}, + request: "UpdateAgentConfigRequest", + configFeatures: config.DefaultFeatures(), + }, } for _, test := range tests { @@ -241,18 +277,24 @@ func TestCommandPlugin_monitorSubscribeChannel(t *testing.T) { assert.Len(tt, messages, 1) assert.Equal(tt, test.expectedTopic.Topic, messages[0].Topic) - mp, ok := messages[0].Data.(*mpi.ManagementPlaneRequest) - - switch test.request { - case "UploadRequest": - assert.True(tt, ok) - require.NotNil(tt, mp.GetConfigUploadRequest()) - case "ApplyRequest": - assert.True(tt, ok) - require.NotNil(tt, mp.GetConfigApplyRequest()) - case "APIActionRequest": + if test.request == "UpdateAgentConfigRequest" { + data, ok := messages[0].Data.(*config.Config) assert.True(tt, ok) - require.NotNil(tt, mp.GetActionRequest()) + require.NotNil(tt, data) + } else { + mp, ok := messages[0].Data.(*mpi.ManagementPlaneRequest) + + switch test.request { + case "UploadRequest": + assert.True(tt, ok) + require.NotNil(tt, mp.GetConfigUploadRequest()) + case "ApplyRequest": + assert.True(tt, ok) + require.NotNil(tt, mp.GetConfigApplyRequest()) + case "APIActionRequest": + assert.True(tt, ok) + require.NotNil(tt, mp.GetActionRequest()) + } } }) } diff --git a/internal/command/command_service.go b/internal/command/command_service.go index a242b92a2..a2e61a435 100644 --- a/internal/command/command_service.go +++ b/internal/command/command_service.go @@ -10,6 +10,7 @@ import ( "errors" "fmt" "log/slog" + "reflect" "sync" "sync/atomic" @@ -182,6 +183,29 @@ func (cs *CommandService) SendDataPlaneResponse(ctx context.Context, response *m ) } +func (cs *CommandService) UpdateAgentConfig( + ctx context.Context, + mpiConfig *mpi.AgentConfig, +) (*config.Config, error) { + slog.InfoContext(ctx, "Updating agent configuration", "config", mpiConfig) + + updatedLog := config.FromAgentConfigLogProto(mpiConfig.GetLog()) + + if mpiConfig.GetLog() != nil && !reflect.DeepEqual(cs.agentConfig.Log, updatedLog) { + slog.InfoContext(ctx, "Updating log configuration", "log", updatedLog) + cs.agentConfig.Log = updatedLog + + slogger := logger.New( + cs.agentConfig.Log.Path, + cs.agentConfig.Log.Level, + ) + slog.SetDefault(slogger) + } + + return cs.agentConfig, nil +} + +// Subscribe to the Management Plane for incoming commands. func (cs *CommandService) Subscribe(ctx context.Context) { commonSettings := &config.BackOff{ InitialInterval: cs.agentConfig.Client.Backoff.InitialInterval, diff --git a/internal/command/command_service_test.go b/internal/command/command_service_test.go index d91e9fe0f..a554ac428 100644 --- a/internal/command/command_service_test.go +++ b/internal/command/command_service_test.go @@ -377,6 +377,41 @@ func TestCommandService_SendDataPlaneResponse_configApplyRequest(t *testing.T) { wg.Wait() } +func TestCommandService_UpdateAgentConfiguration(t *testing.T) { + ctx := context.Background() + commandServiceClient := &v1fakes.FakeCommandServiceClient{} + + initialConfig := types.AgentConfig() + initialConfig.Log.Level = "INFO" + initialConfig.Log.Path = "" + + commandService := NewCommandService( + commandServiceClient, + initialConfig, + make(chan *mpi.ManagementPlaneRequest), + ) + commandService.isConnected.Store(true) + + originalLogger := slog.Default() + + updatedConfig := &mpi.AgentConfig{ + Log: &mpi.Log{ + LogLevel: mpi.Log_LOG_LEVEL_DEBUG, + LogPath: "/etc/nginx-agent", + }, + } + + newAgentConfig, err := commandService.UpdateAgentConfig(ctx, updatedConfig) + require.NoError(t, err) + require.Equal(t, "DEBUG", commandService.agentConfig.Log.Level) + require.Equal(t, "/etc/nginx-agent", commandService.agentConfig.Log.Path) + require.Equal(t, "DEBUG", newAgentConfig.Log.Level) + require.Equal(t, "/etc/nginx-agent", newAgentConfig.Log.Path) + + updatedLogger := slog.Default() + require.NotEqual(t, originalLogger, updatedLogger) +} + func TestCommandService_isValidRequest(t *testing.T) { ctx := context.Background() commandServiceClient := &v1fakes.FakeCommandServiceClient{} diff --git a/internal/command/commandfakes/fake_command_service.go b/internal/command/commandfakes/fake_command_service.go index 5d8fda386..21c52824a 100644 --- a/internal/command/commandfakes/fake_command_service.go +++ b/internal/command/commandfakes/fake_command_service.go @@ -6,6 +6,7 @@ import ( "sync" v1 "github.com/nginx/agent/v3/api/grpc/mpi/v1" + "github.com/nginx/agent/v3/internal/config" ) type FakeCommandService struct { @@ -50,6 +51,20 @@ type FakeCommandService struct { subscribeArgsForCall []struct { arg1 context.Context } + UpdateAgentConfigStub func(context.Context, *v1.AgentConfig) (*config.Config, error) + updateAgentConfigMutex sync.RWMutex + updateAgentConfigArgsForCall []struct { + arg1 context.Context + arg2 *v1.AgentConfig + } + updateAgentConfigReturns struct { + result1 *config.Config + result2 error + } + updateAgentConfigReturnsOnCall map[int]struct { + result1 *config.Config + result2 error + } UpdateClientStub func(context.Context, v1.CommandServiceClient) error updateClientMutex sync.RWMutex updateClientArgsForCall []struct { @@ -302,6 +317,71 @@ func (fake *FakeCommandService) SubscribeArgsForCall(i int) context.Context { return argsForCall.arg1 } +func (fake *FakeCommandService) UpdateAgentConfig(arg1 context.Context, arg2 *v1.AgentConfig) (*config.Config, error) { + fake.updateAgentConfigMutex.Lock() + ret, specificReturn := fake.updateAgentConfigReturnsOnCall[len(fake.updateAgentConfigArgsForCall)] + fake.updateAgentConfigArgsForCall = append(fake.updateAgentConfigArgsForCall, struct { + arg1 context.Context + arg2 *v1.AgentConfig + }{arg1, arg2}) + stub := fake.UpdateAgentConfigStub + fakeReturns := fake.updateAgentConfigReturns + fake.recordInvocation("UpdateAgentConfig", []interface{}{arg1, arg2}) + fake.updateAgentConfigMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeCommandService) UpdateAgentConfigCallCount() int { + fake.updateAgentConfigMutex.RLock() + defer fake.updateAgentConfigMutex.RUnlock() + return len(fake.updateAgentConfigArgsForCall) +} + +func (fake *FakeCommandService) UpdateAgentConfigCalls(stub func(context.Context, *v1.AgentConfig) (*config.Config, error)) { + fake.updateAgentConfigMutex.Lock() + defer fake.updateAgentConfigMutex.Unlock() + fake.UpdateAgentConfigStub = stub +} + +func (fake *FakeCommandService) UpdateAgentConfigArgsForCall(i int) (context.Context, *v1.AgentConfig) { + fake.updateAgentConfigMutex.RLock() + defer fake.updateAgentConfigMutex.RUnlock() + argsForCall := fake.updateAgentConfigArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeCommandService) UpdateAgentConfigReturns(result1 *config.Config, result2 error) { + fake.updateAgentConfigMutex.Lock() + defer fake.updateAgentConfigMutex.Unlock() + fake.UpdateAgentConfigStub = nil + fake.updateAgentConfigReturns = struct { + result1 *config.Config + result2 error + }{result1, result2} +} + +func (fake *FakeCommandService) UpdateAgentConfigReturnsOnCall(i int, result1 *config.Config, result2 error) { + fake.updateAgentConfigMutex.Lock() + defer fake.updateAgentConfigMutex.Unlock() + fake.UpdateAgentConfigStub = nil + if fake.updateAgentConfigReturnsOnCall == nil { + fake.updateAgentConfigReturnsOnCall = make(map[int]struct { + result1 *config.Config + result2 error + }) + } + fake.updateAgentConfigReturnsOnCall[i] = struct { + result1 *config.Config + result2 error + }{result1, result2} +} + func (fake *FakeCommandService) UpdateClient(arg1 context.Context, arg2 v1.CommandServiceClient) error { fake.updateClientMutex.Lock() ret, specificReturn := fake.updateClientReturnsOnCall[len(fake.updateClientArgsForCall)] @@ -504,6 +584,8 @@ func (fake *FakeCommandService) Invocations() map[string][][]interface{} { defer fake.sendDataPlaneResponseMutex.RUnlock() fake.subscribeMutex.RLock() defer fake.subscribeMutex.RUnlock() + fake.updateAgentConfigMutex.RLock() + defer fake.updateAgentConfigMutex.RUnlock() fake.updateClientMutex.RLock() defer fake.updateClientMutex.RUnlock() fake.updateDataPlaneHealthMutex.RLock() diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 1c15f8b98..fb04aceb9 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -1014,7 +1014,9 @@ func agentConfig() *Config { UUID: "", Version: "", Path: "", - Log: &Log{}, + Log: &Log{ + Level: "info", + }, Client: &Client{ HTTP: &HTTP{ Timeout: 10 * time.Second, diff --git a/internal/config/mapper.go b/internal/config/mapper.go index c51b1a810..641744be1 100644 --- a/internal/config/mapper.go +++ b/internal/config/mapper.go @@ -7,6 +7,7 @@ package config import ( "log/slog" + "strings" mpi "github.com/nginx/agent/v3/api/grpc/mpi/v1" ) @@ -122,3 +123,46 @@ func ToAuxiliaryCommandServerProto(cmd *Command) *mpi.AuxiliaryCommandServer { return protoConfig } + +func FromAgentConfigLogProto(log *mpi.Log) *Log { + return &Log{ + Level: MapConfigLogLevelToSlogLevel(log.GetLogLevel()), + Path: log.GetLogPath(), + } +} + +func ToAgentConfigLogProto(log *Log) *mpi.Log { + return &mpi.Log{ + LogLevel: MapSlogLevelToConfigLogLevel(log.Level), + LogPath: log.Path, + } +} + +func MapConfigLogLevelToSlogLevel(level mpi.Log_LogLevel) string { + slogLevel := "INFO" + + switch level { + case mpi.Log_LOG_LEVEL_DEBUG: + slogLevel = "DEBUG" + case mpi.Log_LOG_LEVEL_WARN: + slogLevel = "WARN" + case mpi.Log_LOG_LEVEL_ERROR: + slogLevel = "ERROR" + case mpi.Log_LOG_LEVEL_INFO: + } + + return slogLevel +} + +func MapSlogLevelToConfigLogLevel(level string) mpi.Log_LogLevel { + switch strings.ToUpper(level) { + case "DEBUG": + return mpi.Log_LOG_LEVEL_DEBUG + case "WARN": + return mpi.Log_LOG_LEVEL_WARN + case "ERROR": + return mpi.Log_LOG_LEVEL_ERROR + default: + return mpi.Log_LOG_LEVEL_INFO + } +} diff --git a/internal/config/mapper_test.go b/internal/config/mapper_test.go index 6217ed3dd..263608489 100644 --- a/internal/config/mapper_test.go +++ b/internal/config/mapper_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestFromCommandProto(t *testing.T) { +func TestMapper_FromCommandProto(t *testing.T) { tests := []struct { protoConfig *mpi.CommandServer expected *Command @@ -115,7 +115,7 @@ func TestFromCommandProto(t *testing.T) { } } -func TestToCommandProto(t *testing.T) { +func TestMapper_ToCommandProto(t *testing.T) { tests := []struct { cmd *Command expected *mpi.CommandServer @@ -219,3 +219,93 @@ func TestToCommandProto(t *testing.T) { }) } } + +func TestMapper_ToAgentConfigLogProto(t *testing.T) { + tests := []struct { + log *Log + expected *mpi.Log + name string + }{ + { + name: "Test 1: Log level DEBUG", + log: &Log{ + Level: "DEBUG", + }, + expected: &mpi.Log{ + LogLevel: mpi.Log_LOG_LEVEL_DEBUG, + LogPath: "", + }, + }, + { + name: "Test 2: Log level INFO", + log: &Log{ + Level: "INFO", + }, + expected: &mpi.Log{ + LogLevel: mpi.Log_LOG_LEVEL_INFO, + LogPath: "", + }, + }, + { + name: "Test 3: Log level WARN", + log: &Log{ + Level: "WARN", + }, + expected: &mpi.Log{ + LogLevel: mpi.Log_LOG_LEVEL_WARN, + LogPath: "", + }, + }, + { + name: "Test 4: Log level ERROR", + log: &Log{ + Level: "ERROR", + }, + expected: &mpi.Log{ + LogLevel: mpi.Log_LOG_LEVEL_ERROR, + LogPath: "", + }, + }, + { + name: "Test 5: Log path set", + log: &Log{ + Level: "INFO", + Path: "/path/to/agent.log", + }, + expected: &mpi.Log{ + LogLevel: mpi.Log_LOG_LEVEL_INFO, + LogPath: "/path/to/agent.log", + }, + }, + { + name: "Test 6: Log path empty", + log: &Log{ + Level: "INFO", + Path: "", + }, + expected: &mpi.Log{ + LogLevel: mpi.Log_LOG_LEVEL_INFO, + LogPath: "", + }, + }, + { + name: "Test 7: Both log level and path set", + log: &Log{ + Level: "DEBUG", + Path: "/other/path/to/agent.log", + }, + expected: &mpi.Log{ + LogLevel: mpi.Log_LOG_LEVEL_DEBUG, + LogPath: "/other/path/to/agent.log", + }, + }, + } + + for _, testCase := range tests { + t.Run(testCase.name, func(t *testing.T) { + protoLog := ToAgentConfigLogProto(testCase.log) + assert.Equal(t, testCase.expected.GetLogLevel(), protoLog.GetLogLevel()) + assert.Equal(t, testCase.expected.GetLogPath(), protoLog.GetLogPath()) + }) + } +} diff --git a/internal/file/file_plugin.go b/internal/file/file_plugin.go index a9747b7b3..7a2fa208d 100644 --- a/internal/file/file_plugin.go +++ b/internal/file/file_plugin.go @@ -29,6 +29,7 @@ var _ bus.Plugin = (*FilePlugin)(nil) type FilePlugin struct { manifestLock *sync.RWMutex + agentConfigMutex *sync.Mutex messagePipe bus.MessagePipeInterface config *config.Config conn grpc.GrpcConnectionInterface @@ -40,10 +41,11 @@ func NewFilePlugin(agentConfig *config.Config, grpcConnection grpc.GrpcConnectio serverType model.ServerType, manifestLock *sync.RWMutex, ) *FilePlugin { return &FilePlugin{ - config: agentConfig, - conn: grpcConnection, - serverType: serverType, - manifestLock: manifestLock, + config: agentConfig, + conn: grpcConnection, + serverType: serverType, + manifestLock: manifestLock, + agentConfigMutex: &sync.Mutex{}, } } @@ -81,6 +83,7 @@ func (fp *FilePlugin) Info() *bus.Info { } } +//nolint:revive,cyclop // Cyclomatic complexity is acceptable for this function func (fp *FilePlugin) Process(ctx context.Context, msg *bus.Message) { ctxWithMetadata := fp.config.NewContextWithLabels(ctx) @@ -110,6 +113,8 @@ func (fp *FilePlugin) Process(ctx context.Context, msg *bus.Message) { fp.handleReloadSuccess(ctxWithMetadata, msg) case bus.ConfigApplyFailedTopic: fp.handleConfigApplyFailedRequest(ctxWithMetadata, msg) + case bus.AgentConfigUpdateTopic: + fp.handleAgentConfigUpdate(ctxWithMetadata, msg) default: slog.DebugContext(ctxWithMetadata, "File plugin received unknown topic", "topic", msg.Topic) } @@ -135,6 +140,7 @@ func (fp *FilePlugin) Subscriptions() []string { bus.ConfigApplyFailedTopic, bus.ReloadSuccessfulTopic, bus.ConfigApplyCompleteTopic, + bus.AgentConfigUpdateTopic, } } @@ -410,6 +416,21 @@ func (fp *FilePlugin) handleConfigUploadRequest(ctx context.Context, msg *bus.Me fp.messagePipe.Process(ctx, &bus.Message{Topic: bus.DataPlaneResponseTopic, Data: response}) } +func (fp *FilePlugin) handleAgentConfigUpdate(ctx context.Context, msg *bus.Message) { + slog.DebugContext(ctx, "File plugin received agent config update message") + + fp.agentConfigMutex.Lock() + defer fp.agentConfigMutex.Unlock() + + agentConfig, ok := msg.Data.(*config.Config) + if !ok { + slog.ErrorContext(ctx, "Unable to cast message payload to *config.Config", "payload", msg.Data) + return + } + + fp.config = agentConfig +} + func (fp *FilePlugin) createDataPlaneResponse(correlationID string, status mpi.CommandResponse_CommandStatus, message, instanceID, err string, ) *mpi.DataPlaneResponse { diff --git a/internal/file/file_plugin_test.go b/internal/file/file_plugin_test.go index 2955dacf3..74aa6024a 100644 --- a/internal/file/file_plugin_test.go +++ b/internal/file/file_plugin_test.go @@ -61,6 +61,7 @@ func TestFilePlugin_Subscriptions(t *testing.T) { bus.ConfigApplyFailedTopic, bus.ReloadSuccessfulTopic, bus.ConfigApplyCompleteTopic, + bus.AgentConfigUpdateTopic, }, filePlugin.Subscriptions(), ) diff --git a/internal/resource/resource_plugin.go b/internal/resource/resource_plugin.go index 036e817b7..d1b5fcc7a 100644 --- a/internal/resource/resource_plugin.go +++ b/internal/resource/resource_plugin.go @@ -10,6 +10,7 @@ import ( "errors" "fmt" "log/slog" + "sync" mpi "github.com/nginx/agent/v3/api/grpc/mpi/v1" "github.com/nginx/agent/v3/internal/config" @@ -25,9 +26,10 @@ import ( // This is done in the resource plugin to make the file plugin usable for every type of instance. type Resource struct { - messagePipe bus.MessagePipeInterface - resourceService resourceServiceInterface - agentConfig *config.Config + messagePipe bus.MessagePipeInterface + resourceService resourceServiceInterface + agentConfig *config.Config + agentConfigMutex *sync.Mutex } type errResponse struct { @@ -46,7 +48,8 @@ var _ bus.Plugin = (*Resource)(nil) func NewResource(agentConfig *config.Config) *Resource { return &Resource{ - agentConfig: agentConfig, + agentConfig: agentConfig, + agentConfigMutex: &sync.Mutex{}, } } @@ -121,6 +124,8 @@ func (r *Resource) Process(ctx context.Context, msg *bus.Message) { r.handleRollbackWrite(ctx, msg) case bus.APIActionRequestTopic: r.handleAPIActionRequest(ctx, msg) + case bus.AgentConfigUpdateTopic: + r.handleAgentConfigUpdate(ctx, msg) default: slog.DebugContext(ctx, "Unknown topic", "topic", msg.Topic) } @@ -134,6 +139,7 @@ func (*Resource) Subscriptions() []string { bus.WriteConfigSuccessfulTopic, bus.RollbackWriteTopic, bus.APIActionRequestTopic, + bus.AgentConfigUpdateTopic, } } @@ -281,3 +287,18 @@ func (r *Resource) handleRollbackWrite(ctx context.Context, msg *bus.Message) { r.messagePipe.Process(ctx, &bus.Message{Topic: bus.ConfigApplyCompleteTopic, Data: applyResponse}) } + +func (r *Resource) handleAgentConfigUpdate(ctx context.Context, msg *bus.Message) { + slog.DebugContext(ctx, "Resource plugin received agent config update message") + + r.agentConfigMutex.Lock() + defer r.agentConfigMutex.Unlock() + + agentConfig, ok := msg.Data.(*config.Config) + if !ok { + slog.ErrorContext(ctx, "Unable to cast message payload to *config.Config", "payload", msg.Data) + return + } + + r.agentConfig = agentConfig +} diff --git a/internal/resource/resource_plugin_test.go b/internal/resource/resource_plugin_test.go index 0a7165b17..df45879f4 100644 --- a/internal/resource/resource_plugin_test.go +++ b/internal/resource/resource_plugin_test.go @@ -845,6 +845,7 @@ func TestResource_Subscriptions(t *testing.T) { bus.WriteConfigSuccessfulTopic, bus.RollbackWriteTopic, bus.APIActionRequestTopic, + bus.AgentConfigUpdateTopic, }, resourcePlugin.Subscriptions()) } diff --git a/internal/watcher/instance/instance_watcher_service.go b/internal/watcher/instance/instance_watcher_service.go index a132e6b9e..4d00ce70b 100644 --- a/internal/watcher/instance/instance_watcher_service.go +++ b/internal/watcher/instance/instance_watcher_service.go @@ -325,6 +325,7 @@ func (iw *InstanceWatcherService) agentInstance(ctx context.Context) *mpi.Instan Labels: labels, Features: iw.agentConfig.Features, MessageBufferSize: "", + Log: config.ToAgentConfigLogProto(iw.agentConfig.Log), }, }, }, diff --git a/internal/watcher/watcher_plugin.go b/internal/watcher/watcher_plugin.go index 834c7283f..c6af0dc00 100644 --- a/internal/watcher/watcher_plugin.go +++ b/internal/watcher/watcher_plugin.go @@ -49,6 +49,7 @@ type ( cancel context.CancelFunc instancesWithConfigApplyInProgress []string watcherMutex sync.Mutex + agentConfigMutex sync.Mutex } instanceWatcherServiceInterface interface { @@ -89,6 +90,7 @@ func NewWatcher(agentConfig *config.Config) *Watcher { auxiliaryCredentialUpdatesChannel: make(chan credentials.CredentialUpdateMessage), instancesWithConfigApplyInProgress: []string{}, watcherMutex: sync.Mutex{}, + agentConfigMutex: sync.Mutex{}, } } @@ -144,6 +146,8 @@ func (w *Watcher) Process(ctx context.Context, msg *bus.Message) { w.handleHealthRequest(ctx) case bus.EnableWatchersTopic: w.handleEnableWatchers(ctx, msg) + case bus.AgentConfigUpdateTopic: + w.handleAgentConfigUpdate(ctx, msg) default: slog.DebugContext(ctx, "Watcher plugin unknown topic", "topic", msg.Topic) } @@ -154,6 +158,7 @@ func (*Watcher) Subscriptions() []string { bus.ConfigApplyRequestTopic, bus.DataPlaneHealthRequestTopic, bus.EnableWatchersTopic, + bus.AgentConfigUpdateTopic, } } @@ -314,3 +319,18 @@ func (w *Watcher) handleInstanceUpdates(newCtx context.Context, message instance ) } } + +func (w *Watcher) handleAgentConfigUpdate(ctx context.Context, msg *bus.Message) { + slog.DebugContext(ctx, "Watcher plugin received agent config update message") + + w.agentConfigMutex.Lock() + defer w.agentConfigMutex.Unlock() + + agentConfig, ok := msg.Data.(*config.Config) + if !ok { + slog.ErrorContext(ctx, "Unable to cast message payload to *config.Config", "payload", msg.Data) + return + } + + w.agentConfig = agentConfig +} diff --git a/internal/watcher/watcher_plugin_test.go b/internal/watcher/watcher_plugin_test.go index 9331d320c..424009c60 100644 --- a/internal/watcher/watcher_plugin_test.go +++ b/internal/watcher/watcher_plugin_test.go @@ -248,6 +248,7 @@ func TestWatcher_Subscriptions(t *testing.T) { bus.ConfigApplyRequestTopic, bus.DataPlaneHealthRequestTopic, bus.EnableWatchersTopic, + bus.AgentConfigUpdateTopic, }, watcherPlugin.Subscriptions(), ) diff --git a/test/integration/managementplane/grpc_management_plane_api_test.go b/test/integration/managementplane/grpc_management_plane_api_test.go index 1d77485bc..b3845b461 100644 --- a/test/integration/managementplane/grpc_management_plane_api_test.go +++ b/test/integration/managementplane/grpc_management_plane_api_test.go @@ -74,3 +74,37 @@ func (s *MPITestSuite) TestGrpc_Test3_DataplaneHealthRequest() { s.Equal("Successfully sent health status update", responses[0].GetCommandResponse().GetMessage()) slog.Info("finished grpc dataplane health request test") } + +func (s *MPITestSuite) TestGrpc_Test4_UpdateNginxAgentConfigurationRequest() { + slog.Info("starting grpc update nginx agent configuration request test") + request := `{ + "message_meta": { + "message_id": "6c0fa83e-351c-4009-90cd-1f2acce2d184", + "correlation_id": "11114c1c-8e91-47c1-a92c-b9a0c3f1a263", + "timestamp": "2025-01-15T01:30:15.01Z" + }, + "update_agent_config_request": { + "agent_config": { + "log": { + "log_level": 1 + } + } + } + }` + + client := resty.New() + client.SetRetryCount(utils.RetryCount).SetRetryWaitTime(utils.RetryWaitTime).SetRetryMaxWaitTime( + utils.RetryMaxWaitTime) + + url := fmt.Sprintf("http://%s/api/v1/requests", utils.MockManagementPlaneAPIAddress) + resp, err := client.R().EnableTrace().SetBody(request).Post(url) + + s.Require().NoError(err) + s.Equal(http.StatusOK, resp.StatusCode()) + + responses := utils.ManagementPlaneResponses(s.T(), 1, utils.MockManagementPlaneAPIAddress) + + s.Equal(mpi.CommandResponse_COMMAND_STATUS_OK, responses[0].GetCommandResponse().GetStatus()) + s.Equal("Successfully updated agent configuration", responses[0].GetCommandResponse().GetMessage()) + slog.Info("finished grpc update nginx agent configuration request test") +} diff --git a/test/protos/management_plane_request.go b/test/protos/management_plane_request.go index d128f1010..ce32e113a 100644 --- a/test/protos/management_plane_request.go +++ b/test/protos/management_plane_request.go @@ -123,3 +123,14 @@ func CreateAPIActionRequestNginxPlusUpdateStreamServers(upstream, instanceID str }, } } + +func CreateAgentConfigurationUpdateRequest(config *mpi.AgentConfig) *mpi.ManagementPlaneRequest { + return &mpi.ManagementPlaneRequest{ + MessageMeta: CreateMessageMeta(), + Request: &mpi.ManagementPlaneRequest_UpdateAgentConfigRequest{ + UpdateAgentConfigRequest: &mpi.UpdateAgentConfigRequest{ + AgentConfig: config, + }, + }, + } +}