Skip to content

Commit fa92bdd

Browse files
committed
Update protos
1 parent ae498fc commit fa92bdd

File tree

13 files changed

+136
-146
lines changed

13 files changed

+136
-146
lines changed

api/grpc/mpi/v1/command.pb.go

Lines changed: 119 additions & 120 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/grpc/mpi/v1/command.pb.validate.go

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/grpc/mpi/v1/command.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ message InstanceRuntime {
296296
// the binary path location
297297
string binary_path = 2 [(buf.validate.field).string.prefix = "/"];
298298
// the config path location
299-
optional string config_path = 3 [(buf.validate.field).string.prefix = "/"];
299+
string config_path = 3 [(buf.validate.field).string.pattern = "^\\/.*|^$"];
300300
// more detailed runtime objects
301301
oneof details {
302302
// NGINX runtime configuration settings like stub_status, usually read from the NGINX config or NGINX process

docs/proto/protos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ Meta-information relating to the reported instance
951951
| ----- | ---- | ----- | ----------- |
952952
| process_id | [int32](#int32) | | the process identifier |
953953
| binary_path | [string](#string) | | the binary path location |
954-
| config_path | [string](#string) | optional | the config path location |
954+
| config_path | [string](#string) | | the config path location |
955955
| nginx_runtime_info | [NGINXRuntimeInfo](#mpi-v1-NGINXRuntimeInfo) | | NGINX runtime configuration settings like stub_status, usually read from the NGINX config or NGINX process |
956956
| nginx_plus_runtime_info | [NGINXPlusRuntimeInfo](#mpi-v1-NGINXPlusRuntimeInfo) | | NGINX Plus runtime configuration settings like api value, usually read from the NGINX config, NGINX process or NGINX Plus API |
957957
| nginx_app_protect_runtime_info | [NGINXAppProtectRuntimeInfo](#mpi-v1-NGINXAppProtectRuntimeInfo) | | NGINX App Protect runtime information |

internal/resource/resource_plugin_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,13 @@ import (
3737
func TestResource_Process(t *testing.T) {
3838
ctx := context.Background()
3939

40-
configPath := protos.GetNginxOssInstance([]string{}).GetInstanceRuntime().GetConfigPath()
41-
4240
updatedInstance := &mpi.Instance{
4341
InstanceConfig: protos.GetNginxOssInstance([]string{}).GetInstanceConfig(),
4442
InstanceMeta: protos.GetNginxOssInstance([]string{}).GetInstanceMeta(),
4543
InstanceRuntime: &mpi.InstanceRuntime{
4644
ProcessId: 56789,
4745
BinaryPath: protos.GetNginxOssInstance([]string{}).GetInstanceRuntime().GetBinaryPath(),
48-
ConfigPath: &configPath,
46+
ConfigPath: protos.GetNginxOssInstance([]string{}).GetInstanceRuntime().GetConfigPath(),
4947
Details: protos.GetNginxOssInstance([]string{}).GetInstanceRuntime().GetDetails(),
5048
},
5149
}

internal/resource/resource_service_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,14 @@ func TestResourceService_AddInstance(t *testing.T) {
6868

6969
func TestResourceService_UpdateInstance(t *testing.T) {
7070
ctx := context.Background()
71-
configPath := protos.GetNginxOssInstance([]string{}).GetInstanceRuntime().GetConfigPath()
7271

7372
updatedInstance := &v1.Instance{
7473
InstanceConfig: protos.GetNginxOssInstance([]string{}).GetInstanceConfig(),
7574
InstanceMeta: protos.GetNginxOssInstance([]string{}).GetInstanceMeta(),
7675
InstanceRuntime: &v1.InstanceRuntime{
7776
ProcessId: 56789,
7877
BinaryPath: protos.GetNginxOssInstance([]string{}).GetInstanceRuntime().GetBinaryPath(),
79-
ConfigPath: &configPath,
78+
ConfigPath: protos.GetNginxOssInstance([]string{}).GetInstanceRuntime().GetConfigPath(),
8079
Details: protos.GetNginxOssInstance([]string{}).GetInstanceRuntime().GetDetails(),
8180
},
8281
}

internal/watcher/instance/instance_watcher_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ func (iw *InstanceWatcherService) agentInstance(ctx context.Context) *mpi.Instan
317317
InstanceRuntime: &mpi.InstanceRuntime{
318318
ProcessId: iw.executer.ProcessID(),
319319
BinaryPath: processPath,
320-
ConfigPath: &iw.agentConfig.Path,
320+
ConfigPath: iw.agentConfig.Path,
321321
Details: nil,
322322
},
323323
}

internal/watcher/instance/nginx_app_protect_process_parser.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ func (n NginxAppProtectProcessParser) Parse(
7070
InstanceRuntime: &mpi.InstanceRuntime{
7171
ProcessId: process.PID,
7272
BinaryPath: binaryPath,
73+
ConfigPath: "",
7374
Details: &mpi.InstanceRuntime_NginxAppProtectRuntimeInfo{
7475
NginxAppProtectRuntimeInfo: &mpi.NGINXAppProtectRuntimeInfo{
7576
Release: n.release(ctx),

internal/watcher/instance/nginx_config_parser_benchmark_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func BenchmarkNginxConfigParser_Parse(b *testing.B) {
5454
InstanceType: mpi.InstanceMeta_INSTANCE_TYPE_NGINX,
5555
},
5656
InstanceRuntime: &mpi.InstanceRuntime{
57-
ConfigPath: &configFilePath,
57+
ConfigPath: configFilePath,
5858
},
5959
},
6060
)
@@ -115,7 +115,7 @@ func BenchmarkNginxConfigParserGeneratedConfig_Parse(b *testing.B) {
115115
InstanceType: mpi.InstanceMeta_INSTANCE_TYPE_NGINX,
116116
},
117117
InstanceRuntime: &mpi.InstanceRuntime{
118-
ConfigPath: &location,
118+
ConfigPath: location,
119119
},
120120
},
121121
)

internal/watcher/instance/nginx_config_parser_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,7 @@ func TestNginxConfigParser_Parse(t *testing.T) {
325325
FileMeta: fileMeta,
326326
})
327327

328-
configPath := file.Name()
329-
test.instance.InstanceRuntime.ConfigPath = &configPath
328+
test.instance.InstanceRuntime.ConfigPath = file.Name()
330329

331330
agentConfig := types.AgentConfig()
332331
agentConfig.AllowedDirectories = []string{dir}

0 commit comments

Comments
 (0)