diff --git a/config_server/protocol/README.md b/config_server/v1/protocol/README.md similarity index 100% rename from config_server/protocol/README.md rename to config_server/v1/protocol/README.md diff --git a/config_server/protocol/v1/agent.proto b/config_server/v1/protocol/v1/agent.proto similarity index 100% rename from config_server/protocol/v1/agent.proto rename to config_server/v1/protocol/v1/agent.proto diff --git a/config_server/protocol/v1/user.proto b/config_server/v1/protocol/v1/user.proto similarity index 100% rename from config_server/protocol/v1/user.proto rename to config_server/v1/protocol/v1/user.proto diff --git a/config_server/v1/protocol/v2/README.md b/config_server/v1/protocol/v2/README.md new file mode 100644 index 0000000000..129cc14f40 --- /dev/null +++ b/config_server/v1/protocol/v2/README.md @@ -0,0 +1,251 @@ +# 统一管控协议 + +本规范定义了 Agent 管控网络协议以及 iLogtail 和 ConfigServer 的预期行为。 + +1. 只要XxxConfigServer实现了协议,那么就可以管控Agent做Yyy事情。 +2. 只要Agent实现了协议,那么任何XxxConfigServer就能过管控该Agent做Yyy事情。 + +## 管控协议 + +/Agent/Heartbeat?InstanceId=$instance\_id&WaitForChange=(true|false) + +### HeartbeatRequest 消息 + + message HeartbeatRequest { + bytes request_id = 1; + uint64 sequence_num = 2; // Increment every request, for server to check sync status + uint64 capabilities = 3; // Bitmask of flags defined by AgentCapabilities enum + bytes instance_id = 4; // Required, Agent's unique identification, consistent throughout the process lifecycle + string agent_type = 5; // Required, Agent's type(ilogtail, ..) + AgentAttributes attributes = 6; // Agent's basic attributes + repeated AgentGroupTag tags = 7; // Agent's tags + string running_status = 8; // Human readable running status + int64 startup_time = 9; // Required, Agent's startup time + repeated ConfigInfo pipeline_configs = 10; // Information about the current PIPELINE_CONFIG held by the Agent + repeated ConfigInfo instance_configs = 11; // Information about the current AGENT_CONFIG held by the Agent + repeated CommandInfo custom_commands = 12; // Information about command history + uint64 flags = 13; // Predefined command flag + bytes opaque = 14; // Opaque data for extension + // before 100 (inclusive) are reserved for future official fields + } + + message AgentGroupTag { + string name = 1; + string value = 2; + } + + enum ConfigStatus { + // The value of status field is not set. + UNSET = 0; + // Agent is currently applying the remote config that it received earlier. + APPLYING = 1; + // Remote config was successfully applied by the Agent. + APPLIED = 2; + // Agent tried to apply the config received earlier, but it failed. + // See error_message for more details. + FAILED = 3; + } + + // Define the Config information carried in the request + message ConfigInfo { + string name = 1; // Required, Config's unique identification + int64 version = 2; // Required, Config's version number or hash code + ConfigStatus status = 3; // Config's status + } + + // Define the Command information carried in the request + message CommandInfo { + string type = 1; // Command's type + string name = 2; // Required, Command's unique identification + ConfigStatus status = 3; // Command's status + } + + // Define Agent's basic attributes + message AgentAttributes { + bytes version = 1; // Agent's version + bytes ip = 2; // Agent's ip + bytes hostname = 3; // Agent's hostname + map extras = 100; // Agent's other attributes + // before 100 (inclusive) are reserved for future official fields + } + + enum AgentCapabilities { + // The capabilities field is unspecified. + UnspecifiedAgentCapability = 0; + // The Agent can accept pipeline configuration from the Server. + AcceptsPipelineConfig = 0x00000001; + // The Agent can accept instance configuration from the Server. + AcceptsInstanceConfig = 0x00000002; + // The Agent can accept custom command from the Server. + AcceptsCustomCommand = 0x00000004; + + // bits before 2^16 (inclusive) are reserved for future official fields + } + + enum RequestFlags { + RequestFlagsUnspecified = 0; + + // Flags is a bit mask. Values below define individual bits. + + // Must be set if this request contains full state + FullState = 0x00000001; + // bits before 2^16 (inclusive) are reserved for future official fields + } + +### HeartbeatResponse 消息 + + message HeartbeatResponse { + bytes request_id = 1; + ServerErrorResponse error_response = 2; // Set value indicates error + uint64 capabilities = 3; // Bitmask of flags defined by ServerCapabilities enum + + repeated ConfigDetail pipeline_config_updates = 4; // Agent's pipeline config update status + repeated ConfigDetail instance_config_updates = 5; // Agent's instance config update status + repeated CommandDetail custom_command_updates = 6; // Agent's commands updates + uint64 flags = 7; // Predefined command flag + bytes opaque = 8; // Opaque data for extension + } + + message ConfigDetail { + string name = 1; // Required, Config's unique identification + int64 version = 2; // Required, Config's version number or hash code + bytes detail = 3; // Required, Config's detail + } + + message CommandDetail { + string type = 1; // Required, Command type + string name = 2; // Required, Command name + bytes detail = 3; // Required, Command's detail + int64 expire_time = 4; // After which the command can be safely removed from history + } + + enum ServerCapabilities { + // The capabilities field is unspecified. + UnspecifiedServerCapability = 0; + // The Server can remember agent attributes. + RembersAttribute = 0x00000001; + // The Server can remember pipeline config status. + RembersPipelineConfigStatus = 0x00000002; + // The Server can remember instance config status. + RembersInstanceConfigStatus = 0x00000004; + // The Server can remember custom command status. + RembersCustomCommandStatus = 0x00000008; + + // bits before 2^16 (inclusive) are reserved for future official fields + } + + message ServerErrorResponse { + int32 error_code = 1; // None-zero value indicates error + string error_message = 2; // Error message + } + + enum ResponseFlags { + ResponseFlagsUnspecified = 0; + + // Flags is a bit mask. Values below define individual bits. + + // ReportFullState flag can be used by the Server if the Client did not include + // some sub-message in the last AgentToServer message (which is an allowed + // optimization) but the Server detects that it does not have it (e.g. was + // restarted and lost state). + ReportFullState = 0x00000001; + FetchPipelineConfigDetail = 0x00000002; + FetchInstanceConfigDetail = 0x00000004; + // bits before 2^16 (inclusive) are reserved for future official fields + } + +## 行为规范 + +对于管控协议来说 iLogtail 的预期行为是确定性的,对于实现本管控协议的其他 Agent 其具体行为可自行确定,但语义应保持一致。Server 端定义了可选的行为的不同实现,此时对于这些差异 Agent 侧在实现时必须都考虑到且做好兼容。这样,Agent只需要实现一个CommonConfigProvider就可以受任意符合此协议规范的ConfigServer管控。 + +### 能力报告 + +Client:应当通过capbilitiies上报Agent自身的能力,这样如果老的客户端接入新的ConfigServer,ConfigServer便知道客户端不具备某项能力,从而不会向其发送不支持的配置或命令而得不到状态汇报导致无限循环。 + +Server:应当通过capbilitiies上报Server自身的能力,这样如果新的客户端接入老的ConfigServer,Agent便知道服务端不具备某项能力,从而不会被其响应所误导,如其不具备记忆Attributes能力,那么Attributes字段无论如何都不应该在心跳中被省略。 + +### 注册 + +Client:Agent启动后第一次向Server汇报全量信息,request字段应填尽填。request\_id、sequence\_num、capabilities、instance\_id、agent\_type、startup\_time为必填字段。 + +Server:Server根据上报的信息返回响应。pipeline\_config\_updates、instance\_config\_updates中包含agent需要同步的配置,updates中必然包含name和version,是否包含详情context和detail取决于server端实现。custom\_command_updates包含要求agent执行的命令command中必然包含type、name和expire\_time。 + +Server是否保存Client信息取决于Server实现,如果服务端找不到或保存的sequence\_num + 1 ≠ 心跳的sequence\_num,那么就立刻返回并且flags中必须设置ReportFullStatus标识位。 + +Server根据agent\_type + attributes 查询进程配置,根据ip和tags查询机器组和关联采集配置。 + +![image](https://github.com/alibaba/ilogtail/assets/1827594/05799ac2-9249-49ed-8088-3b927821ac73) + +### 心跳(心跳压缩) + +Client:若接收到的响应中没有ReportFullStatus,且client的属性、配置状态、命令状态在上次上报后没有变化,那么可以只填instance\_id、sequence\_num,sequence\_num每次请求+1。若有ReportStatus或任何属性、配置状态变化或Server不支持属性、配置状态记忆能力,则必须完整上报状态。 + +Server:同注册 + +允许心跳压缩 + +![image](https://github.com/alibaba/ilogtail/assets/1827594/ad22bcfa-b14a-41b5-b4b8-4956bb065bf7) + +不允许心跳压缩 + +![image](https://github.com/alibaba/ilogtail/assets/1827594/35a823fd-6b8e-499f-951e-2231f3319420) + +### 进程配置 + +若Server的注册/心跳响应中有instance\_config\_updates.detail + +Client:直接从response中获得detail,应用成功后下次心跳需要上报完整状态。 + +若Server的响应不包含detail + +Client:根据instance\_config\_updates的信息构造FetchInstanceConfigRequest + +Server:返回FetchInstanceConfigResponse + +Client获取到多个进程配置时,自动合并,若产生冲突默认行为是未定义。 + +### 采集配置 + +若Server的注册/心跳响应中有pipeline\_config\_updates.detail + +Client:直接从response中获得detail,应用成功后下次心跳需要上报完整状态。 + +若Server的响应不包含detail + +Client:根据pipeline\_config\_updates的信息构造FetchPipelineConfigRequest + +Server:返回FetchPipelineConfigResponse + +客户端支持以下2种实现 + +实现1:直接将Detail返回在心跳响应中(FetchConfigDetail flag is unset) + +![image](https://github.com/alibaba/ilogtail/assets/1827594/be645615-dd99-42dd-9deb-681e9a4069bb) + +实现2:仅返回配置名和版本,Detail使用单独请求获取(FetchConfigDetail flag is set) + +![image](https://github.com/alibaba/ilogtail/assets/1827594/c409c35c-2a81-4927-bfd2-7fb321ef1ca8) + +### 配置状态上报 + +Client:这个版本的配置状态上报中修改了version的定义,-1仍然表示删除,0作为保留值,其他值都是合法version,只要version不同Client都应该视为配置更新。此外参考OpAMP增加了配置应用状态上报的字段,能反应出下发的配置是否生效。 + +Server:这些信息是Agent状态的一部分,可选保存。与通过Event上报可观测信息不同的是,作为状态信息没有时间属性,用户可通过接口可获取即刻状态,而不需要选择时间窗口合并事件。 + +### 预定义命令 + +Client: 通过request的flag传递,定义了FullStatus,表明本条信息为全量状态 + +Server: 通过response的flag传递,定义了ReportFullStatus,表明要求Client上报全量状态信息 + +### 自定义命令 + +Client: 为了防止服务端重复下发命令以及感知命令执行结果,在command expire前,Client始终应具备向服务端上报command执行状态的能力,实际是否上报取决于心跳压缩机制。在expire\_time超过后,client不应该再上报超时的command状态。 + +Server: 如果上报+已知的Agent状态中,缺少应下发的custom\_command\_updates(通过name识别),那么server应该在响应中下发缺少的custom\_command\_updates。 + +### 异常处理 + +Server: 服务端正常返回时HeartbeatResponse中的code应始终设置为0,而当服务端异常时,必须将HeartbeatResponse中的code设置为非0,HeartbeatResponse中的message应包含错误信息,此时Response中的其他字段必须为空。 + +Client: 当HeartbeatResponse中的code为0时,Agent应该正常处理下发的配置。当HeartbeatResponse中的code不为0时,Agent必须忽略除code和message外的其他字段,并择机重试。 diff --git a/config_server/protocol/v2/agent.proto b/config_server/v1/protocol/v2/agentV2.proto similarity index 89% rename from config_server/protocol/v2/agent.proto rename to config_server/v1/protocol/v2/agentV2.proto index ba53bfcff3..9098bf0d01 100644 --- a/config_server/protocol/v2/agent.proto +++ b/config_server/v1/protocol/v2/agentV2.proto @@ -40,6 +40,7 @@ message AgentAttributes { bytes version = 1; // Agent's version bytes ip = 2; // Agent's ip bytes hostname = 3; // Agent's hostname + bytes hostid = 4; // Agent's hostid https://opentelemetry.io/docs/specs/semconv/attributes-registry/host/ map extras = 100; // Agent's other attributes // before 100 (inclusive) are reserved for future official fields } @@ -49,8 +50,8 @@ enum AgentCapabilities { UnspecifiedAgentCapability = 0; // The Agent can accept pipeline configuration from the Server. AcceptsPipelineConfig = 0x00000001; - // The Agent can accept process configuration from the Server. - AcceptsProcessConfig = 0x00000002; + // The Agent can accept instance configuration from the Server. + AcceptsInstanceConfig = 0x00000002; // The Agent can accept custom command from the Server. AcceptsCustomCommand = 0x00000004; @@ -81,7 +82,7 @@ message HeartbeatRequest { string running_status = 8; // Human readable running status int64 startup_time = 9; // Required, Agent's startup time repeated ConfigInfo pipeline_configs = 10; // Information about the current PIPELINE_CONFIG held by the Agent - repeated ConfigInfo process_configs = 11; // Information about the current AGENT_CONFIG held by the Agent + repeated ConfigInfo instance_configs = 11; // Information about the current AGENT_CONFIG held by the Agent repeated CommandInfo custom_commands = 12; // Information about command history uint64 flags = 13; // Predefined command flag bytes opaque = 14; // Opaque data for extension @@ -102,11 +103,6 @@ message CommandDetail { int64 expire_time = 4; // After which the command can be safely removed from history } -message ServerErrorResponse { - int32 error_code = 1; // None-zero value indicates error - string error_message = 2; // Error message -} - enum ServerCapabilities { // The capabilities field is unspecified. UnspecifiedServerCapability = 0; @@ -114,8 +110,8 @@ enum ServerCapabilities { RembersAttribute = 0x00000001; // The Server can remember pipeline config status. RembersPipelineConfigStatus = 0x00000002; - // The Server can remember process config status. - RembersProcessConfigStatus = 0x00000004; + // The Server can remember instance config status. + RembersInstanceConfigStatus = 0x00000004; // The Server can remember custom command status. RembersCustomCommandStatus = 0x00000008; @@ -133,25 +129,25 @@ enum ResponseFlags { // restarted and lost state). ReportFullState = 0x00000001; FetchPipelineConfigDetail = 0x00000002; - FetchProcessConfigDetail = 0x00000004; + FetchInstanceConfigDetail = 0x00000004; // bits before 2^16 (inclusive) are reserved for future official fields } // ConfigServer's response to Agent's request message HeartbeatResponse { bytes request_id = 1; - ServerErrorResponse error_response = 2; // Set value indicates error + CommonResponse commonResponse = 2; // Set common response uint64 capabilities = 3; // Bitmask of flags defined by ServerCapabilities enum repeated ConfigDetail pipeline_config_updates = 4; // Agent's pipeline config update status - repeated ConfigDetail process_config_updates = 5; // Agent's process config update status + repeated ConfigDetail instance_config_updates = 5; // Agent's instance config update status repeated CommandDetail custom_command_updates = 6; // Agent's commands updates uint64 flags = 7; // Predefined command flag bytes opaque = 8; // Opaque data for extension } // API: /Agent/FetchPipelineConfig/ -// API: /Agent/FetchProcessConfig/ +// API: /Agent/FetchInstanceConfig/ // Agent request to ConfigServer, pulling details of the config message FetchConfigRequest { bytes request_id = 1; @@ -162,6 +158,12 @@ message FetchConfigRequest { // ConfigServer response to Agent's request message FetchConfigResponse { bytes request_id = 1; - ServerErrorResponse error_response = 2; + CommonResponse commonResponse = 2; repeated ConfigDetail config_details = 3; // config detail +} + +message CommonResponse +{ + int32 status = 1; + bytes errorMessage = 2; } \ No newline at end of file diff --git a/config_server/service/.gitignore b/config_server/v1/service/.gitignore similarity index 100% rename from config_server/service/.gitignore rename to config_server/v1/service/.gitignore diff --git a/config_server/service/Dockerfile b/config_server/v1/service/Dockerfile similarity index 100% rename from config_server/service/Dockerfile rename to config_server/v1/service/Dockerfile diff --git a/config_server/service/common/data_type.go b/config_server/v1/service/common/data_type.go similarity index 100% rename from config_server/service/common/data_type.go rename to config_server/v1/service/common/data_type.go diff --git a/config_server/service/common/http_response.go b/config_server/v1/service/common/http_response.go similarity index 100% rename from config_server/service/common/http_response.go rename to config_server/v1/service/common/http_response.go diff --git a/config_server/service/common/json_file.go b/config_server/v1/service/common/json_file.go similarity index 100% rename from config_server/service/common/json_file.go rename to config_server/v1/service/common/json_file.go diff --git a/config_server/service/common/queue.go b/config_server/v1/service/common/queue.go similarity index 100% rename from config_server/service/common/queue.go rename to config_server/v1/service/common/queue.go diff --git a/config_server/service/example/setting.json b/config_server/v1/service/example/setting.json similarity index 100% rename from config_server/service/example/setting.json rename to config_server/v1/service/example/setting.json diff --git a/config_server/service/go.mod b/config_server/v1/service/go.mod similarity index 100% rename from config_server/service/go.mod rename to config_server/v1/service/go.mod diff --git a/config_server/service/go.sum b/config_server/v1/service/go.sum similarity index 100% rename from config_server/service/go.sum rename to config_server/v1/service/go.sum diff --git a/config_server/service/interface/agent/collection_config.go b/config_server/v1/service/interface/agent/collection_config.go similarity index 100% rename from config_server/service/interface/agent/collection_config.go rename to config_server/v1/service/interface/agent/collection_config.go diff --git a/config_server/service/interface/agent/status.go b/config_server/v1/service/interface/agent/status.go similarity index 100% rename from config_server/service/interface/agent/status.go rename to config_server/v1/service/interface/agent/status.go diff --git a/config_server/service/interface/user/agent_group.go b/config_server/v1/service/interface/user/agent_group.go similarity index 100% rename from config_server/service/interface/user/agent_group.go rename to config_server/v1/service/interface/user/agent_group.go diff --git a/config_server/service/interface/user/collection_config.go b/config_server/v1/service/interface/user/collection_config.go similarity index 100% rename from config_server/service/interface/user/collection_config.go rename to config_server/v1/service/interface/user/collection_config.go diff --git a/config_server/service/manager/agent/agent_manager.go b/config_server/v1/service/manager/agent/agent_manager.go similarity index 100% rename from config_server/service/manager/agent/agent_manager.go rename to config_server/v1/service/manager/agent/agent_manager.go diff --git a/config_server/service/manager/agent/agent_operator.go b/config_server/v1/service/manager/agent/agent_operator.go similarity index 100% rename from config_server/service/manager/agent/agent_operator.go rename to config_server/v1/service/manager/agent/agent_operator.go diff --git a/config_server/service/manager/config/agent_operator.go b/config_server/v1/service/manager/config/agent_operator.go similarity index 100% rename from config_server/service/manager/config/agent_operator.go rename to config_server/v1/service/manager/config/agent_operator.go diff --git a/config_server/service/manager/config/config_manager.go b/config_server/v1/service/manager/config/config_manager.go similarity index 100% rename from config_server/service/manager/config/config_manager.go rename to config_server/v1/service/manager/config/config_manager.go diff --git a/config_server/service/manager/config/user_operator.go b/config_server/v1/service/manager/config/user_operator.go similarity index 100% rename from config_server/service/manager/config/user_operator.go rename to config_server/v1/service/manager/config/user_operator.go diff --git a/config_server/service/manager/manager.go b/config_server/v1/service/manager/manager.go similarity index 100% rename from config_server/service/manager/manager.go rename to config_server/v1/service/manager/manager.go diff --git a/config_server/service/model/agent.go b/config_server/v1/service/model/agent.go similarity index 100% rename from config_server/service/model/agent.go rename to config_server/v1/service/model/agent.go diff --git a/config_server/service/model/agent_group.go b/config_server/v1/service/model/agent_group.go similarity index 100% rename from config_server/service/model/agent_group.go rename to config_server/v1/service/model/agent_group.go diff --git a/config_server/service/model/collection_config.go b/config_server/v1/service/model/collection_config.go similarity index 100% rename from config_server/service/model/collection_config.go rename to config_server/v1/service/model/collection_config.go diff --git a/config_server/service/model/model_type.go b/config_server/v1/service/model/model_type.go similarity index 100% rename from config_server/service/model/model_type.go rename to config_server/v1/service/model/model_type.go diff --git a/config_server/service/proto/agent.pb.go b/config_server/v1/service/proto/agent.pb.go similarity index 100% rename from config_server/service/proto/agent.pb.go rename to config_server/v1/service/proto/agent.pb.go diff --git a/config_server/service/proto/user.pb.go b/config_server/v1/service/proto/user.pb.go similarity index 100% rename from config_server/service/proto/user.pb.go rename to config_server/v1/service/proto/user.pb.go diff --git a/config_server/service/router/router.go b/config_server/v1/service/router/router.go similarity index 100% rename from config_server/service/router/router.go rename to config_server/v1/service/router/router.go diff --git a/config_server/service/service.go b/config_server/v1/service/service.go similarity index 100% rename from config_server/service/service.go rename to config_server/v1/service/service.go diff --git a/config_server/service/setting/mysql-setting.json b/config_server/v1/service/setting/mysql-setting.json similarity index 100% rename from config_server/service/setting/mysql-setting.json rename to config_server/v1/service/setting/mysql-setting.json diff --git a/config_server/service/setting/setting.go b/config_server/v1/service/setting/setting.go similarity index 100% rename from config_server/service/setting/setting.go rename to config_server/v1/service/setting/setting.go diff --git a/config_server/service/setting/setting.json b/config_server/v1/service/setting/setting.json similarity index 100% rename from config_server/service/setting/setting.json rename to config_server/v1/service/setting/setting.json diff --git a/config_server/service/setting/sqlite-setting.json b/config_server/v1/service/setting/sqlite-setting.json similarity index 100% rename from config_server/service/setting/sqlite-setting.json rename to config_server/v1/service/setting/sqlite-setting.json diff --git a/config_server/service/store/gorm/gorm.go b/config_server/v1/service/store/gorm/gorm.go similarity index 100% rename from config_server/service/store/gorm/gorm.go rename to config_server/v1/service/store/gorm/gorm.go diff --git a/config_server/service/store/interface_database/interface_database.go b/config_server/v1/service/store/interface_database/interface_database.go similarity index 100% rename from config_server/service/store/interface_database/interface_database.go rename to config_server/v1/service/store/interface_database/interface_database.go diff --git a/config_server/service/store/leveldb/leveldb.go b/config_server/v1/service/store/leveldb/leveldb.go similarity index 100% rename from config_server/service/store/leveldb/leveldb.go rename to config_server/v1/service/store/leveldb/leveldb.go diff --git a/config_server/service/store/store.go b/config_server/v1/service/store/store.go similarity index 100% rename from config_server/service/store/store.go rename to config_server/v1/service/store/store.go diff --git a/config_server/service/test/interface_test.go b/config_server/v1/service/test/interface_test.go similarity index 100% rename from config_server/service/test/interface_test.go rename to config_server/v1/service/test/interface_test.go diff --git a/config_server/service/test/request.go b/config_server/v1/service/test/request.go similarity index 100% rename from config_server/service/test/request.go rename to config_server/v1/service/test/request.go diff --git a/config_server/service/test/setting/setting.json b/config_server/v1/service/test/setting/setting.json similarity index 100% rename from config_server/service/test/setting/setting.json rename to config_server/v1/service/test/setting/setting.json diff --git a/config_server/service/test/setting_test.go b/config_server/v1/service/test/setting_test.go similarity index 100% rename from config_server/service/test/setting_test.go rename to config_server/v1/service/test/setting_test.go diff --git a/config_server/service/test/store_test.go b/config_server/v1/service/test/store_test.go similarity index 100% rename from config_server/service/test/store_test.go rename to config_server/v1/service/test/store_test.go diff --git a/config_server/ui/README.md b/config_server/v1/ui/README.md similarity index 100% rename from config_server/ui/README.md rename to config_server/v1/ui/README.md diff --git a/config_server/v2/README.md b/config_server/v2/README.md new file mode 100644 index 0000000000..76e2b4557c --- /dev/null +++ b/config_server/v2/README.md @@ -0,0 +1,12 @@ +# Config-server + +这是基于阿里巴巴 iLogtail 项目 Config Server v2通信协议的一个前后端实现。 + +后端使用GO基于gin框架开发,针对https://github.com/alibaba/ilogtail/tree/main/config_server/protocol/v2 中提到的Agent行为进行了V2版本的适配,基本实现了能力报告、心跳压缩、配置状态上报等功能,并包含用户端接口,详情见[service](service/README.md)。 + +前端使用 Vue + Element plus 组件库 + Vue cli 脚手架工具进行开发,旨在为用户提供一个简单、实用、易嵌入的 Config Server 前端控制台,详情见[ui](ui/README.md)。 + +本项目提供了docker compose一键部署脚本,帮助用户快速搭建可用可视化与agent连通的config-server应用,详情见[deployment](deployment/README.md)。 + + + diff --git a/config_server/v2/protocol/README.md b/config_server/v2/protocol/README.md new file mode 100644 index 0000000000..783fb68970 --- /dev/null +++ b/config_server/v2/protocol/README.md @@ -0,0 +1,7 @@ +# 管控协议说明 + +ConfigServer管控协议的总贴、V1版本协议说明和翻新至V2的讨论参见 +[服务端管控协议共建,欢迎参与讨论交流](https://github.com/alibaba/ilogtail/discussions/404)。 + +V2版本的讨论参见 +[心跳&配置同步流程重构讨论](https://github.com/alibaba/ilogtail/discussions/1491#discussioncomment-9547735)。 diff --git a/config_server/v2/protocol/v1/agent.proto b/config_server/v2/protocol/v1/agent.proto new file mode 100644 index 0000000000..fe56d24f0d --- /dev/null +++ b/config_server/v2/protocol/v1/agent.proto @@ -0,0 +1,134 @@ +syntax = "proto3"; +package configserver.proto; +option go_package = ".;configserver_proto"; + +// Define Config's type +enum ConfigType { + PIPELINE_CONFIG = 0; + AGENT_CONFIG = 1; +} + +// Define Config's update status +enum CheckStatus { + NEW = 0; + DELETED = 1; + MODIFIED = 2; +} + +// Define response code +enum RespCode { + ACCEPT = 0; + INVALID_PARAMETER = 1; + INTERNAL_SERVER_ERROR = 2; +} + +// Define the Config information carried in the request +message ConfigInfo { + ConfigType type = 1; // Required, Config's type + string name = 2; // Required, Config's unique identification + int64 version = 3; // Required, Config's version number + string context = 4; // Config's context +} + +// Define the result of checking the Config update status +message ConfigCheckResult { + ConfigType type = 1; // Required, Config's type + string name = 2; // Required, Config's unique identification + int64 old_version = 3; // Required, Config's current version number + int64 new_version = 4; // Required, Config's latest version number + string context = 5; // Config's context + CheckStatus check_status = 6; // Required, Config's update status +} + +// Define Config's detail +message ConfigDetail { + ConfigType type = 1; // Required, Config's type + string name = 2; // Required, Config's unique identification + int64 version = 3; // Required, Config's version number + string context = 4; // Config's context + string detail = 5; // Required, Config's detail +} + +// Define Agent's basic attributes +message AgentAttributes { + string version = 1; // Agent's version + string category = 2; // Agent's type(used to distinguish AGENT_CONFIG) + string ip = 3; // Agent's ip + string hostname = 4; // Agent's hostname + string region = 5; // Agent's region + string zone = 6; // Agent's zone + map extras = 100; // Agent's other attributes +} + +// Define command +message Command { + string type = 1; // Required, Command type + string name = 2; // Required, Command name + string id = 3; // Required, Command id + map args = 4; // Command's parameter arrays +} + +// API: /Agent/HeartBeat/ + +// Agent sends requests to the ConfigServer to send heartbeats, get config updates and receive commands. +message HeartBeatRequest { + string request_id = 1; + + string agent_id = 2; // Required, Agent's unique identification + string agent_type = 3; // Required, Agent's type(ilogtail, ..) + AgentAttributes attributes = 4; // Agent's basic attributes + repeated string tags = 5; // Agent's tags + string running_status = 6; // Required, Agent's running status + int64 startup_time = 7; // Required, Agent's startup time + int32 interval = 8; // Agent's heartbeat interval + repeated ConfigInfo pipeline_configs = 9; // Information about the current PIPELINE_CONFIG held by the Agent + repeated ConfigInfo agent_configs = 10; // Information about the current AGENT_CONFIG held by the Agent +} + +// ConfigServer's response to Agent's heartbeats +message HeartBeatResponse { + string request_id = 1; + RespCode code = 2; + string message = 3; + + repeated ConfigCheckResult pipeline_check_results = 4; // Agent's PIPELINE_CONFIG update status + repeated ConfigCheckResult agent_check_results = 5; // Agent's AGENT_CONFIG update status + repeated Command custom_commands = 6; // Agent received commands +} + +// API: /Agent/FetchPipelineConfig/ +// Agent request to ConfigServer, pulling details of the PIPELINE_CONFIG +message FetchPipelineConfigRequest { + string request_id = 1; + + string agent_id = 2; // Required, Agent's unique identification + repeated ConfigInfo req_configs = 3; // PIPELINE_CONFIGs that Agent requires for full information +} + +// ConfigServer response to Agent's request +message FetchPipelineConfigResponse { + string request_id = 1; + RespCode code = 2; + string message = 3; + + repeated ConfigDetail config_details = 4; // PIPELINE_CONFIGs' detail +} + +// API: /Agent/FetchAgentConfig/ +// Agent request to ConfigServer, pulling details of the AGENT_CONFIG +message FetchAgentConfigRequest { + string request_id = 1; + + string agent_id = 2; // Required, Agent's unique identification + AgentAttributes attributes = 3; // Required, Agent's basic attributes + repeated ConfigInfo req_configs = 4; // AGENT_CONFIGs that Agent requires for full information +} + +// ConfigServer response to Agent's request +message FetchAgentConfigResponse { + string request_id = 1; + RespCode code = 2; + string message = 3; + + repeated ConfigDetail config_details = 4; // AGENT_CONFIGs' detail +} \ No newline at end of file diff --git a/config_server/v2/protocol/v1/user.proto b/config_server/v2/protocol/v1/user.proto new file mode 100644 index 0000000000..4a6147fdc2 --- /dev/null +++ b/config_server/v2/protocol/v1/user.proto @@ -0,0 +1,234 @@ +syntax = "proto3"; +package configserver.proto; +option go_package = ".;configserver_proto"; +import "agent.proto"; + +message AgentGroupTag { + string name = 1; + string value = 2; +} + +message AgentGroup { + string group_name = 1; + string description = 2; + repeated AgentGroupTag tags = 3; +} + +message Agent { + string agent_id = 1; // Required, Agent's unique identification + string agent_type = 2; // Required, Agent's type(ilogtail, ..) + AgentAttributes attributes = 3; // Agent's basic attributes + repeated string tags = 4; // Agent's tags + string running_status = 5; // Required, Agent's running status + int64 startup_time = 6; // Required, Agent's startup time + int32 interval = 7; // Agent's heartbeat interval +} + +// API: /User/CreateAgentGroup + +message CreateAgentGroupRequest { + string request_id = 1; + AgentGroup agent_group = 2; +} + +message CreateAgentGroupResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; +} + +// API: /User/UpdateAgentGroup + +message UpdateAgentGroupRequest { + string request_id = 1; + AgentGroup agent_group = 2; +} + +message UpdateAgentGroupResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; +} + +// API: /User/DeleteAgentGroup/ + +message DeleteAgentGroupRequest { + string request_id = 1; + string group_name = 2; +} + +message DeleteAgentGroupResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; +} + +// API: /User/GetAgentGroup/ + +message GetAgentGroupRequest { + string request_id = 1; + string group_name = 2; +} + +message GetAgentGroupResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; + + AgentGroup agent_group = 4; +} + +// API: /User/ListAgentGroups/ + +message ListAgentGroupsRequest { + string request_id = 1; +} + +message ListAgentGroupsResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; + + repeated AgentGroup agent_groups = 4; +} + +// API: /User/CreateConfig/ + +message CreateConfigRequest { + string request_id = 1; + ConfigDetail config_detail = 2; +} + +message CreateConfigResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; +} + +// API: /User/UpdateConfig/ + +message UpdateConfigRequest { + string request_id = 1; + ConfigDetail config_detail = 2; +} + +message UpdateConfigResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; +} + +// API: /User/DeleteConfig/ + +message DeleteConfigRequest { + string request_id = 1; + string config_name = 2; +} + +message DeleteConfigResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; +} + +// API: User/GetConfig/ + +message GetConfigRequest { + string request_id = 1; + string config_name = 2; +} + +message GetConfigResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; + + ConfigDetail config_detail = 4; +} + +// API: /User/ListConfigs/ + +message ListConfigsRequest { + string request_id = 1; +} + +message ListConfigsResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; + + repeated ConfigDetail config_details = 4; +} + +// API: /User/ApplyConfigToAgentGroup/ + +message ApplyConfigToAgentGroupRequest { + string request_id = 1; + string config_name = 2; + string group_name = 3; +} + +message ApplyConfigToAgentGroupResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; +} + +// API: /User/RemoveConfigFromAgentGroup/ + +message RemoveConfigFromAgentGroupRequest { + string request_id = 1; + string config_name = 2; + string group_name = 3; +} + +message RemoveConfigFromAgentGroupResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; +} + +// API: /User/GetAppliedConfigsForAgentGroup/ + +message GetAppliedConfigsForAgentGroupRequest { + string request_id = 1; + string group_name = 2; +} + +message GetAppliedConfigsForAgentGroupResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; + + repeated string config_names = 4; +} + +// API: /User/GetAppliedAgentGroups/ + +message GetAppliedAgentGroupsRequest { + string request_id = 1; + string config_name = 2; +} + +message GetAppliedAgentGroupsResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; + + repeated string agent_group_names = 4; +} + +// API: /User/ListAgents/ + +message ListAgentsRequest { + string request_id = 1; + string group_name = 2; +} + +message ListAgentsResponse { + string response_id = 1; + RespCode code = 2; + string message = 3; + + repeated Agent agents = 4; +} \ No newline at end of file diff --git a/config_server/protocol/v2/README.md b/config_server/v2/protocol/v2/README.md similarity index 97% rename from config_server/protocol/v2/README.md rename to config_server/v2/protocol/v2/README.md index 54b7bd088b..7d588a5348 100644 --- a/config_server/protocol/v2/README.md +++ b/config_server/v2/protocol/v2/README.md @@ -75,7 +75,7 @@ // The Agent can accept pipeline configuration from the Server. AcceptsPipelineConfig = 0x00000001; // The Agent can accept process configuration from the Server. - AcceptsProcessConfig = 0x00000002; + AcceptsInstanceConfig = 0x00000002; // The Agent can accept custom command from the Server. AcceptsCustomCommand = 0x00000004; @@ -127,7 +127,7 @@ // The Server can remember pipeline config status. RembersPipelineConfigStatus = 0x00000002; // The Server can remember process config status. - RembersProcessConfigStatus = 0x00000004; + RembersInstanceConfigStatus = 0x00000004; // The Server can remember custom command status. RembersCustomCommandStatus = 0x00000008; @@ -150,7 +150,7 @@ // restarted and lost state). ReportFullState = 0x00000001; FetchPipelineConfigDetail = 0x00000002; - FetchProcessConfigDetail = 0x00000004; + FetchInstanceConfigDetail = 0x00000004; // bits before 2^16 (inclusive) are reserved for future official fields } @@ -198,9 +198,9 @@ Client:直接从response中获得detail,应用成功后下次心跳需要上 若Server的响应不包含detail -Client:根据process\_config\_updates的信息构造FetchProcessConfigRequest +Client:根据process\_config\_updates的信息构造FetchInstanceConfigRequest -Server:返回FetchProcessConfigResponse +Server:返回FetchInstanceConfigResponse Client获取到多个进程配置时,自动合并,若产生冲突默认行为是未定义。 diff --git a/config_server/v2/protocol/v2/agent.proto b/config_server/v2/protocol/v2/agent.proto new file mode 100644 index 0000000000..d9e52a883f --- /dev/null +++ b/config_server/v2/protocol/v2/agent.proto @@ -0,0 +1,168 @@ +syntax = "proto3"; +option go_package = "/protov2;"; + +message AgentGroupTag { + string name = 1; + string value = 2; +} + +enum ConfigStatus { + // The value of status field is not set. + UNSET = 0; + // Agent is currently applying the remote config that it received earlier. + APPLYING = 1; + // Remote config was successfully applied by the Agent. + APPLIED = 2; + // Agent tried to apply the config received earlier, but it failed. + // See error_message for more details. + FAILED = 3; +} + +// Define the Config information carried in the request +message ConfigInfo { + string name = 1; // Required, Config's unique identification + int64 version = 2; // Required, Config's version number or hash code + ConfigStatus status = 3; // Config's status + string message = 4; // Optional error message +} + +// Define the Command information carried in the request +message CommandInfo { + string type = 1; // Command's type + string name = 2; // Required, Command's unique identification + ConfigStatus status = 3; // Command's status + string message = 4; // Optional error message +} + +// Define Agent's basic attributes +message AgentAttributes { + bytes version = 1; // Agent's version + bytes ip = 2; // Agent's ip + bytes hostname = 3; // Agent's hostname + bytes hostid = 4; // Agent's hostid https://opentelemetry.io/docs/specs/semconv/attributes-registry/host/ + map extras = 100; // Agent's other attributes + // before 100 (inclusive) are reserved for future official fields +} + +enum AgentCapabilities { + // The capabilities field is unspecified. + UnspecifiedAgentCapability = 0; + // The Agent can accept pipeline configuration from the Server. + AcceptsPipelineConfig = 0x00000001; + // The Agent can accept instance configuration from the Server. + AcceptsInstanceConfig = 0x00000002; + // The Agent can accept custom command from the Server. + AcceptsCustomCommand = 0x00000004; + + // Add new capabilities here, continuing with the least significant unused bit. +} + +enum RequestFlags { + RequestFlagsUnspecified = 0; + + // Flags is a bit mask. Values below define individual bits. + + // Must be set if this request contains full state + FullState = 0x00000001; + // bits before 2^16 (inclusive) are reserved for future official fields +} + +// API: /Agent/Heartbeat + +// Agent sends requests to the ConfigServer to get config updates and receive commands. +message HeartbeatRequest { + bytes request_id = 1; + uint64 sequence_num = 2; // Increment every request, for server to check sync status + uint64 capabilities = 3; // Bitmask of flags defined by AgentCapabilities enum + bytes instance_id = 4; // Required, Agent's unique identification, consistent throughout the process lifecycle + string agent_type = 5; // Required, Agent's type(ilogtail, ..) + AgentAttributes attributes = 6; // Agent's basic attributes + repeated AgentGroupTag tags = 7; // Agent's tags + string running_status = 8; // Human readable running status + int64 startup_time = 9; // Required, Agent's startup time + repeated ConfigInfo pipeline_configs = 10; // Information about the current PIPELINE_CONFIG held by the Agent + repeated ConfigInfo instance_configs = 11; // Information about the current AGENT_CONFIG held by the Agent + repeated CommandInfo custom_commands = 12; // Information about command history + uint64 flags = 13; // Predefined command flag + bytes opaque = 14; // Opaque data for extension + // before 100 (inclusive) are reserved for future official fields +} + +// Define Config's detail +message ConfigDetail { + string name = 1; // Required, Config's unique identification + int64 version = 2; // Required, Config's version number or hash code + bytes detail = 3; // Required, Config's detail +} + +message CommandDetail { + string type = 1; // Required, Command type + string name = 2; // Required, Command name + bytes detail = 3; // Required, Command's detail + int64 expire_time = 4; // After which the command can be safely removed from history +} + +enum ServerCapabilities { + // The capabilities field is unspecified. + UnspecifiedServerCapability = 0; + // The Server can remember agent attributes. + RembersAttribute = 0x00000001; + // The Server can remember pipeline config status. + RembersPipelineConfigStatus = 0x00000002; + // The Server can remember instance config status. + RembersInstanceConfigStatus = 0x00000004; + // The Server can remember custom command status. + RembersCustomCommandStatus = 0x00000008; + + // bits before 2^16 (inclusive) are reserved for future official fields +} + +enum ResponseFlags { + ResponseFlagsUnspecified = 0; + + // Flags is a bit mask. Values below define individual bits. + + // ReportFullState flag can be used by the Server if the Client did not include + // some sub-message in the last AgentToServer message (which is an allowed + // optimization) but the Server detects that it does not have it (e.g. was + // restarted and lost state). + ReportFullState = 0x00000001; + FetchPipelineConfigDetail = 0x00000002; + FetchInstanceConfigDetail = 0x00000004; + // bits before 2^16 (inclusive) are reserved for future official fields +} + +// ConfigServer's response to Agent's request +message HeartbeatResponse { + bytes request_id = 1; + CommonResponse common_response = 2; // Set common response + uint64 capabilities = 3; // Bitmask of flags defined by ServerCapabilities enum + + repeated ConfigDetail pipeline_config_updates = 4; // Agent's pipeline config update status + repeated ConfigDetail instance_config_updates = 5; // Agent's instance config update status + repeated CommandDetail custom_command_updates = 6; // Agent's commands updates + uint64 flags = 7; // Predefined command flag + bytes opaque = 8; // Opaque data for extension +} + +// API: /Agent/FetchPipelineConfig/ +// API: /Agent/FetchInstanceConfig/ +// Agent request to ConfigServer, pulling details of the config +message FetchConfigRequest { + bytes request_id = 1; + bytes instance_id = 2; // Agent's unique identification + repeated ConfigInfo req_configs = 3; // Config's name and version/hash +} + +// ConfigServer response to Agent's request +message FetchConfigResponse { + bytes request_id = 1; + CommonResponse common_response = 2; + repeated ConfigDetail config_details = 3; // config detail +} + +message CommonResponse +{ + int32 status = 1; + bytes error_message = 2; +} \ No newline at end of file diff --git a/config_server/v2/protocol/v2/user.proto b/config_server/v2/protocol/v2/user.proto new file mode 100644 index 0000000000..5fe277fe43 --- /dev/null +++ b/config_server/v2/protocol/v2/user.proto @@ -0,0 +1,221 @@ +syntax = "proto3"; +option go_package = "/protov2;"; +import "agent.proto"; + + +message Agent{ + uint64 capabilities = 1; // Bitmask of flags defined by AgentCapabilities enum + bytes instance_id = 2; // Required, Agent's unique identification, consistent throughout the process lifecycle + string agent_type = 3; // Required, Agent's type(ilogtail, ..) + AgentAttributes attributes = 4; // Agent's basic attributes + string running_status = 5; // Human readable running status + int64 startup_time = 6; // Required, Agent's startup time +} + + +// API: /User/CreateAgentGroup + +message CreateAgentGroupRequest { + bytes request_id = 1; + AgentGroupTag agent_group = 2; +} + +message CreateAgentGroupResponse { + bytes request_id = 1; + CommonResponse common_response=2; +} + +// API: /User/UpdateAgentGroup + +message UpdateAgentGroupRequest { + bytes request_id = 1; + AgentGroupTag agent_group = 2; +} + +message UpdateAgentGroupResponse { + bytes request_id = 1; + CommonResponse common_response=2; +} + +// API: /User/DeleteAgentGroup/ + +message DeleteAgentGroupRequest { + bytes request_id = 1; + string group_name = 2; +} + +message DeleteAgentGroupResponse { + bytes request_id = 1; + CommonResponse common_response=2; +} + +// API: /User/GetAgentGroup/ + +message GetAgentGroupRequest { + bytes request_id = 1; + string group_name = 2; +} + +message GetAgentGroupResponse { + bytes request_id = 1; + CommonResponse common_response=2; + AgentGroupTag agent_group = 3; +} + +// API: /User/ListAgentGroups/ + +message ListAgentGroupsRequest { + bytes request_id = 1; +} + +message ListAgentGroupsResponse { + bytes request_id = 1; + CommonResponse common_response=2; + + repeated AgentGroupTag agent_groups = 4; +} + +// API: /User/CreatePipelineConfig +// API: /User/CreateInstanceConfig +message CreateConfigRequest { + bytes request_id = 1; + ConfigDetail config_detail = 2; +} + +message CreateConfigResponse { + bytes request_id = 1; + CommonResponse common_response =2; +} + +// API: /User/UpdatePipelineConfig +// API: /User/UpdateInstanceConfig +message UpdateConfigRequest { + bytes request_id = 1; + ConfigDetail config_detail = 2; +} + +message UpdateConfigResponse { + bytes request_id = 1; + CommonResponse common_response=2; +} + +// API: /User/DeletePipelineConfig +// API: /User/DeleteInstanceConfig +message DeleteConfigRequest { + bytes request_id = 1; + string config_name = 2; +} + +message DeleteConfigResponse { + bytes request_id = 1; + CommonResponse common_response=2; +} + +// API: /User/GetPipelineConfig +// API: /User/GetInstanceConfig +message GetConfigRequest { + bytes request_id = 1; + string config_name = 2; +} + +message GetConfigResponse { + bytes request_id = 1; + CommonResponse common_response=2; + + ConfigDetail config_detail = 3; +} + +// API: /User/GetPipelineConfigStatusList +// API: /User/GetInstanceConfigStatusList +message GetConfigStatusListRequest{ + bytes request_id = 1; + bytes instance_id = 2; +} + +message GetConfigStatusListResponse{ + bytes request_id = 1; + CommonResponse common_response = 2; + repeated ConfigInfo config_status = 3; +} + +// API: /User/ListPipelineConfigs +// API: /User/ListInstanceConfigs +message ListConfigsRequest { + bytes request_id = 1; +} + +message ListConfigsResponse { + bytes request_id = 1; + CommonResponse common_response = 2; + + repeated ConfigDetail config_details = 3; +} + +// API: /User/ApplyPipelineConfigToAgentGroup +// API: /User/ApplyInstanceConfigToAgentGroup +message ApplyConfigToAgentGroupRequest { + bytes request_id = 1; + string config_name = 2; + string group_name = 3; +} + +message ApplyConfigToAgentGroupResponse { + bytes request_id = 1; + CommonResponse common_response = 2; +} + +// API: /User/RemovePipelineConfigFromAgentGroup/ +// API: /User/RemoveInstanceConfigFromAgentGroup/ +message RemoveConfigFromAgentGroupRequest { + bytes request_id = 1; + string config_name = 2; + string group_name = 3; +} + +message RemoveConfigFromAgentGroupResponse { + bytes request_id = 1; + CommonResponse common_response = 2; +} + + +// API: /User/GetAppliedPipelineConfigsForAgentGroup/ +// API: /User/GetAppliedInstanceConfigsForAgentGroup/ +message GetAppliedConfigsForAgentGroupRequest { + bytes request_id = 1; + string group_name = 2; +} + +message GetAppliedConfigsForAgentGroupResponse { + bytes request_id = 1; + CommonResponse common_response = 2; + + repeated string config_names = 4; +} + +// API: /User/GetAppliedAgentGroupsWithPipelineConfig/ +// API: /User/GetAppliedAgentGroupsWithInstanceConfig/ +message GetAppliedAgentGroupsRequest { + bytes request_id = 1; + string config_name = 2; +} + +message GetAppliedAgentGroupsResponse { + bytes request_id = 1; + CommonResponse common_response = 2; + + repeated string agent_group_names = 3; +} + +// API: /User/ListAgents/ + +message ListAgentsRequest { + bytes request_id = 1; + string group_name = 2; +} + +message ListAgentsResponse { + bytes request_id = 1; + CommonResponse common_response = 2; + + repeated Agent agents = 3; +} \ No newline at end of file diff --git a/config_server/v2/service/.gitignore b/config_server/v2/service/.gitignore new file mode 100644 index 0000000000..2d5f70f38e --- /dev/null +++ b/config_server/v2/service/.gitignore @@ -0,0 +1,4 @@ +router/cmd +ConfigServer +cmd/config/dev/* +.idea diff --git a/config_server/v2/service/Dockerfile b/config_server/v2/service/Dockerfile new file mode 100644 index 0000000000..d80159bef2 --- /dev/null +++ b/config_server/v2/service/Dockerfile @@ -0,0 +1,26 @@ +FROM sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux:2.0.3 as build + +USER root +WORKDIR /backend +COPY . . + +RUN go env -w GOPROXY="https://goproxy.cn,direct" \ + && go mod tidy \ + && go build -o ConfigServer ./cmd + + +FROM centos:centos7.9.2009 +RUN curl -L -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo + +RUN yum update -y && yum upgrade -y && yum -y clean all && rm -fr /var/cache && rm -rf /core.* + +WORKDIR /backend +COPY --from=build /backend/cmd /backend/cmd +COPY --from=build /backend/ConfigServer /backend/ConfigServer +ENV GIN_MODE=release +ENV GO_ENV=prod + +CMD sh -c "./ConfigServer" + + + diff --git a/config_server/v2/service/Dockerfile-dev b/config_server/v2/service/Dockerfile-dev new file mode 100644 index 0000000000..38d40eeab5 --- /dev/null +++ b/config_server/v2/service/Dockerfile-dev @@ -0,0 +1,13 @@ +FROM sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux:2.0.3 as build + +USER root +WORKDIR /backend + +COPY . . + +RUN go env -w GOPROXY="https://goproxy.cn,direct" \ + && go mod tidy + +CMD sh -c "go build -o ConfigServer ./cmd && ./ConfigServer" + + diff --git a/config_server/v2/service/README.md b/config_server/v2/service/README.md new file mode 100644 index 0000000000..7538f1578d --- /dev/null +++ b/config_server/v2/service/README.md @@ -0,0 +1,69 @@ +# Config-server + +本项目针对https://github.com/alibaba/ilogtail/tree/main/config_server/protocol/v2 中提到的Agent行为进行了V2版本的适配,基本实现了能力报告、心跳压缩、配置状态上报等功能;并适配用户端实现了Config-server的前端页面Config-server-ui,项目见[ui](../ui/README.md)。 +## 快速开始 +### 基本配置 +下载ilogtail源码,进入`config_server/service`目录 +#### 数据库配置 + +由于要求ConfigServer存储Agent的基本信息、PipelineConfig、InstanceConfig等配置信息,所以首先需要对数据库进行配置。打开`cmd/config/prod`文件夹,编辑`databaseConfig.json`(若不存在,请先创建),填入以下信息,其中`type`为数据库的基本类型 (基于gorm我们适配了`mysql`、`sqlite`、`postgres`、`sqlserver`四种数据库);其余均为数据库配置信息;`autoMigrate`字段默认为`true`,若先前建好业务相关的表,则设置为`false`。配置完成后,请自行创建可与ConfigServer连通的数据库实例,并创建名字为`dbName`的数据库(若按照docker compose方式启动,无需任何操作,参考[deployment](../deployment/README.md))。 +```json +{ + "type": "mysql", + "userName": "root", + "password": "123456", + "host": "mysql", + "port": 3306, + "dbName": "test", + "autoMigrate": true +} +``` + +#### ConfigServer配置 + +打开`cmd/config/prod`文件夹,编辑`serverConfig.json`(若不存在,请先创建),填入以下信息,其中`address`为应用程序运行的ip和端口;`capabilities`标识Server端拥有的能力,`responseFlags`支持两种配置采集方式,详情见[protocol](https://github.com/alibaba/ilogtail/blob/main/config_server/protocol/v2/README.md);若长时间没接收到某个Agent的心跳检测(超时上限为`timeLimit`,单位是秒),server端自动下线该Agent。 +```json +{ + "address": "0.0.0.0:9090", + "capabilities": { + "rememberAttribute": true, + "rememberPipelineConfigStatus": true, + "rememberInstanceConfigStatus": true, + "rememberCustomCommandStatus": false + }, + "responseFlags": { + "fetchPipelineConfigDetail": true, + "fetchInstanceConfigDetail": false + }, + "timeLimit":60 +} +``` +### 运行 + +按照**基本配置**进行数据库与ConfigServer的配置,进入根目录,运行下面的命令 + +```shell +go build -o ConfigServer ./cmd + +./ConfigServer +``` +本项目同样支持docker方式启动应用,Dockerfile见`Dockerfile`(不建议使用,通过docker compose一键部署脚本,可以更快实现应用搭建,参考[deployment](../deployment/README.md))。 +### 启动Agent + +Agent 侧需要配置 ConfigServer 信息,才能使用管控功能。从[releases](https://github.com/alibaba/ilogtail/releases) 下载latest版本,配置`ilogtail_config.json`(若不存在,请先创建),添加如下信息,其中`endpoint_list`为ConfigServer的集群地址,并启动Agent。 +```json +{ + "config_server_list": [ + { + "cluster": "community", + "endpoint_list": [ + "127.0.0.1:9090" + ] + } + ] +} +``` +若Agent以docker方式启动(安装与启动见[start-with-container](https://github.com/alibaba/ilogtail/blob/main/docs/cn/installation/start-with-container.md)),务必保证Agent与ConfigServer的网络连通,可选择以下两种配置方案: +* 启动时配置Agent与ConfigServer在同一docker网络`server`中,此时`endpoint_list:["config-server:9090"]`。 +* 启动时配置`docker.internal.host`映射,此时`endpoint_list:["docker.internal.host:9090"]`。 + diff --git a/config_server/v2/service/cmd/config/prod/databaseConfig.json b/config_server/v2/service/cmd/config/prod/databaseConfig.json new file mode 100644 index 0000000000..1511e146f1 --- /dev/null +++ b/config_server/v2/service/cmd/config/prod/databaseConfig.json @@ -0,0 +1,9 @@ +{ + "type": "mysql", + "userName": "root", + "password": "123456", + "host": "mysql", + "port": 3306, + "dbName": "test", + "autoMigrate": true +} \ No newline at end of file diff --git a/config_server/v2/service/cmd/config/prod/serverConfig.json b/config_server/v2/service/cmd/config/prod/serverConfig.json new file mode 100644 index 0000000000..e9cf7256c5 --- /dev/null +++ b/config_server/v2/service/cmd/config/prod/serverConfig.json @@ -0,0 +1,14 @@ +{ + "address": "0.0.0.0:9090", + "capabilities": { + "rememberAttribute": true, + "rememberPipelineConfigStatus": true, + "rememberInstanceConfigStatus": true, + "rememberCustomCommandStatus": false + }, + "responseFlags": { + "fetchPipelineConfigDetail": true, + "fetchInstanceConfigDetail": false + }, + "timeLimit": 60 +} \ No newline at end of file diff --git a/config_server/v2/service/cmd/main.go b/config_server/v2/service/cmd/main.go new file mode 100644 index 0000000000..0cb9dcec42 --- /dev/null +++ b/config_server/v2/service/cmd/main.go @@ -0,0 +1,25 @@ +package main + +import ( + "config-server/config" + "config-server/router" + "github.com/gin-gonic/gin" + "os" +) + +func main() { + env := os.Getenv("GO_ENV") + var r *gin.Engine + if env == "prod" { + gin.SetMode(gin.ReleaseMode) + r = gin.New() + } else { + gin.SetMode(gin.DebugMode) + r = gin.Default() + } + router.InitAllRouter(r, env) + err := r.Run(config.ServerConfigInstance.Address) + if err != nil { + panic(err) + } +} diff --git a/config_server/v2/service/common/api_error.go b/config_server/v2/service/common/api_error.go new file mode 100644 index 0000000000..4e25525871 --- /dev/null +++ b/config_server/v2/service/common/api_error.go @@ -0,0 +1,70 @@ +package common + +import ( + "errors" + "fmt" +) + +type ApiError struct { + Status HttpStatus + Message string +} + +func (apiError ApiError) Error() string { + return fmt.Sprintf("Code:%d,Messgae:%s", apiError.Status.Code, apiError.Message) +} + +func ErrorWithMsg(status HttpStatus, msg string) *ApiError { + var apiErrorResult = ApiError{ + Status: ServerBusy, + Message: ServerBusy.Message, + } + if status.Code != 0 { + apiErrorResult.Status = status + } + if msg != "" { + apiErrorResult.Message = msg + } + PrintLog(apiErrorResult.Status.Code, apiErrorResult.Message, 3) + return &apiErrorResult +} + +//-----Server----- +// include config、agent、agent_group already exists or not exists + +func ServerErrorWithMsg(status HttpStatus, msg string, a ...any) *ApiError { + if a == nil || len(a) == 0 { + return ErrorWithMsg(status, msg) + } + return ErrorWithMsg(status, fmt.Sprintf(msg, a...)) +} + +func ServerError(msg string, a ...any) *ApiError { + return ServerErrorWithMsg(ServerBusy, msg, a...) +} + +//-----InvalidParameter----- + +func ValidateErrorWithMsg(msg string) *ApiError { + return ErrorWithMsg(InvalidParameter, msg) +} + +func ValidateError() *ApiError { + return ErrorWithMsg(InvalidParameter, InvalidParameter.Message) +} + +//包裹异常,并用来输出堆栈日志 +//这里切记不要返回APIError,否则会出现问题(因为(ApiError)(nil)!=nil) + +func SystemError(err error) error { + if err == nil { + return nil + } + + var apiError *ApiError + if errors.As(err, &apiError) { + return ErrorWithMsg(apiError.Status, apiError.Message) + } + + return ErrorWithMsg(ServerBusy, err.Error()) +} diff --git a/config_server/v2/service/common/http_status.go b/config_server/v2/service/common/http_status.go new file mode 100644 index 0000000000..2d11c53316 --- /dev/null +++ b/config_server/v2/service/common/http_status.go @@ -0,0 +1,50 @@ +package common + +import ( + "errors" + "github.com/gin-gonic/gin" +) + +type HttpStatus struct { + Code int + Message string +} + +var ( + Accept = HttpStatus{200, "Accept"} + BadRequest = HttpStatus{400, "BadRequest"} + + AgentAlreadyExist = HttpStatus{400, "AgentAlreadyExist"} + AgentNotExist = HttpStatus{404, "AgentNotExist"} + + ConfigAlreadyExist = HttpStatus{400, "ConfigAlreadyExist"} + ConfigNotExist = HttpStatus{404, "ConfigNotExist"} + + AgentGroupAlreadyExist = HttpStatus{400, "AgentGroupAlreadyExist"} + AgentGroupNotExist = HttpStatus{404, "AgentGroupNotExist"} + + InvalidParameter = HttpStatus{400, "InvalidParameter"} + RequestTimeout = HttpStatus{500, "RequestTimeout"} + ServerBusy = HttpStatus{503, "ServerBusy"} +) + +func ErrorProtobufRes(c *gin.Context, res any, err error) { + c.ProtoBuf(ServerBusy.Code, res) +} + +func SuccessProtobufRes(c *gin.Context, res any) { + c.ProtoBuf(Accept.Code, res) +} + +func ProtobufRes(c *gin.Context, err error, res any) { + var apiError *ApiError + if err == nil { + c.ProtoBuf(Accept.Code, res) + return + } + if errors.As(err, &apiError) { + c.ProtoBuf(apiError.Status.Code, res) + return + } + c.ProtoBuf(ServerBusy.Code, res) +} diff --git a/config_server/v2/service/common/log.go b/config_server/v2/service/common/log.go new file mode 100644 index 0000000000..361779845a --- /dev/null +++ b/config_server/v2/service/common/log.go @@ -0,0 +1,11 @@ +package common + +import ( + "log" + "runtime" +) + +func PrintLog(code int, msg string, skip int) { + _, file, line, _ := runtime.Caller(skip) + log.Printf("[ERROR]: [%s:%d] Code:%d,Message:%s\n", file, line, code, msg) +} diff --git a/config_server/v2/service/common/result.go b/config_server/v2/service/common/result.go new file mode 100644 index 0000000000..4d2b5c66ba --- /dev/null +++ b/config_server/v2/service/common/result.go @@ -0,0 +1,26 @@ +package common + +import ( + proto "config-server/protov2" + "errors" +) + +func GenerateCommonResponse(err error) *proto.CommonResponse { + var apiError *ApiError + if err == nil { + return &proto.CommonResponse{ + Status: 0, + ErrorMessage: nil, + } + } + if errors.As(err, &apiError) { + return &proto.CommonResponse{ + Status: int32(apiError.Status.Code), + ErrorMessage: []byte(apiError.Status.Message), + } + } + return &proto.CommonResponse{ + Status: int32(ServerBusy.Code), + ErrorMessage: []byte(err.Error()), + } +} diff --git a/config_server/v2/service/config/gorm.go b/config_server/v2/service/config/gorm.go new file mode 100644 index 0000000000..3815622f3d --- /dev/null +++ b/config_server/v2/service/config/gorm.go @@ -0,0 +1,92 @@ +package config + +import ( + "config-server/common" + "config-server/utils" + "fmt" + "gorm.io/driver/mysql" + "gorm.io/driver/postgres" + "gorm.io/driver/sqlite" + "gorm.io/driver/sqlserver" + "gorm.io/gorm" + "path/filepath" +) + +type GormConfig struct { + Type string `json:"type"` + UserName string `json:"userName"` + Password string `json:"password"` + Host string `json:"host"` + Port int32 `json:"port"` + DbName string `json:"dbName"` + AutoMigrate bool `json:"autoMigrate"` +} + +var gormDialectMap = map[string]func(string) gorm.Dialector{ + "mysql": mysql.Open, + "sqlite": sqlite.Open, + "sqlserver": sqlserver.Open, + "postgres": postgres.Open, +} + +var config = new(GormConfig) + +func Connect2Db() (*GormConfig, gorm.Dialector, error) { + dsn := fmt.Sprintf("%s:%s@tcp(%s:%d)/?charset=utf8&parseTime=True&loc=Local", + config.UserName, + config.Password, + config.Host, + config.Port) + return getConnection(dsn) +} + +func Connect2SpecifiedDb() (*GormConfig, gorm.Dialector, error) { + dsn := fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8&parseTime=True&loc=Local", + config.UserName, + config.Password, + config.Host, + config.Port, + config.DbName) + return getConnection(dsn) +} + +func readDatabaseConfig() error { + var err error + envName, err := utils.GetEnvName() + if err != nil { + return err + } + databaseConfigPath, err := filepath.Abs(fmt.Sprintf("cmd/config/%s/databaseConfig.json", envName)) + if err != nil { + return err + } + err = utils.ReadJson(databaseConfigPath, config) + if err != nil { + return err + } + return err +} + +func getConnection(dsn string) (*GormConfig, gorm.Dialector, error) { + if dialect, ok := gormDialectMap[config.Type]; ok { + gormDialect := dialect(dsn) + if gormDialect == nil { + return nil, nil, common.ServerError("connect %s:%s dbName:%s failed", + config.Host, config.Port, config.DbName) + } + return config, dialect(dsn), nil + } + adapterDatabaseStr := "" + for adapterDatabase := range gormDialectMap { + adapterDatabaseStr += adapterDatabase + adapterDatabaseStr += "," + } + panic(fmt.Sprintf("no this database type in (%s)", adapterDatabaseStr[:len(adapterDatabaseStr)-1])) +} + +func init() { + err := readDatabaseConfig() + if err != nil { + panic(err) + } +} diff --git a/config_server/v2/service/config/server.go b/config_server/v2/service/config/server.go new file mode 100644 index 0000000000..1cfb5d51b0 --- /dev/null +++ b/config_server/v2/service/config/server.go @@ -0,0 +1,43 @@ +package config + +import ( + "config-server/common" + "config-server/utils" + "fmt" + "log" + "path/filepath" +) + +type ServerConfig struct { + Address string `json:"address"` + Capabilities map[string]bool `json:"capabilities"` + ResponseFlags map[string]bool `json:"responseFlags"` + TimeLimit int64 `json:"timeLimit"` +} + +var ServerConfigInstance = new(ServerConfig) + +func GetServerConfiguration() error { + var err error + envName, err := utils.GetEnvName() + if err != nil { + return err + } + serverConfigPath, err := filepath.Abs(fmt.Sprintf("cmd/config/%s/serverConfig.json", envName)) + if err != nil { + return common.SystemError(err) + } + err = utils.ReadJson(serverConfigPath, ServerConfigInstance) + if err != nil { + return common.SystemError(err) + } + log.Print("server config init...") + return nil +} + +func init() { + err := GetServerConfiguration() + if err != nil { + return + } +} diff --git a/config_server/v2/service/entity/agent.go b/config_server/v2/service/entity/agent.go new file mode 100644 index 0000000000..49ccd27742 --- /dev/null +++ b/config_server/v2/service/entity/agent.go @@ -0,0 +1,115 @@ +package entity + +import ( + proto "config-server/protov2" + "database/sql/driver" + "encoding/json" + "fmt" +) + +type AgentAttributes struct { + Version []byte + Ip []byte + Hostname []byte + Hostid []byte + Extras map[string][]byte +} + +func (a *AgentAttributes) Parse2Proto() *proto.AgentAttributes { + protoAgentAttributes := new(proto.AgentAttributes) + protoAgentAttributes.Version = a.Version + protoAgentAttributes.Ip = a.Ip + protoAgentAttributes.Hostname = a.Hostname + protoAgentAttributes.Hostid = a.Hostid + protoAgentAttributes.Extras = a.Extras + return protoAgentAttributes +} + +func ParseProtoAgentAttributes2AgentAttributes(attributes *proto.AgentAttributes) *AgentAttributes { + agentAttributes := new(AgentAttributes) + agentAttributes.Version = attributes.Version + agentAttributes.Ip = attributes.Ip + agentAttributes.Hostname = attributes.Hostname + agentAttributes.Hostid = attributes.Hostid + agentAttributes.Extras = attributes.Extras + return agentAttributes +} + +func (a *AgentAttributes) Scan(value any) error { + if value == nil { + return nil + } + + b, ok := value.([]byte) + if !ok { + return fmt.Errorf("value is not []byte, value: %v", value) + } + + return json.Unmarshal(b, a) +} + +func (a *AgentAttributes) Value() (driver.Value, error) { + v, err := json.Marshal(a) + if err != nil { + return nil, err + } + return v, nil +} + +// Preload should write the name of the structure associated field, not the name of the data table or the name of the associated model structure + +type Agent struct { + SequenceNum uint64 + Capabilities uint64 + InstanceId string `gorm:"primarykey"` + AgentType string + Attributes *AgentAttributes + Tags []*AgentGroup `gorm:"many2many:agent_and_agent_group;foreignKey:InstanceId;joinForeignKey:AgentInstanceId;References:Name;joinReferences:AgentGroupName;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` + RunningStatus string + StartupTime int64 + PipelineConfigStatuses PipelineConfigStatusList + InstanceConfigStatuses InstanceConfigStatusList + //CustomCommands []*CommandInfo + Flags uint64 + Opaque []byte + LastHeartBeatTime int64 +} + +func (a Agent) Parse2Proto() *proto.Agent { + protoAgent := new(proto.Agent) + protoAgent.Capabilities = a.Capabilities + protoAgent.InstanceId = []byte(a.InstanceId) + protoAgent.AgentType = a.AgentType + protoAgent.Attributes = a.Attributes.Parse2Proto() + protoAgent.RunningStatus = a.RunningStatus + protoAgent.StartupTime = a.StartupTime + //protoAgent.PipelineConfigs = a.PipelineConfigStatuses.Parse2ProtoConfigStatus() + //protoAgent.InstanceConfigs = a.InstanceConfigStatuses.Parse2ProtoConfigStatus() + return protoAgent +} + +// ParseHeartBeatRequest2BasicAgent transfer agent's basic info +func ParseHeartBeatRequest2BasicAgent(req *proto.HeartbeatRequest, lastHeartBeatTime int64) *Agent { + agent := new(Agent) + agent.SequenceNum = req.SequenceNum + agent.Capabilities = req.Capabilities + agent.InstanceId = string(req.InstanceId) + agent.AgentType = req.AgentType + + if req.Tags != nil { + for _, tag := range req.Tags { + agent.Tags = append(agent.Tags, ParseProtoAgentGroupTag2AgentGroup(tag)) + } + } + + agent.RunningStatus = req.RunningStatus + agent.StartupTime = req.StartupTime + agent.Flags = req.Flags + agent.Opaque = req.Opaque + agent.LastHeartBeatTime = lastHeartBeatTime + return agent +} + +func (Agent) TableName() string { + return agentTable +} diff --git a/config_server/v2/service/entity/agent_group.go b/config_server/v2/service/entity/agent_group.go new file mode 100644 index 0000000000..b54373639b --- /dev/null +++ b/config_server/v2/service/entity/agent_group.go @@ -0,0 +1,33 @@ +package entity + +import ( + proto "config-server/protov2" +) + +const AgentGroupDefaultValue = "default" + +type AgentGroup struct { + Name string `gorm:"primarykey;"` + Value string + Agents []*Agent `gorm:"many2many:agent_and_agent_group;foreignKey:Name;joinForeignKey:AgentGroupName;References:InstanceId;joinReferences:AgentInstanceId;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` + PipelineConfigs []*PipelineConfig `gorm:"many2many:agent_group_pipeline_config;foreignKey:Name;joinForeignKey:AgentGroupName;References:Name;joinReferences:PipelineConfigName;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` + InstanceConfigs []*InstanceConfig `gorm:"many2many:agent_group_instance_config;foreignKey:Name;joinForeignKey:AgentGroupName;References:Name;joinReferences:InstanceConfigName;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` +} + +func (AgentGroup) TableName() string { + return agentGroupTable +} + +func (a AgentGroup) Parse2ProtoAgentGroupTag() *proto.AgentGroupTag { + return &proto.AgentGroupTag{ + Name: a.Name, + Value: a.Value, + } +} + +func ParseProtoAgentGroupTag2AgentGroup(tag *proto.AgentGroupTag) *AgentGroup { + return &AgentGroup{ + Name: tag.Name, + Value: tag.Value, + } +} diff --git a/config_server/v2/service/entity/base.go b/config_server/v2/service/entity/base.go new file mode 100644 index 0000000000..5427e4e842 --- /dev/null +++ b/config_server/v2/service/entity/base.go @@ -0,0 +1,16 @@ +package entity + +const ( + agentTable = "agent" + agentGroupTable = "agent_group" + pipelineConfigTable = "pipeline_config" + instanceConfigTable = "instance_config" + commandInfoTable = "command_info" + //agentAndCommandTable = "agent_command" +) + +const ( + AgentAgentGroupTable = "agent_and_agent_group" + AgentGroupPipelineConfigTable = "agent_group_pipeline_config" + AgentGroupInstanceConfigTable = "agent_group_instance_config" +) diff --git a/config_server/v2/service/entity/command.go b/config_server/v2/service/entity/command.go new file mode 100644 index 0000000000..40f83537f2 --- /dev/null +++ b/config_server/v2/service/entity/command.go @@ -0,0 +1,16 @@ +package entity + +type ConfigStatus int32 + +type CommandInfo struct { + Type string + Name string `gorm:"primarykey"` + Status ConfigStatus // Command's status + Message string + Detail []byte + ExpireTime int64 +} + +func (CommandInfo) TableName() string { + return commandInfoTable +} diff --git a/config_server/v2/service/entity/instance_config.go b/config_server/v2/service/entity/instance_config.go new file mode 100644 index 0000000000..85d1ca0118 --- /dev/null +++ b/config_server/v2/service/entity/instance_config.go @@ -0,0 +1,96 @@ +package entity + +import ( + proto "config-server/protov2" + "database/sql/driver" + "encoding/json" + "errors" +) + +type InstanceConfig struct { + Name string `gorm:"primarykey"` + Version int64 + Detail []byte + AgentGroups []*AgentGroup `gorm:"many2many:agent_group_instance_config;foreignKey:Name;joinForeignKey:InstanceConfigName;References:Name;joinReferences:AgentGroupName;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` +} + +func (InstanceConfig) TableName() string { + return instanceConfigTable +} + +func (c InstanceConfig) Parse2ProtoInstanceConfigDetail(isContainDetail bool) *proto.ConfigDetail { + if isContainDetail { + return &proto.ConfigDetail{ + Name: c.Name, + Version: c.Version, + Detail: c.Detail, + } + } + return &proto.ConfigDetail{ + Name: c.Name, + Version: c.Version, + } +} + +func ParseProtoInstanceConfig2InstanceConfig(c *proto.ConfigDetail) *InstanceConfig { + return &InstanceConfig{ + Name: c.Name, + Version: c.Version, + Detail: c.Detail, + } +} + +type InstanceConfigStatus struct { + Name string + Version int64 + Status ConfigStatus + Message string +} + +func ParseProtoInstanceConfigStatus2InstanceConfigStatus(c *proto.ConfigInfo) *InstanceConfigStatus { + return &InstanceConfigStatus{ + Name: c.Name, + Version: c.Version, + Status: ConfigStatus(c.Status), + Message: c.Message, + } +} + +func (i InstanceConfigStatus) Parse2ProtoConfigInfo() *proto.ConfigInfo { + return &proto.ConfigInfo{ + Name: i.Name, + Version: i.Version, + Status: proto.ConfigStatus(i.Status), + Message: i.Message, + } +} + +type InstanceConfigStatusList []*InstanceConfigStatus + +func (i InstanceConfigStatusList) Parse2ProtoConfigStatus() []*proto.ConfigInfo { + protoConfigInfos := make([]*proto.ConfigInfo, 0) + for _, status := range i { + protoConfigInfos = append(protoConfigInfos, status.Parse2ProtoConfigInfo()) + } + return protoConfigInfos +} + +func ParseInstanceConfigStatusList2Proto(configInfos []*proto.ConfigInfo) InstanceConfigStatusList { + res := make(InstanceConfigStatusList, 0) + for _, configInfo := range configInfos { + res = append(res, ParseProtoInstanceConfigStatus2InstanceConfigStatus(configInfo)) + } + return res +} + +func (i InstanceConfigStatusList) Value() (driver.Value, error) { + return json.Marshal(i) +} + +func (i *InstanceConfigStatusList) Scan(value any) error { + bytes, ok := value.([]byte) + if !ok { + return errors.New("type assertion to []byte failed") + } + return json.Unmarshal(bytes, i) +} diff --git a/config_server/v2/service/entity/pipeline_config.go b/config_server/v2/service/entity/pipeline_config.go new file mode 100644 index 0000000000..e1cd36cd9d --- /dev/null +++ b/config_server/v2/service/entity/pipeline_config.go @@ -0,0 +1,96 @@ +package entity + +import ( + proto "config-server/protov2" + "database/sql/driver" + "encoding/json" + "errors" +) + +type PipelineConfig struct { + Name string `gorm:"primarykey"` + Version int64 + Detail []byte + AgentGroups []*AgentGroup `gorm:"many2many:agent_group_pipeline_config;foreignKey:Name;joinForeignKey:PipelineConfigName;References:Name;joinReferences:AgentGroupName;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` +} + +func (PipelineConfig) TableName() string { + return pipelineConfigTable +} + +func (c PipelineConfig) Parse2ProtoPipelineConfigDetail(isContainDetail bool) *proto.ConfigDetail { + if isContainDetail { + return &proto.ConfigDetail{ + Name: c.Name, + Version: c.Version, + Detail: c.Detail, + } + } + return &proto.ConfigDetail{ + Name: c.Name, + Version: c.Version, + } +} + +func ParseProtoPipelineConfig2PipelineConfig(c *proto.ConfigDetail) *PipelineConfig { + return &PipelineConfig{ + Name: c.Name, + Version: c.Version, + Detail: c.Detail, + } +} + +type PipelineConfigStatus struct { + Name string + Version int64 + Status ConfigStatus + Message string +} + +func ParseProtoPipelineConfigStatus2PipelineConfigStatus(c *proto.ConfigInfo) *PipelineConfigStatus { + return &PipelineConfigStatus{ + Name: c.Name, + Version: c.Version, + Status: ConfigStatus(c.Status), + Message: c.Message, + } +} + +func (p PipelineConfigStatus) Parse2ProtoConfigInfo() *proto.ConfigInfo { + return &proto.ConfigInfo{ + Name: p.Name, + Version: p.Version, + Status: proto.ConfigStatus(p.Status), + Message: p.Message, + } +} + +type PipelineConfigStatusList []*PipelineConfigStatus + +func (p PipelineConfigStatusList) Parse2ProtoConfigStatus() []*proto.ConfigInfo { + protoConfigInfos := make([]*proto.ConfigInfo, 0) + for _, status := range p { + protoConfigInfos = append(protoConfigInfos, status.Parse2ProtoConfigInfo()) + } + return protoConfigInfos +} + +func ParsePipelineConfigStatusList2Proto(configInfos []*proto.ConfigInfo) PipelineConfigStatusList { + res := make(PipelineConfigStatusList, 0) + for _, configInfo := range configInfos { + res = append(res, ParseProtoPipelineConfigStatus2PipelineConfigStatus(configInfo)) + } + return res +} + +func (p PipelineConfigStatusList) Value() (driver.Value, error) { + return json.Marshal(p) +} + +func (p *PipelineConfigStatusList) Scan(value any) error { + bytes, ok := value.([]byte) + if !ok { + return errors.New("type assertion to []byte failed") + } + return json.Unmarshal(bytes, p) +} diff --git a/config_server/v2/service/go.mod b/config_server/v2/service/go.mod new file mode 100644 index 0000000000..2acef0363a --- /dev/null +++ b/config_server/v2/service/go.mod @@ -0,0 +1,59 @@ +module config-server + +go 1.19 + +require ( + github.com/gin-gonic/gin v1.10.0 + github.com/smartystreets/goconvey v1.8.1 + google.golang.org/protobuf v1.34.2 + gorm.io/driver/mysql v1.5.7 + gorm.io/driver/postgres v1.5.9 + gorm.io/driver/sqlite v1.5.6 + gorm.io/driver/sqlserver v1.5.3 + gorm.io/gorm v1.25.11 +) + +require ( + github.com/bytedance/sonic v1.11.6 // indirect + github.com/bytedance/sonic/loader v0.1.1 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.20.0 // indirect + github.com/go-sql-driver/mysql v1.7.0 // indirect + github.com/goccy/go-json v0.10.2 // indirect + github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect + github.com/golang-sql/sqlexp v0.1.0 // indirect + github.com/gopherjs/gopherjs v1.17.2 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/pgx/v5 v5.5.5 // indirect + github.com/jackc/puddle/v2 v2.2.1 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/jtolds/gls v4.20.0+incompatible // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/leodido/go-urn v1.4.0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-sqlite3 v1.14.22 // indirect + github.com/microsoft/go-mssqldb v1.6.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/smarty/assertions v1.15.0 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect + golang.org/x/arch v0.8.0 // indirect + golang.org/x/crypto v0.23.0 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sync v0.1.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/config_server/v2/service/go.sum b/config_server/v2/service/go.sum new file mode 100644 index 0000000000..648bbf6187 --- /dev/null +++ b/config_server/v2/service/go.sum @@ -0,0 +1,235 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1 h1:/iHxaJhsFr0+xVFfbMr5vxz848jyiWuIEDhYq3y5odY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.0 h1:yfJe15aSwEQ6Oo6J+gdfdulPNoZ3TEhmbhLIoxZcA+U= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.0/go.mod h1:Q28U+75mpCaSCDowNEmhIo/rmgdkqmkmzI7N6TGR4UY= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v0.8.0 h1:T028gtTPiYt/RMUfs8nVsAL7FDQrfLlrm/NnRG/zcC4= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v0.8.0/go.mod h1:cw4zVQgBby0Z5f2v0itn6se2dDP17nTjbZFXW5uPyHA= +github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/AzureAD/microsoft-authentication-library-for-go v1.1.0 h1:HCc0+LpPfpCKs6LGGLAhwBARt9632unrVcI6i8s/8os= +github.com/AzureAD/microsoft-authentication-library-for-go v1.1.0/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= +github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= +github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= +github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= +github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= +github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= +github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= +github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= +github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= +github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g= +github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.5.5 h1:amBjrZVmksIdNjxGW/IiIMzxMKZFelXbUoPNb+8sjQw= +github.com/jackc/pgx/v5 v5.5.5/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A= +github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= +github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= +github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= +github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nDd82IeqRo= +github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= +github.com/jcmturner/gokrb5/v8 v8.4.4/go.mod h1:1btQEpgT6k+unzCwX1KdWMEwPPkkgBtP+F6aCACiMrs= +github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= +github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/microsoft/go-mssqldb v1.6.0 h1:mM3gYdVwEPFrlg/Dvr2DNVEgYFG7L42l+dGc67NNNpc= +github.com/microsoft/go-mssqldb v1.6.0/go.mod h1:00mDtPbeQCRGC1HwOOR5K/gr30P1NcEG0vx6Kbv2aJU= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/montanaflynn/stats v0.7.0/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/smarty/assertions v1.15.0 h1:cR//PqUBUiQRakZWqBiFFQ9wb8emQGDb0HeGdqGByCY= +github.com/smarty/assertions v1.15.0/go.mod h1:yABtdzeQs6l1brC900WlRNwj6ZR55d7B+E8C6HtKdec= +github.com/smartystreets/goconvey v1.8.1 h1:qGjIddxOk4grTu9JPOU31tVfq3cNdBlNa5sSznIX1xY= +github.com/smartystreets/goconvey v1.8.1/go.mod h1:+/u4qLyY6x1jReYOp7GOM2FSt8aP9CzCZL03bI28W60= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= +golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo= +gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= +gorm.io/driver/postgres v1.5.9 h1:DkegyItji119OlcaLjqN11kHoUgZ/j13E0jkJZgD6A8= +gorm.io/driver/postgres v1.5.9/go.mod h1:DX3GReXH+3FPWGrrgffdvCk3DQ1dwDPdmbenSkweRGI= +gorm.io/driver/sqlite v1.5.6 h1:fO/X46qn5NUEEOZtnjJRWRzZMe8nqJiQ9E+0hi+hKQE= +gorm.io/driver/sqlite v1.5.6/go.mod h1:U+J8craQU6Fzkcvu8oLeAQmi50TkwPEhHDEjQZXDah4= +gorm.io/driver/sqlserver v1.5.3 h1:rjupPS4PVw+rjJkfvr8jn2lJ8BMhT4UW5FwuJY0P3Z0= +gorm.io/driver/sqlserver v1.5.3/go.mod h1:B+CZ0/7oFJ6tAlefsKoyxdgDCXJKSgwS2bMOQZT0I00= +gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +gorm.io/gorm v1.25.11 h1:/Wfyg1B/je1hnDx3sMkX+gAlxrlZpn6X0BXRlwXlvHg= +gorm.io/gorm v1.25.11/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/config_server/v2/service/handler/agent.go b/config_server/v2/service/handler/agent.go new file mode 100644 index 0000000000..bd769c9da8 --- /dev/null +++ b/config_server/v2/service/handler/agent.go @@ -0,0 +1,17 @@ +package handler + +import ( + "config-server/config" + "config-server/service" +) + +func CheckAgentExist() { + go service.CheckAgentExist(config.ServerConfigInstance.TimeLimit) +} + +var ( + HeartBeat = ProtobufHandler(service.HeartBeat) + FetchPipelineConfig = ProtobufHandler(service.FetchPipelineConfigDetail) + FetchInstanceConfig = ProtobufHandler(service.FetchInstanceConfigDetail) + ListAgentsInGroup = ProtobufHandler(service.ListAgentsInGroup) +) diff --git a/config_server/v2/service/handler/agent_group.go b/config_server/v2/service/handler/agent_group.go new file mode 100644 index 0000000000..15637b7640 --- /dev/null +++ b/config_server/v2/service/handler/agent_group.go @@ -0,0 +1,15 @@ +package handler + +import ( + "config-server/service" +) + +var ( + CreateAgentGroup = ProtobufHandler(service.CreateAgentGroup) + UpdateAgentGroup = ProtobufHandler(service.UpdateAgentGroup) + DeleteAgentGroup = ProtobufHandler(service.DeleteAgentGroup) + GetAgentGroup = ProtobufHandler(service.GetAgentGroup) + ListAgentGroups = ProtobufHandler(service.ListAgentGroups) + GetAppliedPipelineConfigsForAgentGroup = ProtobufHandler(service.GetAppliedPipelineConfigsForAgentGroup) + GetAppliedInstanceConfigsForAgentGroup = ProtobufHandler(service.GetAppliedInstanceConfigsForAgentGroup) +) diff --git a/config_server/v2/service/handler/common.go b/config_server/v2/service/handler/common.go new file mode 100644 index 0000000000..b1bd0da167 --- /dev/null +++ b/config_server/v2/service/handler/common.go @@ -0,0 +1,62 @@ +package handler + +import ( + "config-server/common" + "github.com/gin-gonic/gin" + "github.com/gin-gonic/gin/binding" + "log" + "reflect" + "strings" +) + +type ProtobufFunc[T, R any] func(request *T, response *R) error + +func ProtobufHandler[T, R any](handler ProtobufFunc[T, R]) gin.HandlerFunc { + return func(c *gin.Context) { + var err error + request := new(T) + response := new(R) + + defer func() { + responseCommon := common.GenerateCommonResponse(err) + reflect.ValueOf(response).Elem().FieldByName("CommonResponse").Set(reflect.ValueOf(responseCommon)) + common.ProtobufRes(c, err, response) + }() + err = c.ShouldBindBodyWith(request, binding.ProtoBuf) + + requestId := reflect.ValueOf(request).Elem().FieldByName("RequestId").Bytes() + reflect.ValueOf(response).Elem().FieldByName("RequestId").Set(reflect.ValueOf(requestId)) + if requestId == nil { + err = common.ValidateErrorWithMsg("required fields requestId could not be null") + return + } + + if err != nil { + err = common.SystemError(err) + return + } + + //err = (RequestLogger(c.Request.URL.String(), handler))(request, response) + err = (handler)(request, response) + if err != nil { + err = common.SystemError(err) + return + } + } +} + +func RequestLogger[T any, R any](url string, handler ProtobufFunc[T, R]) ProtobufFunc[T, R] { + return func(req *T, res *R) error { + if strings.Contains(url, "Heart") { + log.Printf("%s REQUEST:%+v", url, req) + } + err := handler(req, res) + if err != nil { + return common.SystemError(err) + } + if strings.Contains(url, "Heart") { + log.Printf("%s RESPONSE:%+v", url, res) + } + return nil + } +} diff --git a/config_server/v2/service/handler/instance_config.go b/config_server/v2/service/handler/instance_config.go new file mode 100644 index 0000000000..7d6fc784e3 --- /dev/null +++ b/config_server/v2/service/handler/instance_config.go @@ -0,0 +1,17 @@ +package handler + +import ( + "config-server/service" +) + +var ( + CreateInstanceConfig = ProtobufHandler(service.CreateInstanceConfig) + UpdateInstanceConfig = ProtobufHandler(service.UpdateInstanceConfig) + DeleteInstanceConfig = ProtobufHandler(service.DeleteInstanceConfig) + GetInstanceConfig = ProtobufHandler(service.GetInstanceConfig) + ListInstanceConfigs = ProtobufHandler(service.ListInstanceConfigs) + ApplyInstanceConfigToAgentGroup = ProtobufHandler(service.ApplyInstanceConfigToAgentGroup) + RemoveInstanceConfigFromAgentGroup = ProtobufHandler(service.RemoveInstanceConfigFromAgentGroup) + GetAppliedAgentGroupsWithInstanceConfig = ProtobufHandler(service.GetAppliedAgentGroupsForInstanceConfigName) + GetInstanceConfigStatusList = ProtobufHandler(service.GetInstanceConfigStatusList) +) diff --git a/config_server/v2/service/handler/pipeline_config.go b/config_server/v2/service/handler/pipeline_config.go new file mode 100644 index 0000000000..e922613421 --- /dev/null +++ b/config_server/v2/service/handler/pipeline_config.go @@ -0,0 +1,17 @@ +package handler + +import ( + "config-server/service" +) + +var ( + CreatePipelineConfig = ProtobufHandler(service.CreatePipelineConfig) + UpdatePipelineConfig = ProtobufHandler(service.UpdatePipelineConfig) + DeletePipelineConfig = ProtobufHandler(service.DeletePipelineConfig) + GetPipelineConfig = ProtobufHandler(service.GetPipelineConfig) + ListPipelineConfigs = ProtobufHandler(service.ListPipelineConfigs) + ApplyPipelineConfigToAgentGroup = ProtobufHandler(service.ApplyPipelineConfigToAgentGroup) + RemovePipelineConfigFromAgentGroup = ProtobufHandler(service.RemovePipelineConfigFromAgentGroup) + GetAppliedAgentGroupsWithPipelineConfig = ProtobufHandler(service.GetAppliedAgentGroupsForPipelineConfigName) + GetPipelineConfigStatusList = ProtobufHandler(service.GetPipelineConfigStatusList) +) diff --git a/config_server/v2/service/manager/agent.go b/config_server/v2/service/manager/agent.go new file mode 100644 index 0000000000..92cd111c3a --- /dev/null +++ b/config_server/v2/service/manager/agent.go @@ -0,0 +1,42 @@ +package manager + +import ( + "config-server/entity" + "config-server/repository" + "log" + "time" +) + +func JudgeSequenceNumRationality(instanceId string, sequenceNum uint64) bool { + //最开始的心跳检测sequenceNum=0,所以sequenceNum=0是合法的 + agent, err := repository.GetAgentByID(instanceId) + //找不到数据的时候,同样说明是最开始的状态,应返回true + if err != nil { + return true + } + if sequenceNum != agent.SequenceNum+1 { + return false + } + return true +} + +func CreateOrUpdateAgentBasicInfo(agent *entity.Agent) error { + conflictColumnNames := []string{"instance_id"} + return repository.CreateOrUpdateAgentBasicInfo(conflictColumnNames, agent) +} + +func GetAllAgentsBasicInfo() []entity.Agent { + return repository.GetAllAgents(false, false) +} + +func RemoveAgentNow(agentInfo *entity.Agent, timeLimitNano int64) { + nowTime := time.Now().UnixNano() + if nowTime-agentInfo.LastHeartBeatTime >= timeLimitNano { + err := repository.RemoveAgentById(agentInfo.InstanceId) + if err != nil { + log.Printf("remove agent (id=%s) error %s", agentInfo.InstanceId, err) + } else { + log.Printf("remove agent (id=%s) success", agentInfo.InstanceId) + } + } +} diff --git a/config_server/v2/service/manager/agent_group.go b/config_server/v2/service/manager/agent_group.go new file mode 100644 index 0000000000..a0393deae6 --- /dev/null +++ b/config_server/v2/service/manager/agent_group.go @@ -0,0 +1,16 @@ +package manager + +import ( + "config-server/entity" + proto "config-server/protov2" +) + +func AddDefaultAgentGroup(agentTags []*proto.AgentGroupTag) []*proto.AgentGroupTag { + if agentTags == nil || len(agentTags) == 0 { + agentTags = append(agentTags, &proto.AgentGroupTag{ + Name: entity.AgentGroupDefaultValue, + Value: entity.AgentGroupDefaultValue, + }) + } + return agentTags +} diff --git a/config_server/v2/service/manager/instance_config.go b/config_server/v2/service/manager/instance_config.go new file mode 100644 index 0000000000..0c3bd68e45 --- /dev/null +++ b/config_server/v2/service/manager/instance_config.go @@ -0,0 +1,56 @@ +package manager + +import ( + "config-server/common" + "config-server/entity" + proto "config-server/protov2" + "config-server/repository" + "config-server/utils" +) + +func SaveInstanceConfigStatus(configs []*proto.ConfigInfo, instanceId string) error { + if configs == nil { + return nil + } + agent := &entity.Agent{ + InstanceId: instanceId, + } + for _, instanceConfig := range configs { + agent.InstanceConfigStatuses = + append(agent.InstanceConfigStatuses, entity.ParseProtoInstanceConfigStatus2InstanceConfigStatus(instanceConfig)) + } + + err := repository.UpdateAgentById(agent, "instance_config_statuses") + return common.SystemError(err) +} + +func GetInstanceConfigs(instanceId string, configInfos []*proto.ConfigInfo, isContainDetail bool) ([]*proto.ConfigDetail, error) { + var err error + agent := &entity.Agent{InstanceId: instanceId} + err = repository.GetInstanceConfigsByAgent(agent) + if err != nil { + return nil, err + } + + configUpdates := make([]*entity.InstanceConfig, 0) + configEqFunc := func(a *entity.InstanceConfig, b *entity.InstanceConfig) bool { + return a.Name == b.Name + } + configInfoEqFunc := func(a *proto.ConfigInfo, b *entity.InstanceConfig) bool { + return a.Name == b.Name && a.Version == b.Version + } + + for _, tag := range agent.Tags { + for _, config := range tag.InstanceConfigs { + //存在某些组里有重复配置的情况,需进行剔除;配置没更新(即版本没变化的)也无需加入数组 + if !utils.ContainElement(configInfos, config, configInfoEqFunc) && + !utils.ContainElement(configUpdates, config, configEqFunc) { + configUpdates = append(configUpdates, config) + } + } + } + + return utils.Map(configUpdates, func(config *entity.InstanceConfig) *proto.ConfigDetail { + return (*config).Parse2ProtoInstanceConfigDetail(isContainDetail) + }), nil +} diff --git a/config_server/v2/service/manager/pipeline_config.go b/config_server/v2/service/manager/pipeline_config.go new file mode 100644 index 0000000000..cd0d703f9e --- /dev/null +++ b/config_server/v2/service/manager/pipeline_config.go @@ -0,0 +1,58 @@ +package manager + +import ( + "config-server/common" + "config-server/entity" + proto "config-server/protov2" + "config-server/repository" + "config-server/utils" +) + +func SavePipelineConfigStatus(configs []*proto.ConfigInfo, instanceId string) error { + if configs == nil { + return nil + } + agent := &entity.Agent{ + InstanceId: instanceId, + } + for _, pipelineConfig := range configs { + agent.PipelineConfigStatuses = + append(agent.PipelineConfigStatuses, entity.ParseProtoPipelineConfigStatus2PipelineConfigStatus(pipelineConfig)) + } + + err := repository.UpdateAgentById(agent, "pipeline_config_statuses") + return common.SystemError(err) +} + +//configNames:需要的config ;instanceId:用于查询agent在哪些group中,最终查询它拥有的config + +func GetPipelineConfigs(instanceId string, configInfos []*proto.ConfigInfo, isContainDetail bool) ([]*proto.ConfigDetail, error) { + var err error + agent := &entity.Agent{InstanceId: instanceId} + err = repository.GetPipelineConfigsByAgent(agent) + if err != nil { + return nil, err + } + + configUpdates := make([]*entity.PipelineConfig, 0) + configEqFunc := func(a *entity.PipelineConfig, b *entity.PipelineConfig) bool { + return a.Name == b.Name + } + configInfoEqFunc := func(a *proto.ConfigInfo, b *entity.PipelineConfig) bool { + return a.Name == b.Name && a.Version == b.Version + } + + for _, tag := range agent.Tags { + for _, config := range tag.PipelineConfigs { + //存在某些组里有重复配置的情况,需进行剔除;配置没更新(即版本没变化的)也无需加入数组 + if !utils.ContainElement(configInfos, config, configInfoEqFunc) && + !utils.ContainElement(configUpdates, config, configEqFunc) { + configUpdates = append(configUpdates, config) + } + } + } + + return utils.Map(configUpdates, func(config *entity.PipelineConfig) *proto.ConfigDetail { + return (*config).Parse2ProtoPipelineConfigDetail(isContainDetail) + }), nil +} diff --git a/config_server/v2/service/manager/state/agent.go b/config_server/v2/service/manager/state/agent.go new file mode 100644 index 0000000000..20b5e92525 --- /dev/null +++ b/config_server/v2/service/manager/state/agent.go @@ -0,0 +1,98 @@ +package state + +import ( + "config-server/common" + proto "config-server/protov2" + "log" +) + +type AgentAction struct { + Base + Run func(*proto.HeartbeatRequest, *proto.HeartbeatResponse) error +} + +var ( + AgentUnSpecified = Base{Code: 0, Value: "unspecified"} + AcceptsPipelineConfig = Base{Code: 1, Value: "acceptsPipelineConfig"} + AcceptsInstanceConfig = Base{Code: 2, Value: "acceptsInstanceConfig"} + AcceptsCustomCommand = Base{Code: 4, Value: "acceptsCustomCommand"} +) + +var agentActionList = []*AgentAction{ + { + Base: AgentUnSpecified, + Run: UnspecifiedRun, + }, + { + Base: AcceptsPipelineConfig, + Run: AcceptsPipelineConfigRun, + }, + { + Base: AcceptsInstanceConfig, + Run: AcceptsInstanceConfigRun, + }, + { + Base: AcceptsCustomCommand, + Run: AcceptsCustomCommandRun, + }, +} + +//agent有接收某种配置的能力,则响应中设置对应的配置 + +func UnspecifiedRun(*proto.HeartbeatRequest, *proto.HeartbeatResponse) error { + return nil +} + +// AcceptsPipelineConfigRun 返回PipelineConfigDetail +func AcceptsPipelineConfigRun(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + // 心跳检测中返回config + err := UnspecifiedResponseAction.Run(req, res) + if err != nil { + return common.SystemError(err) + } + + //不在心跳检测中返回,需要额外请求 + err = FetchPipelineConfigDetailResponseAction.Run(req, res) + if err != nil { + return common.SystemError(err) + } + return nil +} + +// AcceptsInstanceConfigRun 返回InstanceConfigDetail +func AcceptsInstanceConfigRun(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + // 在心跳检测就返回config + err := UnspecifiedResponseAction.Run(req, res) + if err != nil { + return common.SystemError(err) + } + + err = FetchInstanceConfigDetailResponseAction.Run(req, res) + if err != nil { + return common.SystemError(err) + } + return nil +} + +func AcceptsCustomCommandRun(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + log.Print("command capability action Run ...") + return nil +} + +func HandleAgentCapabilities(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + err := HandleResponseFlags(res) + if err != nil { + return common.SystemError(err) + } + + for _, action := range agentActionList { + code := action.Code + if int(req.Capabilities)&code == code { + err := action.Run(req, res) + if err != nil { + return common.SystemError(err) + } + } + } + return nil +} diff --git a/config_server/v2/service/manager/state/common.go b/config_server/v2/service/manager/state/common.go new file mode 100644 index 0000000000..073f4def24 --- /dev/null +++ b/config_server/v2/service/manager/state/common.go @@ -0,0 +1,6 @@ +package state + +type Base struct { + Code int + Value string +} diff --git a/config_server/v2/service/manager/state/request.go b/config_server/v2/service/manager/state/request.go new file mode 100644 index 0000000000..9c71927eab --- /dev/null +++ b/config_server/v2/service/manager/state/request.go @@ -0,0 +1,63 @@ +package state + +import ( + "config-server/common" + proto "config-server/protov2" +) + +type RequestAction struct { + Base + Run func(*proto.HeartbeatRequest, *proto.HeartbeatResponse) error +} + +var ( + RequestUnspecified = Base{0, "unspecified"} + RequestReportFullState = Base{1, "reportFullState"} +) + +var requestActionList = []*RequestAction{ + { + Base: RequestUnspecified, + Run: RequestUnspecifiedRun, + }, + { + Base: RequestReportFullState, + Run: RequestReportFullStateRun, + }, +} + +// RequestUnspecifiedRun agent上报简单信息 +func RequestUnspecifiedRun(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + //todo agent的flag一点用都没有啊,上传全量信息的时候也置为0 + return RequestReportFullStateRun(req, res) + //return nil +} + +// RequestReportFullStateRun agent上传全量信息 +func RequestReportFullStateRun(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + for _, action := range ServerActionList { + err := action.Action(req, res) + if err != nil { + return common.SystemError(err) + } + } + return nil +} + +func HandleRequestFlags(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + err := HandleServerCapabilities(res) + if err != nil { + return common.SystemError(err) + } + + for _, action := range requestActionList { + code := action.Code + if int(req.Flags)&code == code { + err := action.Run(req, res) + if err != nil { + return common.SystemError(err) + } + } + } + return nil +} diff --git a/config_server/v2/service/manager/state/response.go b/config_server/v2/service/manager/state/response.go new file mode 100644 index 0000000000..118a4787a7 --- /dev/null +++ b/config_server/v2/service/manager/state/response.go @@ -0,0 +1,142 @@ +package state + +import ( + "config-server/common" + "config-server/config" + "config-server/manager" + proto "config-server/protov2" +) + +type ResponseAction struct { + Base + Run func(*proto.HeartbeatRequest, *proto.HeartbeatResponse) error +} + +func (r ResponseAction) UpdateFlags(res *proto.HeartbeatResponse) error { + responseFlagType := r.Value + hasResponseFlag := config.ServerConfigInstance.ResponseFlags[responseFlagType] + + if hasResponseFlag { + res.Flags = res.Flags | uint64(r.Code) + } + return nil +} + +var ( + Unspecified = Base{0, "unspecified"} + ReportFullState = Base{1, "reportFullState"} + FetchPipelineConfigDetail = Base{2, "fetchPipelineConfigDetail"} + FetchInstanceConfigDetail = Base{4, "fetchInstanceConfigDetail"} +) + +var ( + UnspecifiedResponseAction = new(ResponseAction) + ReportFullStateResponseAction = new(ResponseAction) + FetchPipelineConfigDetailResponseAction = new(ResponseAction) + FetchInstanceConfigDetailResponseAction = new(ResponseAction) +) + +func init() { + UnspecifiedResponseAction.Base = Unspecified + UnspecifiedResponseAction.Run = ResponseUnspecifiedRun + + ReportFullStateResponseAction.Base = ReportFullState + ReportFullStateResponseAction.Run = ResponseReportFullStateRun + + FetchPipelineConfigDetailResponseAction.Base = FetchPipelineConfigDetail + FetchPipelineConfigDetailResponseAction.Run = FetchPipelineConfigDetailRun + + FetchInstanceConfigDetailResponseAction.Base = FetchInstanceConfigDetail + FetchInstanceConfigDetailResponseAction.Run = FetchInstanceConfigDetailRun +} + +var ResponseList = []*ResponseAction{ + { + Base: Unspecified, + Run: ResponseUnspecifiedRun, + }, + { + Base: ReportFullState, + Run: ResponseReportFullStateRun, + }, + { + Base: FetchPipelineConfigDetail, + Run: FetchPipelineConfigDetailRun, + }, + { + Base: FetchInstanceConfigDetail, + Run: FetchInstanceConfigDetailRun, + }, +} + +func ResponseUnspecifiedRun(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + fetchPipelineConfigKey := FetchPipelineConfigDetailResponseAction.Value + needFetchPipelineConfig := config.ServerConfigInstance.ResponseFlags[fetchPipelineConfigKey] + if !needFetchPipelineConfig { + strInstanceId := string(req.InstanceId) + + pipelineConfigUpdates, err := manager.GetPipelineConfigs(strInstanceId, req.PipelineConfigs, true) + if err != nil { + return common.SystemError(err) + } + res.PipelineConfigUpdates = pipelineConfigUpdates + } + + fetchInstanceConfigKey := FetchInstanceConfigDetailResponseAction.Value + needFetchInstanceConfig := config.ServerConfigInstance.ResponseFlags[fetchInstanceConfigKey] + if !needFetchInstanceConfig { + strInstanceId := string(req.InstanceId) + + instanceConfigUpdates, err := manager.GetInstanceConfigs(strInstanceId, req.InstanceConfigs, true) + if err != nil { + return common.SystemError(err) + } + res.InstanceConfigUpdates = instanceConfigUpdates + } + return nil +} + +func ResponseReportFullStateRun(*proto.HeartbeatRequest, *proto.HeartbeatResponse) error { + return nil +} + +// FetchPipelineConfigDetailRun 要求agent做的事情,比如配置不发送pipelineConfig的Detail, +// 这里就要求它主动请求FetchPipelineConfig接口(只需改变res.flags并且configUpdate不包含detail) +func FetchPipelineConfigDetailRun(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + key := FetchPipelineConfigDetailResponseAction.Value + needFetchConfig := config.ServerConfigInstance.ResponseFlags[key] + if needFetchConfig { + strInstanceId := string(req.InstanceId) + pipelineConfigUpdates, err := manager.GetPipelineConfigs(strInstanceId, req.PipelineConfigs, false) + if err != nil { + return common.SystemError(err) + } + res.PipelineConfigUpdates = pipelineConfigUpdates + } + return nil +} + +func FetchInstanceConfigDetailRun(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + key := FetchInstanceConfigDetailResponseAction.Value + needFetchConfig := config.ServerConfigInstance.ResponseFlags[key] + if needFetchConfig { + strInstanceId := string(req.InstanceId) + + instanceConfigUpdates, err := manager.GetInstanceConfigs(strInstanceId, req.InstanceConfigs, false) + if err != nil { + return common.SystemError(err) + } + res.InstanceConfigUpdates = instanceConfigUpdates + } + return nil +} + +func HandleResponseFlags(res *proto.HeartbeatResponse) error { + for _, flag := range ResponseList { + err := flag.UpdateFlags(res) + if err != nil { + return common.SystemError(err) + } + } + return nil +} diff --git a/config_server/v2/service/manager/state/server.go b/config_server/v2/service/manager/state/server.go new file mode 100644 index 0000000000..c9459037e5 --- /dev/null +++ b/config_server/v2/service/manager/state/server.go @@ -0,0 +1,118 @@ +package state + +import ( + "config-server/common" + "config-server/config" + "config-server/entity" + "config-server/manager" + proto "config-server/protov2" + "config-server/repository" +) + +type ServerAction struct { + Base + Run func(*proto.HeartbeatRequest, *proto.HeartbeatResponse) error +} + +func (a ServerAction) Action(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + serverCapabilityType := a.Value + hasServerCapability := config.ServerConfigInstance.Capabilities[serverCapabilityType] + + if hasServerCapability { + err := a.Run(req, res) + return common.SystemError(err) + } + return nil +} + +func (a ServerAction) UpdateCapabilities(res *proto.HeartbeatResponse) error { + serverCapabilityType := a.Value + hasServerCapability := config.ServerConfigInstance.Capabilities[serverCapabilityType] + + if hasServerCapability { + res.Capabilities = res.Capabilities | uint64(a.Code) + } + return nil +} + +var ( + ServerUnspecified = Base{Code: 0, Value: "unspecified"} + RememberAttribute = Base{Code: 1, Value: "rememberAttribute"} + RememberPipelineConfigStatus = Base{Code: 2, Value: "rememberPipelineConfigStatus"} + RememberInstanceConfigStatus = Base{Code: 4, Value: "rememberInstanceConfigStatus"} + RememberCustomCommandStatus = Base{Code: 8, Value: "rememberCustomCommandStatus"} +) + +var ServerActionList = []*ServerAction{ + { + Base: ServerUnspecified, + Run: UnspecifiedServerCapabilityRun, + }, + { + Base: RememberAttribute, + Run: RememberAttributeCapabilityRun, + }, + { + Base: RememberPipelineConfigStatus, + Run: RememberPipelineConfigStatusCapabilityRun, + }, + { + Base: RememberInstanceConfigStatus, + Run: RememberInstanceConfigStatusCapabilityRun, + }, + { + Base: RememberCustomCommandStatus, + Run: RememberCustomCommandStatusRun, + }, +} + +func UnspecifiedServerCapabilityRun(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + return nil +} + +func RememberAttributeCapabilityRun(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + attributes := req.Attributes + if attributes == nil { + return nil + } + agent := &entity.Agent{ + InstanceId: string(req.InstanceId), + } + agent.Attributes = entity.ParseProtoAgentAttributes2AgentAttributes(attributes) + err := repository.UpdateAgentById(agent, "attributes") + return common.SystemError(err) +} + +func RememberPipelineConfigStatusCapabilityRun(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + configs := req.PipelineConfigs + if configs == nil { + return nil + } + + err := manager.SavePipelineConfigStatus(configs, string(req.InstanceId)) + return common.SystemError(err) +} + +func RememberInstanceConfigStatusCapabilityRun(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + configs := req.InstanceConfigs + if configs == nil { + return nil + } + + err := manager.SaveInstanceConfigStatus(configs, string(req.InstanceId)) + return common.SystemError(err) +} + +func RememberCustomCommandStatusRun(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + return nil +} + +func HandleServerCapabilities(res *proto.HeartbeatResponse) error { + for _, action := range ServerActionList { + err := action.UpdateCapabilities(res) + if err != nil { + return common.SystemError(err) + } + } + return nil +} diff --git a/config_server/v2/service/protov2/README.md b/config_server/v2/service/protov2/README.md new file mode 100644 index 0000000000..7995b9cecc --- /dev/null +++ b/config_server/v2/service/protov2/README.md @@ -0,0 +1,39 @@ +# Go Proto + +此为使用protoc命令生成go代码的文档 + +## 预备条件 + +安装好GO,并在环境变量中配置了`$GOROOT/bin`与`$GOPATH/bin` + +## 快速开始 + +安装protoc(CentOs) + +```shell +yum install -y protobuf-compiler +``` + +输入以下命令,若出现版本信息即安装成功 + +```shell +protoc --version +# libprotoc 3.20.0 +``` + +安装`protoc-gen-go`插件,默认路径为`$GOPATH/bin` + +```shell +go install google.golang.org/protobuf/cmd/protoc-gen-go@latest +``` + +进入`protocol/v2`文件夹 + +```shell +protoc --go_out=. agent.proto +``` + +```shell +protoc --go_out=. user.proto +``` + diff --git a/config_server/v2/service/protov2/agent.pb.go b/config_server/v2/service/protov2/agent.pb.go new file mode 100644 index 0000000000..5f7e5e41f6 --- /dev/null +++ b/config_server/v2/service/protov2/agent.pb.go @@ -0,0 +1,1385 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.1 +// protoc v3.20.0 +// source: agent.proto + +package protov2 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ConfigStatus int32 + +const ( + // The value of status field is not set. + ConfigStatus_UNSET ConfigStatus = 0 + // Agent is currently applying the remote config that it received earlier. + ConfigStatus_APPLYING ConfigStatus = 1 + // Remote config was successfully applied by the Agent. + ConfigStatus_APPLIED ConfigStatus = 2 + // Agent tried to apply the config received earlier, but it failed. + // See error_message for more details. + ConfigStatus_FAILED ConfigStatus = 3 +) + +// Enum value maps for ConfigStatus. +var ( + ConfigStatus_name = map[int32]string{ + 0: "UNSET", + 1: "APPLYING", + 2: "APPLIED", + 3: "FAILED", + } + ConfigStatus_value = map[string]int32{ + "UNSET": 0, + "APPLYING": 1, + "APPLIED": 2, + "FAILED": 3, + } +) + +func (x ConfigStatus) Enum() *ConfigStatus { + p := new(ConfigStatus) + *p = x + return p +} + +func (x ConfigStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConfigStatus) Descriptor() protoreflect.EnumDescriptor { + return file_agent_proto_enumTypes[0].Descriptor() +} + +func (ConfigStatus) Type() protoreflect.EnumType { + return &file_agent_proto_enumTypes[0] +} + +func (x ConfigStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ConfigStatus.Descriptor instead. +func (ConfigStatus) EnumDescriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{0} +} + +type AgentCapabilities int32 + +const ( + // The capabilities field is unspecified. + AgentCapabilities_UnspecifiedAgentCapability AgentCapabilities = 0 + // The Agent can accept pipeline configuration from the Server. + AgentCapabilities_AcceptsPipelineConfig AgentCapabilities = 1 + // The Agent can accept instance configuration from the Server. + AgentCapabilities_AcceptsInstanceConfig AgentCapabilities = 2 + // The Agent can accept custom command from the Server. + AgentCapabilities_AcceptsCustomCommand AgentCapabilities = 4 +) + +// Enum value maps for AgentCapabilities. +var ( + AgentCapabilities_name = map[int32]string{ + 0: "UnspecifiedAgentCapability", + 1: "AcceptsPipelineConfig", + 2: "AcceptsInstanceConfig", + 4: "AcceptsCustomCommand", + } + AgentCapabilities_value = map[string]int32{ + "UnspecifiedAgentCapability": 0, + "AcceptsPipelineConfig": 1, + "AcceptsInstanceConfig": 2, + "AcceptsCustomCommand": 4, + } +) + +func (x AgentCapabilities) Enum() *AgentCapabilities { + p := new(AgentCapabilities) + *p = x + return p +} + +func (x AgentCapabilities) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AgentCapabilities) Descriptor() protoreflect.EnumDescriptor { + return file_agent_proto_enumTypes[1].Descriptor() +} + +func (AgentCapabilities) Type() protoreflect.EnumType { + return &file_agent_proto_enumTypes[1] +} + +func (x AgentCapabilities) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AgentCapabilities.Descriptor instead. +func (AgentCapabilities) EnumDescriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{1} +} + +type RequestFlags int32 + +const ( + RequestFlags_RequestFlagsUnspecified RequestFlags = 0 + // Must be set if this request contains full state + RequestFlags_FullState RequestFlags = 1 // bits before 2^16 (inclusive) are reserved for future official fields +) + +// Enum value maps for RequestFlags. +var ( + RequestFlags_name = map[int32]string{ + 0: "RequestFlagsUnspecified", + 1: "FullState", + } + RequestFlags_value = map[string]int32{ + "RequestFlagsUnspecified": 0, + "FullState": 1, + } +) + +func (x RequestFlags) Enum() *RequestFlags { + p := new(RequestFlags) + *p = x + return p +} + +func (x RequestFlags) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RequestFlags) Descriptor() protoreflect.EnumDescriptor { + return file_agent_proto_enumTypes[2].Descriptor() +} + +func (RequestFlags) Type() protoreflect.EnumType { + return &file_agent_proto_enumTypes[2] +} + +func (x RequestFlags) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RequestFlags.Descriptor instead. +func (RequestFlags) EnumDescriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{2} +} + +type ServerCapabilities int32 + +const ( + // The capabilities field is unspecified. + ServerCapabilities_UnspecifiedServerCapability ServerCapabilities = 0 + // The Server can remember agent attributes. + ServerCapabilities_RembersAttribute ServerCapabilities = 1 + // The Server can remember pipeline config status. + ServerCapabilities_RembersPipelineConfigStatus ServerCapabilities = 2 + // The Server can remember instance config status. + ServerCapabilities_RembersInstanceConfigStatus ServerCapabilities = 4 + // The Server can remember custom command status. + ServerCapabilities_RembersCustomCommandStatus ServerCapabilities = 8 +) + +// Enum value maps for ServerCapabilities. +var ( + ServerCapabilities_name = map[int32]string{ + 0: "UnspecifiedServerCapability", + 1: "RembersAttribute", + 2: "RembersPipelineConfigStatus", + 4: "RembersInstanceConfigStatus", + 8: "RembersCustomCommandStatus", + } + ServerCapabilities_value = map[string]int32{ + "UnspecifiedServerCapability": 0, + "RembersAttribute": 1, + "RembersPipelineConfigStatus": 2, + "RembersInstanceConfigStatus": 4, + "RembersCustomCommandStatus": 8, + } +) + +func (x ServerCapabilities) Enum() *ServerCapabilities { + p := new(ServerCapabilities) + *p = x + return p +} + +func (x ServerCapabilities) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ServerCapabilities) Descriptor() protoreflect.EnumDescriptor { + return file_agent_proto_enumTypes[3].Descriptor() +} + +func (ServerCapabilities) Type() protoreflect.EnumType { + return &file_agent_proto_enumTypes[3] +} + +func (x ServerCapabilities) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ServerCapabilities.Descriptor instead. +func (ServerCapabilities) EnumDescriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{3} +} + +type ResponseFlags int32 + +const ( + ResponseFlags_ResponseFlagsUnspecified ResponseFlags = 0 + // ReportFullState flag can be used by the Server if the Client did not include + // some sub-message in the last AgentToServer message (which is an allowed + // optimization) but the Server detects that it does not have it (e.g. was + // restarted and lost state). + ResponseFlags_ReportFullState ResponseFlags = 1 + ResponseFlags_FetchPipelineConfigDetail ResponseFlags = 2 + ResponseFlags_FetchInstanceConfigDetail ResponseFlags = 4 // bits before 2^16 (inclusive) are reserved for future official fields +) + +// Enum value maps for ResponseFlags. +var ( + ResponseFlags_name = map[int32]string{ + 0: "ResponseFlagsUnspecified", + 1: "ReportFullState", + 2: "FetchPipelineConfigDetail", + 4: "FetchInstanceConfigDetail", + } + ResponseFlags_value = map[string]int32{ + "ResponseFlagsUnspecified": 0, + "ReportFullState": 1, + "FetchPipelineConfigDetail": 2, + "FetchInstanceConfigDetail": 4, + } +) + +func (x ResponseFlags) Enum() *ResponseFlags { + p := new(ResponseFlags) + *p = x + return p +} + +func (x ResponseFlags) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ResponseFlags) Descriptor() protoreflect.EnumDescriptor { + return file_agent_proto_enumTypes[4].Descriptor() +} + +func (ResponseFlags) Type() protoreflect.EnumType { + return &file_agent_proto_enumTypes[4] +} + +func (x ResponseFlags) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ResponseFlags.Descriptor instead. +func (ResponseFlags) EnumDescriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{4} +} + +type AgentGroupTag struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *AgentGroupTag) Reset() { + *x = AgentGroupTag{} + mi := &file_agent_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AgentGroupTag) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AgentGroupTag) ProtoMessage() {} + +func (x *AgentGroupTag) ProtoReflect() protoreflect.Message { + mi := &file_agent_proto_msgTypes[0] + 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 AgentGroupTag.ProtoReflect.Descriptor instead. +func (*AgentGroupTag) Descriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{0} +} + +func (x *AgentGroupTag) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *AgentGroupTag) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +// Define the Config information carried in the request +type ConfigInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Required, Config's unique identification + Version int64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` // Required, Config's version number or hash code + Status ConfigStatus `protobuf:"varint,3,opt,name=status,proto3,enum=ConfigStatus" json:"status,omitempty"` // Config's status + Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` // Optional error message +} + +func (x *ConfigInfo) Reset() { + *x = ConfigInfo{} + mi := &file_agent_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfigInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigInfo) ProtoMessage() {} + +func (x *ConfigInfo) ProtoReflect() protoreflect.Message { + mi := &file_agent_proto_msgTypes[1] + 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 ConfigInfo.ProtoReflect.Descriptor instead. +func (*ConfigInfo) Descriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{1} +} + +func (x *ConfigInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ConfigInfo) GetVersion() int64 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *ConfigInfo) GetStatus() ConfigStatus { + if x != nil { + return x.Status + } + return ConfigStatus_UNSET +} + +func (x *ConfigInfo) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +// Define the Command information carried in the request +type CommandInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` // Command's type + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Required, Command's unique identification + Status ConfigStatus `protobuf:"varint,3,opt,name=status,proto3,enum=ConfigStatus" json:"status,omitempty"` // Command's status + Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` // Optional error message +} + +func (x *CommandInfo) Reset() { + *x = CommandInfo{} + mi := &file_agent_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CommandInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommandInfo) ProtoMessage() {} + +func (x *CommandInfo) ProtoReflect() protoreflect.Message { + mi := &file_agent_proto_msgTypes[2] + 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 CommandInfo.ProtoReflect.Descriptor instead. +func (*CommandInfo) Descriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{2} +} + +func (x *CommandInfo) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *CommandInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CommandInfo) GetStatus() ConfigStatus { + if x != nil { + return x.Status + } + return ConfigStatus_UNSET +} + +func (x *CommandInfo) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +// Define Agent's basic attributes +type AgentAttributes struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version []byte `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Agent's version + Ip []byte `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"` // Agent's ip + Hostname []byte `protobuf:"bytes,3,opt,name=hostname,proto3" json:"hostname,omitempty"` // Agent's hostname + Hostid []byte `protobuf:"bytes,4,opt,name=hostid,proto3" json:"hostid,omitempty"` // Agent's hostid https://opentelemetry.io/docs/specs/semconv/attributes-registry/host/ + Extras map[string][]byte `protobuf:"bytes,100,rep,name=extras,proto3" json:"extras,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // Agent's other attributes +} + +func (x *AgentAttributes) Reset() { + *x = AgentAttributes{} + mi := &file_agent_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AgentAttributes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AgentAttributes) ProtoMessage() {} + +func (x *AgentAttributes) ProtoReflect() protoreflect.Message { + mi := &file_agent_proto_msgTypes[3] + 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 AgentAttributes.ProtoReflect.Descriptor instead. +func (*AgentAttributes) Descriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{3} +} + +func (x *AgentAttributes) GetVersion() []byte { + if x != nil { + return x.Version + } + return nil +} + +func (x *AgentAttributes) GetIp() []byte { + if x != nil { + return x.Ip + } + return nil +} + +func (x *AgentAttributes) GetHostname() []byte { + if x != nil { + return x.Hostname + } + return nil +} + +func (x *AgentAttributes) GetHostid() []byte { + if x != nil { + return x.Hostid + } + return nil +} + +func (x *AgentAttributes) GetExtras() map[string][]byte { + if x != nil { + return x.Extras + } + return nil +} + +// Agent sends requests to the ConfigServer to get config updates and receive commands. +type HeartbeatRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + SequenceNum uint64 `protobuf:"varint,2,opt,name=sequence_num,json=sequenceNum,proto3" json:"sequence_num,omitempty"` // Increment every request, for server to check sync status + Capabilities uint64 `protobuf:"varint,3,opt,name=capabilities,proto3" json:"capabilities,omitempty"` // Bitmask of flags defined by AgentCapabilities enum + InstanceId []byte `protobuf:"bytes,4,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` // Required, Agent's unique identification, consistent throughout the process lifecycle + AgentType string `protobuf:"bytes,5,opt,name=agent_type,json=agentType,proto3" json:"agent_type,omitempty"` // Required, Agent's type(ilogtail, ..) + Attributes *AgentAttributes `protobuf:"bytes,6,opt,name=attributes,proto3" json:"attributes,omitempty"` // Agent's basic attributes + Tags []*AgentGroupTag `protobuf:"bytes,7,rep,name=tags,proto3" json:"tags,omitempty"` // Agent's tags + RunningStatus string `protobuf:"bytes,8,opt,name=running_status,json=runningStatus,proto3" json:"running_status,omitempty"` // Human readable running status + StartupTime int64 `protobuf:"varint,9,opt,name=startup_time,json=startupTime,proto3" json:"startup_time,omitempty"` // Required, Agent's startup time + PipelineConfigs []*ConfigInfo `protobuf:"bytes,10,rep,name=pipeline_configs,json=pipelineConfigs,proto3" json:"pipeline_configs,omitempty"` // Information about the current PIPELINE_CONFIG held by the Agent + InstanceConfigs []*ConfigInfo `protobuf:"bytes,11,rep,name=instance_configs,json=instanceConfigs,proto3" json:"instance_configs,omitempty"` // Information about the current AGENT_CONFIG held by the Agent + CustomCommands []*CommandInfo `protobuf:"bytes,12,rep,name=custom_commands,json=customCommands,proto3" json:"custom_commands,omitempty"` // Information about command history + Flags uint64 `protobuf:"varint,13,opt,name=flags,proto3" json:"flags,omitempty"` // Predefined command flag + Opaque []byte `protobuf:"bytes,14,opt,name=opaque,proto3" json:"opaque,omitempty"` // Opaque data for extension +} + +func (x *HeartbeatRequest) Reset() { + *x = HeartbeatRequest{} + mi := &file_agent_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HeartbeatRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeartbeatRequest) ProtoMessage() {} + +func (x *HeartbeatRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_proto_msgTypes[4] + 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 HeartbeatRequest.ProtoReflect.Descriptor instead. +func (*HeartbeatRequest) Descriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{4} +} + +func (x *HeartbeatRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *HeartbeatRequest) GetSequenceNum() uint64 { + if x != nil { + return x.SequenceNum + } + return 0 +} + +func (x *HeartbeatRequest) GetCapabilities() uint64 { + if x != nil { + return x.Capabilities + } + return 0 +} + +func (x *HeartbeatRequest) GetInstanceId() []byte { + if x != nil { + return x.InstanceId + } + return nil +} + +func (x *HeartbeatRequest) GetAgentType() string { + if x != nil { + return x.AgentType + } + return "" +} + +func (x *HeartbeatRequest) GetAttributes() *AgentAttributes { + if x != nil { + return x.Attributes + } + return nil +} + +func (x *HeartbeatRequest) GetTags() []*AgentGroupTag { + if x != nil { + return x.Tags + } + return nil +} + +func (x *HeartbeatRequest) GetRunningStatus() string { + if x != nil { + return x.RunningStatus + } + return "" +} + +func (x *HeartbeatRequest) GetStartupTime() int64 { + if x != nil { + return x.StartupTime + } + return 0 +} + +func (x *HeartbeatRequest) GetPipelineConfigs() []*ConfigInfo { + if x != nil { + return x.PipelineConfigs + } + return nil +} + +func (x *HeartbeatRequest) GetInstanceConfigs() []*ConfigInfo { + if x != nil { + return x.InstanceConfigs + } + return nil +} + +func (x *HeartbeatRequest) GetCustomCommands() []*CommandInfo { + if x != nil { + return x.CustomCommands + } + return nil +} + +func (x *HeartbeatRequest) GetFlags() uint64 { + if x != nil { + return x.Flags + } + return 0 +} + +func (x *HeartbeatRequest) GetOpaque() []byte { + if x != nil { + return x.Opaque + } + return nil +} + +// Define Config's detail +type ConfigDetail struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Required, Config's unique identification + Version int64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` // Required, Config's version number or hash code + Detail []byte `protobuf:"bytes,3,opt,name=detail,proto3" json:"detail,omitempty"` // Required, Config's detail +} + +func (x *ConfigDetail) Reset() { + *x = ConfigDetail{} + mi := &file_agent_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfigDetail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigDetail) ProtoMessage() {} + +func (x *ConfigDetail) ProtoReflect() protoreflect.Message { + mi := &file_agent_proto_msgTypes[5] + 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 ConfigDetail.ProtoReflect.Descriptor instead. +func (*ConfigDetail) Descriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{5} +} + +func (x *ConfigDetail) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ConfigDetail) GetVersion() int64 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *ConfigDetail) GetDetail() []byte { + if x != nil { + return x.Detail + } + return nil +} + +type CommandDetail struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` // Required, Command type + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Required, Command name + Detail []byte `protobuf:"bytes,3,opt,name=detail,proto3" json:"detail,omitempty"` // Required, Command's detail + ExpireTime int64 `protobuf:"varint,4,opt,name=expire_time,json=expireTime,proto3" json:"expire_time,omitempty"` // After which the command can be safely removed from history +} + +func (x *CommandDetail) Reset() { + *x = CommandDetail{} + mi := &file_agent_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CommandDetail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommandDetail) ProtoMessage() {} + +func (x *CommandDetail) ProtoReflect() protoreflect.Message { + mi := &file_agent_proto_msgTypes[6] + 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 CommandDetail.ProtoReflect.Descriptor instead. +func (*CommandDetail) Descriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{6} +} + +func (x *CommandDetail) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *CommandDetail) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CommandDetail) GetDetail() []byte { + if x != nil { + return x.Detail + } + return nil +} + +func (x *CommandDetail) GetExpireTime() int64 { + if x != nil { + return x.ExpireTime + } + return 0 +} + +// ConfigServer's response to Agent's request +type HeartbeatResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` // Set common response + Capabilities uint64 `protobuf:"varint,3,opt,name=capabilities,proto3" json:"capabilities,omitempty"` // Bitmask of flags defined by ServerCapabilities enum + PipelineConfigUpdates []*ConfigDetail `protobuf:"bytes,4,rep,name=pipeline_config_updates,json=pipelineConfigUpdates,proto3" json:"pipeline_config_updates,omitempty"` // Agent's pipeline config update status + InstanceConfigUpdates []*ConfigDetail `protobuf:"bytes,5,rep,name=instance_config_updates,json=instanceConfigUpdates,proto3" json:"instance_config_updates,omitempty"` // Agent's instance config update status + CustomCommandUpdates []*CommandDetail `protobuf:"bytes,6,rep,name=custom_command_updates,json=customCommandUpdates,proto3" json:"custom_command_updates,omitempty"` // Agent's commands updates + Flags uint64 `protobuf:"varint,7,opt,name=flags,proto3" json:"flags,omitempty"` // Predefined command flag + Opaque []byte `protobuf:"bytes,8,opt,name=opaque,proto3" json:"opaque,omitempty"` // Opaque data for extension +} + +func (x *HeartbeatResponse) Reset() { + *x = HeartbeatResponse{} + mi := &file_agent_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HeartbeatResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeartbeatResponse) ProtoMessage() {} + +func (x *HeartbeatResponse) ProtoReflect() protoreflect.Message { + mi := &file_agent_proto_msgTypes[7] + 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 HeartbeatResponse.ProtoReflect.Descriptor instead. +func (*HeartbeatResponse) Descriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{7} +} + +func (x *HeartbeatResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *HeartbeatResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +func (x *HeartbeatResponse) GetCapabilities() uint64 { + if x != nil { + return x.Capabilities + } + return 0 +} + +func (x *HeartbeatResponse) GetPipelineConfigUpdates() []*ConfigDetail { + if x != nil { + return x.PipelineConfigUpdates + } + return nil +} + +func (x *HeartbeatResponse) GetInstanceConfigUpdates() []*ConfigDetail { + if x != nil { + return x.InstanceConfigUpdates + } + return nil +} + +func (x *HeartbeatResponse) GetCustomCommandUpdates() []*CommandDetail { + if x != nil { + return x.CustomCommandUpdates + } + return nil +} + +func (x *HeartbeatResponse) GetFlags() uint64 { + if x != nil { + return x.Flags + } + return 0 +} + +func (x *HeartbeatResponse) GetOpaque() []byte { + if x != nil { + return x.Opaque + } + return nil +} + +// API: /Agent/FetchPipelineConfig/ +// API: /Agent/FetchInstanceConfig/ +// Agent request to ConfigServer, pulling details of the config +type FetchConfigRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + InstanceId []byte `protobuf:"bytes,2,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` // Agent's unique identification + ReqConfigs []*ConfigInfo `protobuf:"bytes,3,rep,name=req_configs,json=reqConfigs,proto3" json:"req_configs,omitempty"` // Config's name and version/hash +} + +func (x *FetchConfigRequest) Reset() { + *x = FetchConfigRequest{} + mi := &file_agent_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FetchConfigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FetchConfigRequest) ProtoMessage() {} + +func (x *FetchConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_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 FetchConfigRequest.ProtoReflect.Descriptor instead. +func (*FetchConfigRequest) Descriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{8} +} + +func (x *FetchConfigRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *FetchConfigRequest) GetInstanceId() []byte { + if x != nil { + return x.InstanceId + } + return nil +} + +func (x *FetchConfigRequest) GetReqConfigs() []*ConfigInfo { + if x != nil { + return x.ReqConfigs + } + return nil +} + +// ConfigServer response to Agent's request +type FetchConfigResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` + ConfigDetails []*ConfigDetail `protobuf:"bytes,3,rep,name=config_details,json=configDetails,proto3" json:"config_details,omitempty"` // config detail +} + +func (x *FetchConfigResponse) Reset() { + *x = FetchConfigResponse{} + mi := &file_agent_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FetchConfigResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FetchConfigResponse) ProtoMessage() {} + +func (x *FetchConfigResponse) ProtoReflect() protoreflect.Message { + mi := &file_agent_proto_msgTypes[9] + 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 FetchConfigResponse.ProtoReflect.Descriptor instead. +func (*FetchConfigResponse) Descriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{9} +} + +func (x *FetchConfigResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *FetchConfigResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +func (x *FetchConfigResponse) GetConfigDetails() []*ConfigDetail { + if x != nil { + return x.ConfigDetails + } + return nil +} + +type CommonResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Status int32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` + ErrorMessage []byte `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` +} + +func (x *CommonResponse) Reset() { + *x = CommonResponse{} + mi := &file_agent_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CommonResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommonResponse) ProtoMessage() {} + +func (x *CommonResponse) ProtoReflect() protoreflect.Message { + mi := &file_agent_proto_msgTypes[10] + 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 CommonResponse.ProtoReflect.Descriptor instead. +func (*CommonResponse) Descriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{10} +} + +func (x *CommonResponse) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *CommonResponse) GetErrorMessage() []byte { + if x != nil { + return x.ErrorMessage + } + return nil +} + +var File_agent_proto protoreflect.FileDescriptor + +var file_agent_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x39, 0x0a, + 0x0d, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x61, 0x67, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x7b, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x76, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xe0, 0x01, + 0x0a, 0x0f, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x68, + 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x68, + 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x6f, 0x73, 0x74, 0x69, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x6f, 0x73, 0x74, 0x69, 0x64, 0x12, + 0x34, 0x0a, 0x06, 0x65, 0x78, 0x74, 0x72, 0x61, 0x73, 0x18, 0x64, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x2e, 0x45, 0x78, 0x74, 0x72, 0x61, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x65, + 0x78, 0x74, 0x72, 0x61, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x45, 0x78, 0x74, 0x72, 0x61, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x22, 0xad, 0x04, 0x0a, 0x10, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, + 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x73, 0x65, 0x71, 0x75, + 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, + 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69, + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, + 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x30, 0x0a, 0x0a, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x10, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x22, 0x0a, + 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x41, 0x67, + 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74, 0x61, 0x67, + 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x75, 0x6e, 0x6e, 0x69, + 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x75, 0x70, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, 0x70, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x36, 0x0a, 0x10, 0x70, + 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, + 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x0f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x73, 0x12, 0x36, 0x0a, 0x10, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0f, 0x69, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x35, 0x0a, 0x0f, 0x63, + 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x0c, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x0e, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x70, 0x61, 0x71, + 0x75, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6f, 0x70, 0x61, 0x71, 0x75, 0x65, + 0x22, 0x54, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, + 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, + 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x70, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, + 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x65, 0x78, + 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x92, 0x03, 0x0a, 0x11, 0x48, 0x65, 0x61, + 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, + 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, + 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, + 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x45, 0x0a, 0x17, 0x70, + 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x15, 0x70, 0x69, 0x70, + 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x73, 0x12, 0x45, 0x0a, 0x17, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x52, 0x15, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x16, 0x63, 0x75, 0x73, + 0x74, 0x6f, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x5f, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, + 0x61, 0x6e, 0x64, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x14, 0x63, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, + 0x14, 0x0a, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, + 0x66, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x70, 0x61, 0x71, 0x75, 0x65, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6f, 0x70, 0x61, 0x71, 0x75, 0x65, 0x22, 0x82, 0x01, + 0x0a, 0x12, 0x46, 0x65, 0x74, 0x63, 0x68, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x0b, 0x72, 0x65, 0x71, 0x5f, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x72, 0x65, 0x71, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x73, 0x22, 0xa4, 0x01, 0x0a, 0x13, 0x46, 0x65, 0x74, 0x63, 0x68, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x64, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x4d, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, 0x40, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x4e, 0x53, 0x45, + 0x54, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x50, 0x50, 0x4c, 0x59, 0x49, 0x4e, 0x47, 0x10, + 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x41, 0x50, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0a, + 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x03, 0x2a, 0x83, 0x01, 0x0a, 0x11, 0x41, + 0x67, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, + 0x12, 0x1e, 0x0a, 0x1a, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x41, + 0x67, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x10, 0x00, + 0x12, 0x19, 0x0a, 0x15, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x73, 0x50, 0x69, 0x70, 0x65, 0x6c, + 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x41, + 0x63, 0x63, 0x65, 0x70, 0x74, 0x73, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x10, 0x02, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, + 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x10, 0x04, + 0x2a, 0x3a, 0x0a, 0x0c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x6c, 0x61, 0x67, 0x73, + 0x12, 0x1b, 0x0a, 0x17, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x6c, 0x61, 0x67, 0x73, + 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, + 0x09, 0x46, 0x75, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x10, 0x01, 0x2a, 0xad, 0x01, 0x0a, + 0x12, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, + 0x69, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x1b, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x41, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x52, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x73, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x10, 0x02, 0x12, 0x1f, 0x0a, 0x1b, 0x52, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x10, 0x04, 0x12, 0x1e, 0x0a, 0x1a, + 0x52, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x10, 0x08, 0x2a, 0x80, 0x01, 0x0a, + 0x0d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x1c, + 0x0a, 0x18, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x55, + 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, + 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x46, 0x75, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x10, + 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x46, 0x65, 0x74, 0x63, 0x68, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, + 0x6e, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x10, 0x02, + 0x12, 0x1d, 0x0a, 0x19, 0x46, 0x65, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, + 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x10, 0x04, 0x42, + 0x0b, 0x5a, 0x09, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x76, 0x32, 0x3b, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_agent_proto_rawDescOnce sync.Once + file_agent_proto_rawDescData = file_agent_proto_rawDesc +) + +func file_agent_proto_rawDescGZIP() []byte { + file_agent_proto_rawDescOnce.Do(func() { + file_agent_proto_rawDescData = protoimpl.X.CompressGZIP(file_agent_proto_rawDescData) + }) + return file_agent_proto_rawDescData +} + +var file_agent_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_agent_proto_goTypes = []any{ + (ConfigStatus)(0), // 0: ConfigStatus + (AgentCapabilities)(0), // 1: AgentCapabilities + (RequestFlags)(0), // 2: RequestFlags + (ServerCapabilities)(0), // 3: ServerCapabilities + (ResponseFlags)(0), // 4: ResponseFlags + (*AgentGroupTag)(nil), // 5: AgentGroupTag + (*ConfigInfo)(nil), // 6: ConfigInfo + (*CommandInfo)(nil), // 7: CommandInfo + (*AgentAttributes)(nil), // 8: AgentAttributes + (*HeartbeatRequest)(nil), // 9: HeartbeatRequest + (*ConfigDetail)(nil), // 10: ConfigDetail + (*CommandDetail)(nil), // 11: CommandDetail + (*HeartbeatResponse)(nil), // 12: HeartbeatResponse + (*FetchConfigRequest)(nil), // 13: FetchConfigRequest + (*FetchConfigResponse)(nil), // 14: FetchConfigResponse + (*CommonResponse)(nil), // 15: CommonResponse + nil, // 16: AgentAttributes.ExtrasEntry +} +var file_agent_proto_depIdxs = []int32{ + 0, // 0: ConfigInfo.status:type_name -> ConfigStatus + 0, // 1: CommandInfo.status:type_name -> ConfigStatus + 16, // 2: AgentAttributes.extras:type_name -> AgentAttributes.ExtrasEntry + 8, // 3: HeartbeatRequest.attributes:type_name -> AgentAttributes + 5, // 4: HeartbeatRequest.tags:type_name -> AgentGroupTag + 6, // 5: HeartbeatRequest.pipeline_configs:type_name -> ConfigInfo + 6, // 6: HeartbeatRequest.instance_configs:type_name -> ConfigInfo + 7, // 7: HeartbeatRequest.custom_commands:type_name -> CommandInfo + 15, // 8: HeartbeatResponse.common_response:type_name -> CommonResponse + 10, // 9: HeartbeatResponse.pipeline_config_updates:type_name -> ConfigDetail + 10, // 10: HeartbeatResponse.instance_config_updates:type_name -> ConfigDetail + 11, // 11: HeartbeatResponse.custom_command_updates:type_name -> CommandDetail + 6, // 12: FetchConfigRequest.req_configs:type_name -> ConfigInfo + 15, // 13: FetchConfigResponse.common_response:type_name -> CommonResponse + 10, // 14: FetchConfigResponse.config_details:type_name -> ConfigDetail + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name +} + +func init() { file_agent_proto_init() } +func file_agent_proto_init() { + if File_agent_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_agent_proto_rawDesc, + NumEnums: 5, + NumMessages: 12, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_agent_proto_goTypes, + DependencyIndexes: file_agent_proto_depIdxs, + EnumInfos: file_agent_proto_enumTypes, + MessageInfos: file_agent_proto_msgTypes, + }.Build() + File_agent_proto = out.File + file_agent_proto_rawDesc = nil + file_agent_proto_goTypes = nil + file_agent_proto_depIdxs = nil +} diff --git a/config_server/v2/service/protov2/user.pb.go b/config_server/v2/service/protov2/user.pb.go new file mode 100644 index 0000000000..f560bfa0bc --- /dev/null +++ b/config_server/v2/service/protov2/user.pb.go @@ -0,0 +1,2259 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.1 +// protoc v3.20.0 +// source: user.proto + +package protov2 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Agent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Capabilities uint64 `protobuf:"varint,1,opt,name=capabilities,proto3" json:"capabilities,omitempty"` // Bitmask of flags defined by AgentCapabilities enum + InstanceId []byte `protobuf:"bytes,2,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` // Required, Agent's unique identification, consistent throughout the process lifecycle + AgentType string `protobuf:"bytes,3,opt,name=agent_type,json=agentType,proto3" json:"agent_type,omitempty"` // Required, Agent's type(ilogtail, ..) + Attributes *AgentAttributes `protobuf:"bytes,4,opt,name=attributes,proto3" json:"attributes,omitempty"` // Agent's basic attributes + RunningStatus string `protobuf:"bytes,5,opt,name=running_status,json=runningStatus,proto3" json:"running_status,omitempty"` // Human readable running status + StartupTime int64 `protobuf:"varint,6,opt,name=startup_time,json=startupTime,proto3" json:"startup_time,omitempty"` // Required, Agent's startup time +} + +func (x *Agent) Reset() { + *x = Agent{} + mi := &file_user_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Agent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Agent) ProtoMessage() {} + +func (x *Agent) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[0] + 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 Agent.ProtoReflect.Descriptor instead. +func (*Agent) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{0} +} + +func (x *Agent) GetCapabilities() uint64 { + if x != nil { + return x.Capabilities + } + return 0 +} + +func (x *Agent) GetInstanceId() []byte { + if x != nil { + return x.InstanceId + } + return nil +} + +func (x *Agent) GetAgentType() string { + if x != nil { + return x.AgentType + } + return "" +} + +func (x *Agent) GetAttributes() *AgentAttributes { + if x != nil { + return x.Attributes + } + return nil +} + +func (x *Agent) GetRunningStatus() string { + if x != nil { + return x.RunningStatus + } + return "" +} + +func (x *Agent) GetStartupTime() int64 { + if x != nil { + return x.StartupTime + } + return 0 +} + +type CreateAgentGroupRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + AgentGroup *AgentGroupTag `protobuf:"bytes,2,opt,name=agent_group,json=agentGroup,proto3" json:"agent_group,omitempty"` +} + +func (x *CreateAgentGroupRequest) Reset() { + *x = CreateAgentGroupRequest{} + mi := &file_user_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateAgentGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateAgentGroupRequest) ProtoMessage() {} + +func (x *CreateAgentGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[1] + 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 CreateAgentGroupRequest.ProtoReflect.Descriptor instead. +func (*CreateAgentGroupRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateAgentGroupRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *CreateAgentGroupRequest) GetAgentGroup() *AgentGroupTag { + if x != nil { + return x.AgentGroup + } + return nil +} + +type CreateAgentGroupResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` +} + +func (x *CreateAgentGroupResponse) Reset() { + *x = CreateAgentGroupResponse{} + mi := &file_user_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateAgentGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateAgentGroupResponse) ProtoMessage() {} + +func (x *CreateAgentGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[2] + 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 CreateAgentGroupResponse.ProtoReflect.Descriptor instead. +func (*CreateAgentGroupResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateAgentGroupResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *CreateAgentGroupResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +type UpdateAgentGroupRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + AgentGroup *AgentGroupTag `protobuf:"bytes,2,opt,name=agent_group,json=agentGroup,proto3" json:"agent_group,omitempty"` +} + +func (x *UpdateAgentGroupRequest) Reset() { + *x = UpdateAgentGroupRequest{} + mi := &file_user_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateAgentGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateAgentGroupRequest) ProtoMessage() {} + +func (x *UpdateAgentGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[3] + 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 UpdateAgentGroupRequest.ProtoReflect.Descriptor instead. +func (*UpdateAgentGroupRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{3} +} + +func (x *UpdateAgentGroupRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *UpdateAgentGroupRequest) GetAgentGroup() *AgentGroupTag { + if x != nil { + return x.AgentGroup + } + return nil +} + +type UpdateAgentGroupResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` +} + +func (x *UpdateAgentGroupResponse) Reset() { + *x = UpdateAgentGroupResponse{} + mi := &file_user_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateAgentGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateAgentGroupResponse) ProtoMessage() {} + +func (x *UpdateAgentGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[4] + 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 UpdateAgentGroupResponse.ProtoReflect.Descriptor instead. +func (*UpdateAgentGroupResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{4} +} + +func (x *UpdateAgentGroupResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *UpdateAgentGroupResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +type DeleteAgentGroupRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` +} + +func (x *DeleteAgentGroupRequest) Reset() { + *x = DeleteAgentGroupRequest{} + mi := &file_user_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteAgentGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteAgentGroupRequest) ProtoMessage() {} + +func (x *DeleteAgentGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[5] + 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 DeleteAgentGroupRequest.ProtoReflect.Descriptor instead. +func (*DeleteAgentGroupRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{5} +} + +func (x *DeleteAgentGroupRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *DeleteAgentGroupRequest) GetGroupName() string { + if x != nil { + return x.GroupName + } + return "" +} + +type DeleteAgentGroupResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` +} + +func (x *DeleteAgentGroupResponse) Reset() { + *x = DeleteAgentGroupResponse{} + mi := &file_user_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteAgentGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteAgentGroupResponse) ProtoMessage() {} + +func (x *DeleteAgentGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[6] + 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 DeleteAgentGroupResponse.ProtoReflect.Descriptor instead. +func (*DeleteAgentGroupResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{6} +} + +func (x *DeleteAgentGroupResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *DeleteAgentGroupResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +type GetAgentGroupRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` +} + +func (x *GetAgentGroupRequest) Reset() { + *x = GetAgentGroupRequest{} + mi := &file_user_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAgentGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAgentGroupRequest) ProtoMessage() {} + +func (x *GetAgentGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[7] + 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 GetAgentGroupRequest.ProtoReflect.Descriptor instead. +func (*GetAgentGroupRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{7} +} + +func (x *GetAgentGroupRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *GetAgentGroupRequest) GetGroupName() string { + if x != nil { + return x.GroupName + } + return "" +} + +type GetAgentGroupResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` + AgentGroup *AgentGroupTag `protobuf:"bytes,3,opt,name=agent_group,json=agentGroup,proto3" json:"agent_group,omitempty"` +} + +func (x *GetAgentGroupResponse) Reset() { + *x = GetAgentGroupResponse{} + mi := &file_user_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAgentGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAgentGroupResponse) ProtoMessage() {} + +func (x *GetAgentGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_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 GetAgentGroupResponse.ProtoReflect.Descriptor instead. +func (*GetAgentGroupResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{8} +} + +func (x *GetAgentGroupResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *GetAgentGroupResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +func (x *GetAgentGroupResponse) GetAgentGroup() *AgentGroupTag { + if x != nil { + return x.AgentGroup + } + return nil +} + +type ListAgentGroupsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` +} + +func (x *ListAgentGroupsRequest) Reset() { + *x = ListAgentGroupsRequest{} + mi := &file_user_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListAgentGroupsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAgentGroupsRequest) ProtoMessage() {} + +func (x *ListAgentGroupsRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[9] + 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 ListAgentGroupsRequest.ProtoReflect.Descriptor instead. +func (*ListAgentGroupsRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{9} +} + +func (x *ListAgentGroupsRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +type ListAgentGroupsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` + AgentGroups []*AgentGroupTag `protobuf:"bytes,4,rep,name=agent_groups,json=agentGroups,proto3" json:"agent_groups,omitempty"` +} + +func (x *ListAgentGroupsResponse) Reset() { + *x = ListAgentGroupsResponse{} + mi := &file_user_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListAgentGroupsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAgentGroupsResponse) ProtoMessage() {} + +func (x *ListAgentGroupsResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[10] + 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 ListAgentGroupsResponse.ProtoReflect.Descriptor instead. +func (*ListAgentGroupsResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{10} +} + +func (x *ListAgentGroupsResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *ListAgentGroupsResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +func (x *ListAgentGroupsResponse) GetAgentGroups() []*AgentGroupTag { + if x != nil { + return x.AgentGroups + } + return nil +} + +// API: /User/CreatePipelineConfig +// API: /User/CreateInstanceConfig +type CreateConfigRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + ConfigDetail *ConfigDetail `protobuf:"bytes,2,opt,name=config_detail,json=configDetail,proto3" json:"config_detail,omitempty"` +} + +func (x *CreateConfigRequest) Reset() { + *x = CreateConfigRequest{} + mi := &file_user_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateConfigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateConfigRequest) ProtoMessage() {} + +func (x *CreateConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[11] + 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 CreateConfigRequest.ProtoReflect.Descriptor instead. +func (*CreateConfigRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{11} +} + +func (x *CreateConfigRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *CreateConfigRequest) GetConfigDetail() *ConfigDetail { + if x != nil { + return x.ConfigDetail + } + return nil +} + +type CreateConfigResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` +} + +func (x *CreateConfigResponse) Reset() { + *x = CreateConfigResponse{} + mi := &file_user_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateConfigResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateConfigResponse) ProtoMessage() {} + +func (x *CreateConfigResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[12] + 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 CreateConfigResponse.ProtoReflect.Descriptor instead. +func (*CreateConfigResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{12} +} + +func (x *CreateConfigResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *CreateConfigResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +// API: /User/UpdatePipelineConfig +// API: /User/UpdateInstanceConfig +type UpdateConfigRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + ConfigDetail *ConfigDetail `protobuf:"bytes,2,opt,name=config_detail,json=configDetail,proto3" json:"config_detail,omitempty"` +} + +func (x *UpdateConfigRequest) Reset() { + *x = UpdateConfigRequest{} + mi := &file_user_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateConfigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateConfigRequest) ProtoMessage() {} + +func (x *UpdateConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[13] + 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 UpdateConfigRequest.ProtoReflect.Descriptor instead. +func (*UpdateConfigRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{13} +} + +func (x *UpdateConfigRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *UpdateConfigRequest) GetConfigDetail() *ConfigDetail { + if x != nil { + return x.ConfigDetail + } + return nil +} + +type UpdateConfigResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` +} + +func (x *UpdateConfigResponse) Reset() { + *x = UpdateConfigResponse{} + mi := &file_user_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateConfigResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateConfigResponse) ProtoMessage() {} + +func (x *UpdateConfigResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[14] + 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 UpdateConfigResponse.ProtoReflect.Descriptor instead. +func (*UpdateConfigResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{14} +} + +func (x *UpdateConfigResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *UpdateConfigResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +// API: /User/DeletePipelineConfig +// API: /User/DeleteInstanceConfig +type DeleteConfigRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + ConfigName string `protobuf:"bytes,2,opt,name=config_name,json=configName,proto3" json:"config_name,omitempty"` +} + +func (x *DeleteConfigRequest) Reset() { + *x = DeleteConfigRequest{} + mi := &file_user_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteConfigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteConfigRequest) ProtoMessage() {} + +func (x *DeleteConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[15] + 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 DeleteConfigRequest.ProtoReflect.Descriptor instead. +func (*DeleteConfigRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{15} +} + +func (x *DeleteConfigRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *DeleteConfigRequest) GetConfigName() string { + if x != nil { + return x.ConfigName + } + return "" +} + +type DeleteConfigResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` +} + +func (x *DeleteConfigResponse) Reset() { + *x = DeleteConfigResponse{} + mi := &file_user_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteConfigResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteConfigResponse) ProtoMessage() {} + +func (x *DeleteConfigResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[16] + 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 DeleteConfigResponse.ProtoReflect.Descriptor instead. +func (*DeleteConfigResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{16} +} + +func (x *DeleteConfigResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *DeleteConfigResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +// API: /User/GetPipelineConfig +// API: /User/GetInstanceConfig +type GetConfigRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + ConfigName string `protobuf:"bytes,2,opt,name=config_name,json=configName,proto3" json:"config_name,omitempty"` +} + +func (x *GetConfigRequest) Reset() { + *x = GetConfigRequest{} + mi := &file_user_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetConfigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetConfigRequest) ProtoMessage() {} + +func (x *GetConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[17] + 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 GetConfigRequest.ProtoReflect.Descriptor instead. +func (*GetConfigRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{17} +} + +func (x *GetConfigRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *GetConfigRequest) GetConfigName() string { + if x != nil { + return x.ConfigName + } + return "" +} + +type GetConfigResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` + ConfigDetail *ConfigDetail `protobuf:"bytes,3,opt,name=config_detail,json=configDetail,proto3" json:"config_detail,omitempty"` +} + +func (x *GetConfigResponse) Reset() { + *x = GetConfigResponse{} + mi := &file_user_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetConfigResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetConfigResponse) ProtoMessage() {} + +func (x *GetConfigResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[18] + 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 GetConfigResponse.ProtoReflect.Descriptor instead. +func (*GetConfigResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{18} +} + +func (x *GetConfigResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *GetConfigResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +func (x *GetConfigResponse) GetConfigDetail() *ConfigDetail { + if x != nil { + return x.ConfigDetail + } + return nil +} + +// API: /User/GetPipelineConfigStatusList +// API: /User/GetInstanceConfigStatusList +type GetConfigStatusListRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + InstanceId []byte `protobuf:"bytes,2,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` +} + +func (x *GetConfigStatusListRequest) Reset() { + *x = GetConfigStatusListRequest{} + mi := &file_user_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetConfigStatusListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetConfigStatusListRequest) ProtoMessage() {} + +func (x *GetConfigStatusListRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[19] + 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 GetConfigStatusListRequest.ProtoReflect.Descriptor instead. +func (*GetConfigStatusListRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{19} +} + +func (x *GetConfigStatusListRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *GetConfigStatusListRequest) GetInstanceId() []byte { + if x != nil { + return x.InstanceId + } + return nil +} + +type GetConfigStatusListResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` + ConfigStatus []*ConfigInfo `protobuf:"bytes,3,rep,name=config_status,json=configStatus,proto3" json:"config_status,omitempty"` +} + +func (x *GetConfigStatusListResponse) Reset() { + *x = GetConfigStatusListResponse{} + mi := &file_user_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetConfigStatusListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetConfigStatusListResponse) ProtoMessage() {} + +func (x *GetConfigStatusListResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[20] + 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 GetConfigStatusListResponse.ProtoReflect.Descriptor instead. +func (*GetConfigStatusListResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{20} +} + +func (x *GetConfigStatusListResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *GetConfigStatusListResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +func (x *GetConfigStatusListResponse) GetConfigStatus() []*ConfigInfo { + if x != nil { + return x.ConfigStatus + } + return nil +} + +// API: /User/ListPipelineConfigs +// API: /User/ListInstanceConfigs +type ListConfigsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` +} + +func (x *ListConfigsRequest) Reset() { + *x = ListConfigsRequest{} + mi := &file_user_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListConfigsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListConfigsRequest) ProtoMessage() {} + +func (x *ListConfigsRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[21] + 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 ListConfigsRequest.ProtoReflect.Descriptor instead. +func (*ListConfigsRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{21} +} + +func (x *ListConfigsRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +type ListConfigsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` + ConfigDetails []*ConfigDetail `protobuf:"bytes,3,rep,name=config_details,json=configDetails,proto3" json:"config_details,omitempty"` +} + +func (x *ListConfigsResponse) Reset() { + *x = ListConfigsResponse{} + mi := &file_user_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListConfigsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListConfigsResponse) ProtoMessage() {} + +func (x *ListConfigsResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[22] + 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 ListConfigsResponse.ProtoReflect.Descriptor instead. +func (*ListConfigsResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{22} +} + +func (x *ListConfigsResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *ListConfigsResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +func (x *ListConfigsResponse) GetConfigDetails() []*ConfigDetail { + if x != nil { + return x.ConfigDetails + } + return nil +} + +// API: /User/ApplyPipelineConfigToAgentGroup +// API: /User/ApplyInstanceConfigToAgentGroup +type ApplyConfigToAgentGroupRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + ConfigName string `protobuf:"bytes,2,opt,name=config_name,json=configName,proto3" json:"config_name,omitempty"` + GroupName string `protobuf:"bytes,3,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` +} + +func (x *ApplyConfigToAgentGroupRequest) Reset() { + *x = ApplyConfigToAgentGroupRequest{} + mi := &file_user_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApplyConfigToAgentGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApplyConfigToAgentGroupRequest) ProtoMessage() {} + +func (x *ApplyConfigToAgentGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[23] + 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 ApplyConfigToAgentGroupRequest.ProtoReflect.Descriptor instead. +func (*ApplyConfigToAgentGroupRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{23} +} + +func (x *ApplyConfigToAgentGroupRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *ApplyConfigToAgentGroupRequest) GetConfigName() string { + if x != nil { + return x.ConfigName + } + return "" +} + +func (x *ApplyConfigToAgentGroupRequest) GetGroupName() string { + if x != nil { + return x.GroupName + } + return "" +} + +type ApplyConfigToAgentGroupResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` +} + +func (x *ApplyConfigToAgentGroupResponse) Reset() { + *x = ApplyConfigToAgentGroupResponse{} + mi := &file_user_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ApplyConfigToAgentGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApplyConfigToAgentGroupResponse) ProtoMessage() {} + +func (x *ApplyConfigToAgentGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[24] + 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 ApplyConfigToAgentGroupResponse.ProtoReflect.Descriptor instead. +func (*ApplyConfigToAgentGroupResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{24} +} + +func (x *ApplyConfigToAgentGroupResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *ApplyConfigToAgentGroupResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +// API: /User/RemovePipelineConfigFromAgentGroup/ +// API: /User/RemoveInstanceConfigFromAgentGroup/ +type RemoveConfigFromAgentGroupRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + ConfigName string `protobuf:"bytes,2,opt,name=config_name,json=configName,proto3" json:"config_name,omitempty"` + GroupName string `protobuf:"bytes,3,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` +} + +func (x *RemoveConfigFromAgentGroupRequest) Reset() { + *x = RemoveConfigFromAgentGroupRequest{} + mi := &file_user_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveConfigFromAgentGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveConfigFromAgentGroupRequest) ProtoMessage() {} + +func (x *RemoveConfigFromAgentGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[25] + 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 RemoveConfigFromAgentGroupRequest.ProtoReflect.Descriptor instead. +func (*RemoveConfigFromAgentGroupRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{25} +} + +func (x *RemoveConfigFromAgentGroupRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *RemoveConfigFromAgentGroupRequest) GetConfigName() string { + if x != nil { + return x.ConfigName + } + return "" +} + +func (x *RemoveConfigFromAgentGroupRequest) GetGroupName() string { + if x != nil { + return x.GroupName + } + return "" +} + +type RemoveConfigFromAgentGroupResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` +} + +func (x *RemoveConfigFromAgentGroupResponse) Reset() { + *x = RemoveConfigFromAgentGroupResponse{} + mi := &file_user_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveConfigFromAgentGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveConfigFromAgentGroupResponse) ProtoMessage() {} + +func (x *RemoveConfigFromAgentGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[26] + 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 RemoveConfigFromAgentGroupResponse.ProtoReflect.Descriptor instead. +func (*RemoveConfigFromAgentGroupResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{26} +} + +func (x *RemoveConfigFromAgentGroupResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *RemoveConfigFromAgentGroupResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +// API: /User/GetAppliedPipelineConfigsForAgentGroup/ +// API: /User/GetAppliedInstanceConfigsForAgentGroup/ +type GetAppliedConfigsForAgentGroupRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` +} + +func (x *GetAppliedConfigsForAgentGroupRequest) Reset() { + *x = GetAppliedConfigsForAgentGroupRequest{} + mi := &file_user_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAppliedConfigsForAgentGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAppliedConfigsForAgentGroupRequest) ProtoMessage() {} + +func (x *GetAppliedConfigsForAgentGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[27] + 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 GetAppliedConfigsForAgentGroupRequest.ProtoReflect.Descriptor instead. +func (*GetAppliedConfigsForAgentGroupRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{27} +} + +func (x *GetAppliedConfigsForAgentGroupRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *GetAppliedConfigsForAgentGroupRequest) GetGroupName() string { + if x != nil { + return x.GroupName + } + return "" +} + +type GetAppliedConfigsForAgentGroupResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` + ConfigNames []string `protobuf:"bytes,4,rep,name=config_names,json=configNames,proto3" json:"config_names,omitempty"` +} + +func (x *GetAppliedConfigsForAgentGroupResponse) Reset() { + *x = GetAppliedConfigsForAgentGroupResponse{} + mi := &file_user_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAppliedConfigsForAgentGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAppliedConfigsForAgentGroupResponse) ProtoMessage() {} + +func (x *GetAppliedConfigsForAgentGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[28] + 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 GetAppliedConfigsForAgentGroupResponse.ProtoReflect.Descriptor instead. +func (*GetAppliedConfigsForAgentGroupResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{28} +} + +func (x *GetAppliedConfigsForAgentGroupResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *GetAppliedConfigsForAgentGroupResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +func (x *GetAppliedConfigsForAgentGroupResponse) GetConfigNames() []string { + if x != nil { + return x.ConfigNames + } + return nil +} + +// API: /User/GetAppliedAgentGroupsWithPipelineConfig/ +// API: /User/GetAppliedAgentGroupsWithInstanceConfig/ +type GetAppliedAgentGroupsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + ConfigName string `protobuf:"bytes,2,opt,name=config_name,json=configName,proto3" json:"config_name,omitempty"` +} + +func (x *GetAppliedAgentGroupsRequest) Reset() { + *x = GetAppliedAgentGroupsRequest{} + mi := &file_user_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAppliedAgentGroupsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAppliedAgentGroupsRequest) ProtoMessage() {} + +func (x *GetAppliedAgentGroupsRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[29] + 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 GetAppliedAgentGroupsRequest.ProtoReflect.Descriptor instead. +func (*GetAppliedAgentGroupsRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{29} +} + +func (x *GetAppliedAgentGroupsRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *GetAppliedAgentGroupsRequest) GetConfigName() string { + if x != nil { + return x.ConfigName + } + return "" +} + +type GetAppliedAgentGroupsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` + AgentGroupNames []string `protobuf:"bytes,3,rep,name=agent_group_names,json=agentGroupNames,proto3" json:"agent_group_names,omitempty"` +} + +func (x *GetAppliedAgentGroupsResponse) Reset() { + *x = GetAppliedAgentGroupsResponse{} + mi := &file_user_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAppliedAgentGroupsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAppliedAgentGroupsResponse) ProtoMessage() {} + +func (x *GetAppliedAgentGroupsResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[30] + 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 GetAppliedAgentGroupsResponse.ProtoReflect.Descriptor instead. +func (*GetAppliedAgentGroupsResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{30} +} + +func (x *GetAppliedAgentGroupsResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *GetAppliedAgentGroupsResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +func (x *GetAppliedAgentGroupsResponse) GetAgentGroupNames() []string { + if x != nil { + return x.AgentGroupNames + } + return nil +} + +type ListAgentsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` +} + +func (x *ListAgentsRequest) Reset() { + *x = ListAgentsRequest{} + mi := &file_user_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListAgentsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAgentsRequest) ProtoMessage() {} + +func (x *ListAgentsRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[31] + 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 ListAgentsRequest.ProtoReflect.Descriptor instead. +func (*ListAgentsRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{31} +} + +func (x *ListAgentsRequest) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *ListAgentsRequest) GetGroupName() string { + if x != nil { + return x.GroupName + } + return "" +} + +type ListAgentsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + CommonResponse *CommonResponse `protobuf:"bytes,2,opt,name=common_response,json=commonResponse,proto3" json:"common_response,omitempty"` + Agents []*Agent `protobuf:"bytes,3,rep,name=agents,proto3" json:"agents,omitempty"` +} + +func (x *ListAgentsResponse) Reset() { + *x = ListAgentsResponse{} + mi := &file_user_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListAgentsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAgentsResponse) ProtoMessage() {} + +func (x *ListAgentsResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[32] + 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 ListAgentsResponse.ProtoReflect.Descriptor instead. +func (*ListAgentsResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{32} +} + +func (x *ListAgentsResponse) GetRequestId() []byte { + if x != nil { + return x.RequestId + } + return nil +} + +func (x *ListAgentsResponse) GetCommonResponse() *CommonResponse { + if x != nil { + return x.CommonResponse + } + return nil +} + +func (x *ListAgentsResponse) GetAgents() []*Agent { + if x != nil { + return x.Agents + } + return nil +} + +var File_user_proto protoreflect.FileDescriptor + +var file_user_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0b, 0x61, 0x67, + 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe7, 0x01, 0x0a, 0x05, 0x41, 0x67, + 0x65, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, + 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x69, 0x6e, + 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x67, 0x65, 0x6e, + 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x67, + 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x30, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x41, 0x67, + 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x52, 0x0a, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x75, 0x6e, + 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, 0x70, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, 0x70, 0x54, + 0x69, 0x6d, 0x65, 0x22, 0x69, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x67, 0x65, + 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, + 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x2f, 0x0a, + 0x0b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x54, + 0x61, 0x67, 0x52, 0x0a, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x73, + 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x69, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x67, 0x65, + 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, + 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x2f, 0x0a, + 0x0b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x54, + 0x61, 0x67, 0x52, 0x0a, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x73, + 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x57, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x67, 0x65, + 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, + 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, + 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x73, 0x0a, 0x18, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x54, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xa1, 0x01, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x41, + 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, + 0x12, 0x38, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x0b, 0x61, 0x67, + 0x65, 0x6e, 0x74, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0e, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x61, 0x67, 0x52, + 0x0a, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x37, 0x0a, 0x16, 0x4c, + 0x69, 0x73, 0x74, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x49, 0x64, 0x22, 0xa5, 0x01, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x67, 0x65, + 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, + 0x38, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x0c, 0x61, 0x67, 0x65, + 0x6e, 0x74, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0e, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x61, 0x67, 0x52, + 0x0b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x68, 0x0a, 0x13, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x49, 0x64, 0x12, 0x32, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x64, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x6f, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, + 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, + 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x68, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, + 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x32, 0x0a, + 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x22, 0x6f, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x55, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x6f, 0x0a, 0x14, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, + 0x12, 0x38, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x52, 0x0a, 0x10, 0x47, 0x65, + 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, + 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, + 0x0b, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xa0, + 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x72, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x43, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, + 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x22, 0x5c, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1f, + 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x22, + 0xa8, 0x01, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x38, + 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0b, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x33, 0x0a, 0x12, 0x4c, 0x69, + 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x22, + 0xa4, 0x01, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x34, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x44, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x7f, 0x0a, 0x1e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x54, 0x6f, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x7a, 0x0a, 0x1f, 0x41, 0x70, 0x70, 0x6c, 0x79, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x54, 0x6f, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x82, 0x01, 0x0a, 0x21, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x46, 0x72, 0x6f, 0x6d, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, + 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x7d, 0x0a, 0x22, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x46, 0x72, 0x6f, 0x6d, 0x41, 0x67, 0x65, 0x6e, + 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, + 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, + 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x65, 0x0a, 0x25, 0x47, 0x65, 0x74, 0x41, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x46, 0x6f, 0x72, 0x41, + 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, + 0x1d, 0x0a, 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xa4, + 0x01, 0x0a, 0x26, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x64, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x73, 0x46, 0x6f, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x5e, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x64, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xa4, 0x01, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x64, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x67, 0x65, + 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x51, 0x0a, 0x11, + 0x4c, 0x69, 0x73, 0x74, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, + 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, + 0x8d, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, + 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, + 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x1e, 0x0a, 0x06, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x06, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x42, + 0x0b, 0x5a, 0x09, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x76, 0x32, 0x3b, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_user_proto_rawDescOnce sync.Once + file_user_proto_rawDescData = file_user_proto_rawDesc +) + +func file_user_proto_rawDescGZIP() []byte { + file_user_proto_rawDescOnce.Do(func() { + file_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_user_proto_rawDescData) + }) + return file_user_proto_rawDescData +} + +var file_user_proto_msgTypes = make([]protoimpl.MessageInfo, 33) +var file_user_proto_goTypes = []any{ + (*Agent)(nil), // 0: Agent + (*CreateAgentGroupRequest)(nil), // 1: CreateAgentGroupRequest + (*CreateAgentGroupResponse)(nil), // 2: CreateAgentGroupResponse + (*UpdateAgentGroupRequest)(nil), // 3: UpdateAgentGroupRequest + (*UpdateAgentGroupResponse)(nil), // 4: UpdateAgentGroupResponse + (*DeleteAgentGroupRequest)(nil), // 5: DeleteAgentGroupRequest + (*DeleteAgentGroupResponse)(nil), // 6: DeleteAgentGroupResponse + (*GetAgentGroupRequest)(nil), // 7: GetAgentGroupRequest + (*GetAgentGroupResponse)(nil), // 8: GetAgentGroupResponse + (*ListAgentGroupsRequest)(nil), // 9: ListAgentGroupsRequest + (*ListAgentGroupsResponse)(nil), // 10: ListAgentGroupsResponse + (*CreateConfigRequest)(nil), // 11: CreateConfigRequest + (*CreateConfigResponse)(nil), // 12: CreateConfigResponse + (*UpdateConfigRequest)(nil), // 13: UpdateConfigRequest + (*UpdateConfigResponse)(nil), // 14: UpdateConfigResponse + (*DeleteConfigRequest)(nil), // 15: DeleteConfigRequest + (*DeleteConfigResponse)(nil), // 16: DeleteConfigResponse + (*GetConfigRequest)(nil), // 17: GetConfigRequest + (*GetConfigResponse)(nil), // 18: GetConfigResponse + (*GetConfigStatusListRequest)(nil), // 19: GetConfigStatusListRequest + (*GetConfigStatusListResponse)(nil), // 20: GetConfigStatusListResponse + (*ListConfigsRequest)(nil), // 21: ListConfigsRequest + (*ListConfigsResponse)(nil), // 22: ListConfigsResponse + (*ApplyConfigToAgentGroupRequest)(nil), // 23: ApplyConfigToAgentGroupRequest + (*ApplyConfigToAgentGroupResponse)(nil), // 24: ApplyConfigToAgentGroupResponse + (*RemoveConfigFromAgentGroupRequest)(nil), // 25: RemoveConfigFromAgentGroupRequest + (*RemoveConfigFromAgentGroupResponse)(nil), // 26: RemoveConfigFromAgentGroupResponse + (*GetAppliedConfigsForAgentGroupRequest)(nil), // 27: GetAppliedConfigsForAgentGroupRequest + (*GetAppliedConfigsForAgentGroupResponse)(nil), // 28: GetAppliedConfigsForAgentGroupResponse + (*GetAppliedAgentGroupsRequest)(nil), // 29: GetAppliedAgentGroupsRequest + (*GetAppliedAgentGroupsResponse)(nil), // 30: GetAppliedAgentGroupsResponse + (*ListAgentsRequest)(nil), // 31: ListAgentsRequest + (*ListAgentsResponse)(nil), // 32: ListAgentsResponse + (*AgentAttributes)(nil), // 33: AgentAttributes + (*AgentGroupTag)(nil), // 34: AgentGroupTag + (*CommonResponse)(nil), // 35: CommonResponse + (*ConfigDetail)(nil), // 36: ConfigDetail + (*ConfigInfo)(nil), // 37: ConfigInfo +} +var file_user_proto_depIdxs = []int32{ + 33, // 0: Agent.attributes:type_name -> AgentAttributes + 34, // 1: CreateAgentGroupRequest.agent_group:type_name -> AgentGroupTag + 35, // 2: CreateAgentGroupResponse.common_response:type_name -> CommonResponse + 34, // 3: UpdateAgentGroupRequest.agent_group:type_name -> AgentGroupTag + 35, // 4: UpdateAgentGroupResponse.common_response:type_name -> CommonResponse + 35, // 5: DeleteAgentGroupResponse.common_response:type_name -> CommonResponse + 35, // 6: GetAgentGroupResponse.common_response:type_name -> CommonResponse + 34, // 7: GetAgentGroupResponse.agent_group:type_name -> AgentGroupTag + 35, // 8: ListAgentGroupsResponse.common_response:type_name -> CommonResponse + 34, // 9: ListAgentGroupsResponse.agent_groups:type_name -> AgentGroupTag + 36, // 10: CreateConfigRequest.config_detail:type_name -> ConfigDetail + 35, // 11: CreateConfigResponse.common_response:type_name -> CommonResponse + 36, // 12: UpdateConfigRequest.config_detail:type_name -> ConfigDetail + 35, // 13: UpdateConfigResponse.common_response:type_name -> CommonResponse + 35, // 14: DeleteConfigResponse.common_response:type_name -> CommonResponse + 35, // 15: GetConfigResponse.common_response:type_name -> CommonResponse + 36, // 16: GetConfigResponse.config_detail:type_name -> ConfigDetail + 35, // 17: GetConfigStatusListResponse.common_response:type_name -> CommonResponse + 37, // 18: GetConfigStatusListResponse.config_status:type_name -> ConfigInfo + 35, // 19: ListConfigsResponse.common_response:type_name -> CommonResponse + 36, // 20: ListConfigsResponse.config_details:type_name -> ConfigDetail + 35, // 21: ApplyConfigToAgentGroupResponse.common_response:type_name -> CommonResponse + 35, // 22: RemoveConfigFromAgentGroupResponse.common_response:type_name -> CommonResponse + 35, // 23: GetAppliedConfigsForAgentGroupResponse.common_response:type_name -> CommonResponse + 35, // 24: GetAppliedAgentGroupsResponse.common_response:type_name -> CommonResponse + 35, // 25: ListAgentsResponse.common_response:type_name -> CommonResponse + 0, // 26: ListAgentsResponse.agents:type_name -> Agent + 27, // [27:27] is the sub-list for method output_type + 27, // [27:27] is the sub-list for method input_type + 27, // [27:27] is the sub-list for extension type_name + 27, // [27:27] is the sub-list for extension extendee + 0, // [0:27] is the sub-list for field type_name +} + +func init() { file_user_proto_init() } +func file_user_proto_init() { + if File_user_proto != nil { + return + } + file_agent_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_user_proto_rawDesc, + NumEnums: 0, + NumMessages: 33, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_user_proto_goTypes, + DependencyIndexes: file_user_proto_depIdxs, + MessageInfos: file_user_proto_msgTypes, + }.Build() + File_user_proto = out.File + file_user_proto_rawDesc = nil + file_user_proto_goTypes = nil + file_user_proto_depIdxs = nil +} diff --git a/config_server/v2/service/repository/agent.go b/config_server/v2/service/repository/agent.go new file mode 100644 index 0000000000..927e24b080 --- /dev/null +++ b/config_server/v2/service/repository/agent.go @@ -0,0 +1,71 @@ +package repository + +import ( + "config-server/common" + "config-server/entity" + "config-server/store" +) + +var s = store.S + +func GetAgentByID(instanceId string, fields ...string) (*entity.Agent, error) { + var agentInfo = &entity.Agent{} + var row int64 + if fields == nil || len(fields) == 0 { + row = s.Db.Where("instance_id=?", instanceId).Find(agentInfo).RowsAffected + } else { + row = s.Db.Select(fields).Where("instance_id=?", instanceId).Find(agentInfo).RowsAffected + } + if row != 1 { + return agentInfo, common.ServerErrorWithMsg(common.AgentNotExist, "instanceId=%s not exists", instanceId) + } + return agentInfo, nil +} + +func GetAllAgents(containPipelineConfigs bool, containInstanceConfigs bool) []entity.Agent { + var agentInfoList []entity.Agent + tx := s.Db + if containPipelineConfigs { + tx.Preload("PipelineConfigs") + } + if containInstanceConfigs { + tx.Preload("InstanceConfigs") + } + tx.Find(&agentInfoList) + return agentInfoList +} + +func RemoveAgentById(instanceId string) error { + tx := s.Db.Where("instance_id=?", instanceId).Delete(&entity.Agent{}) + if tx.RowsAffected != 1 { + return common.ServerErrorWithMsg(common.AgentNotExist, "Agent failed to delete record %s", instanceId) + } + return nil +} + +func UpdateAgentById(agent *entity.Agent, filed ...string) error { + if filed == nil { + err := s.Db.Model(agent).Updates(*agent).Error + if err != nil { + return common.SystemError(err) + } + } + err := s.Db.Model(agent).Select(filed).Updates(*agent).Error + if err != nil { + return common.SystemError(err) + } + return nil +} + +func CreateOrUpdateAgentBasicInfo(conflictColumnNames []string, agent ...*entity.Agent) error { + return createOrUpdateEntities(conflictColumnNames, nil, agent...) +} + +func ListAgentsByGroupName(groupName string) ([]*entity.Agent, error) { + agentGroup := entity.AgentGroup{} + err := s.Db.Preload("Agents").Where("name=?", groupName).Find(&agentGroup).Error + if err != nil { + return nil, err + } + return agentGroup.Agents, nil +} diff --git a/config_server/v2/service/repository/agent_group.go b/config_server/v2/service/repository/agent_group.go new file mode 100644 index 0000000000..3954092fe4 --- /dev/null +++ b/config_server/v2/service/repository/agent_group.go @@ -0,0 +1,90 @@ +package repository + +import ( + "config-server/common" + "config-server/entity" +) + +func CreateAgentGroup(group *entity.AgentGroup) error { + row := s.Db.Create(group).RowsAffected + if row != 1 { + return common.ServerErrorWithMsg(common.AgentGroupAlreadyExist, "create agentGroup(%s) error", group.Name) + } + return nil +} + +func UpdateAgentGroup(group *entity.AgentGroup) error { + err := s.Db.Save(group).Error + return err +} + +func DeleteAgentGroup(name string) error { + row := s.Db.Where("name=?", name).Delete(&entity.AgentGroup{}).RowsAffected + if row != 1 { + return common.ServerErrorWithMsg(common.AgentGroupNotExist, "delete agentGroup(name=%s) error", name) + } + return nil +} + +func GetAgentGroupDetail(name string, containPipelineConfigs bool, containInstanceConfigs bool) (*entity.AgentGroup, error) { + agentGroup := &entity.AgentGroup{} + tx := s.Db.Where("name=?", name) + if containPipelineConfigs { + tx.Preload("PipelineConfigs") + } + if containInstanceConfigs { + tx.Preload("InstanceConfigs") + } + row := tx.Find(agentGroup).RowsAffected + if row != 1 { + return nil, common.ServerErrorWithMsg(common.AgentGroupNotExist, "get agentGroup(name=%s) error", name) + } + return agentGroup, nil +} + +func GetAllAgentGroupDetail(containAgents bool, containPipelineConfigs bool, containInstanceConfigs bool) ([]*entity.AgentGroup, error) { + agentGroups := make([]*entity.AgentGroup, 0) + tx := s.Db.Where("1=1") + if containAgents { + tx.Preload("Agents") + } + if containPipelineConfigs { + tx.Preload("PipelineConfigs") + } + if containInstanceConfigs { + tx.Preload("InstanceConfigs") + } + err := tx.Find(&agentGroups).Error + return agentGroups, err +} + +func GetAllAgentGroup() ([]*entity.AgentGroup, error) { + agentGroups := make([]*entity.AgentGroup, 0) + err := s.Db.Find(&agentGroups).Error + return agentGroups, err +} + +func GetAppliedAgentGroupForPipelineConfigName(configName string) ([]string, error) { + pipelineConfig := &entity.PipelineConfig{} + row := s.Db.Preload("AgentGroups").Where("name=?", configName).Find(&pipelineConfig).RowsAffected + if row != 1 { + return nil, common.ServerErrorWithMsg(common.AgentGroupNotExist, "can not find name=%s pipelineConfig") + } + groupNames := make([]string, 0) + for _, group := range pipelineConfig.AgentGroups { + groupNames = append(groupNames, group.Name) + } + return groupNames, nil +} +func GetAppliedAgentGroupForInstanceConfigName(configName string) ([]string, error) { + instanceConfig := &entity.InstanceConfig{} + row := s.Db.Preload("AgentGroups").Where("name=?", configName).Find(&instanceConfig).RowsAffected + if row != 1 { + return nil, common.ServerErrorWithMsg(common.ConfigNotExist, "can not find name=%s pipelineConfig") + } + groupNames := make([]string, 0) + for _, group := range instanceConfig.AgentGroups { + groupNames = append(groupNames, group.Name) + } + return groupNames, nil +} diff --git a/config_server/v2/service/repository/base.go b/config_server/v2/service/repository/base.go new file mode 100644 index 0000000000..1b76f81779 --- /dev/null +++ b/config_server/v2/service/repository/base.go @@ -0,0 +1,44 @@ +package repository + +import ( + "config-server/common" + "gorm.io/gorm/clause" +) + +func generateClauseColumn(names ...string) []clause.Column { + if names == nil { + return nil + } + arr := make([]clause.Column, 0) + for _, name := range names { + arr = append(arr, clause.Column{ + Name: name, + }) + } + return arr +} + +func createOrUpdateEntities[T any](conflictColumnNames []string, assignmentColumns []string, entities ...T) error { + if conflictColumnNames == nil { + panic("conflictColumnNames could not be null") + } + if entities == nil || len(entities) == 0 { + return nil + } + + //如果原样插入,即数据没有任何变化,RowsAffected返回的值是0,所以这里只能用error来判断是否发生插入或更新异常 + columns := generateClauseColumn(conflictColumnNames...) + if assignmentColumns == nil { + err := s.Db.Clauses(clause.OnConflict{ + Columns: columns, + UpdateAll: true, + }).Create(&entities).Error + return common.SystemError(err) + } + + err := s.Db.Clauses(clause.OnConflict{ + Columns: columns, // 指定冲突的列 + DoUpdates: clause.AssignmentColumns(assignmentColumns), // 如果冲突发生,更新的列 + }).Create(&entities).Error + return common.SystemError(err) +} diff --git a/config_server/v2/service/repository/instance_config.go b/config_server/v2/service/repository/instance_config.go new file mode 100644 index 0000000000..28d40b288e --- /dev/null +++ b/config_server/v2/service/repository/instance_config.go @@ -0,0 +1,82 @@ +package repository + +import ( + "config-server/common" + "config-server/entity" +) + +func GetInstanceConfigByNames(names ...string) ([]*entity.InstanceConfig, error) { + instanceConfigs := make([]*entity.InstanceConfig, 0) + row := s.Db.Where("name in (?)", names).Find(&instanceConfigs).RowsAffected + if row != int64(len(names)) { + return nil, common.ServerErrorWithMsg(common.ConfigNotExist, "instanceNames=%s can not be found", names) + } + return instanceConfigs, nil +} + +func GetInstanceConfigsByAgent(agent *entity.Agent) error { + err := s.Db.Preload("Tags.InstanceConfigs").Where("instance_id=?", agent.InstanceId).Find(agent).Error + return common.SystemError(err) +} + +func CreateInstanceConfig(config *entity.InstanceConfig) error { + row := s.Db.Create(config).RowsAffected + if row != 1 { + return common.ServerErrorWithMsg(common.ConfigAlreadyExist, "create InstanceConfig(%s) error", config.Name) + } + return nil +} + +func UpdateInstanceConfig(config *entity.InstanceConfig) error { + err := s.Db.Save(config).Error + return err +} + +func DeleteInstanceConfig(configName string) error { + row := s.Db.Where("name=?", configName).Delete(&entity.InstanceConfig{}).RowsAffected + if row != 1 { + return common.ServerErrorWithMsg(common.ConfigNotExist, "delete InstanceConfig(name=%s) error", configName) + } + return nil +} + +func GetInstanceConfig(configName string) (*entity.InstanceConfig, error) { + config := &entity.InstanceConfig{} + row := s.Db.Where("name=?", configName).Find(config).RowsAffected + if row != 1 { + return nil, common.ServerErrorWithMsg(common.ConfigNotExist, "get instanceConfig(name=%s) error", configName) + } + return config, nil +} + +func ListInstanceConfigs() ([]*entity.InstanceConfig, error) { + instanceConfigs := make([]*entity.InstanceConfig, 0) + err := s.Db.Find(&instanceConfigs).Error + return instanceConfigs, err +} + +func CreateInstanceConfigForAgentGroup(groupName string, configName string) error { + removeConfig := entity.InstanceConfig{ + Name: configName, + } + agentGroup := entity.AgentGroup{ + Name: groupName, + } + err := s.Db.Model(&agentGroup).Association("InstanceConfigs").Append(&removeConfig) + return common.SystemError(err) +} + +func DeleteInstanceConfigForAgentGroup(groupName string, configName string) error { + removeConfig := entity.InstanceConfig{ + Name: configName, + } + agentGroup := entity.AgentGroup{ + Name: groupName, + } + err := s.Db.Model(&agentGroup).Association("InstanceConfigs").Delete(&removeConfig) + return common.SystemError(err) +} + +func DeleteAllInstanceConfigAndAgent() { + s.Db.Exec("TRUNCATE TABLE agent_instance_config") +} diff --git a/config_server/v2/service/repository/pipeline_config.go b/config_server/v2/service/repository/pipeline_config.go new file mode 100644 index 0000000000..7d0b0ea3b6 --- /dev/null +++ b/config_server/v2/service/repository/pipeline_config.go @@ -0,0 +1,82 @@ +package repository + +import ( + "config-server/common" + "config-server/entity" +) + +func GetPipelineConfigByNames(names ...string) ([]*entity.PipelineConfig, error) { + pipelineConfigs := make([]*entity.PipelineConfig, 0) + row := s.Db.Where("name in (?)", names).Find(&pipelineConfigs).RowsAffected + if row != int64(len(names)) { + return nil, common.ServerErrorWithMsg(common.ConfigNotExist, "pipelineNames=%s can not be found", names) + } + return pipelineConfigs, nil +} + +func GetPipelineConfigsByAgent(agent *entity.Agent) error { + err := s.Db.Preload("Tags.PipelineConfigs").Where("instance_id=?", agent.InstanceId).Find(agent).Error + return common.SystemError(err) +} + +func CreatePipelineConfig(config *entity.PipelineConfig) error { + row := s.Db.Create(config).RowsAffected + if row != 1 { + return common.ServerErrorWithMsg(common.ConfigAlreadyExist, "create pipelineConfig(%s) error", config.Name) + } + return nil +} + +func UpdatePipelineConfig(config *entity.PipelineConfig) error { + err := s.Db.Save(config).Error + return err +} + +func DeletePipelineConfig(configName string) error { + row := s.Db.Where("name=?", configName).Delete(&entity.PipelineConfig{}).RowsAffected + if row != 1 { + return common.ServerErrorWithMsg(common.ConfigNotExist, "delete pipelineConfig(name=%s) error", configName) + } + return nil +} + +func GetPipelineConfig(configName string) (*entity.PipelineConfig, error) { + config := &entity.PipelineConfig{} + row := s.Db.Where("name=?", configName).Find(config).RowsAffected + if row != 1 { + return nil, common.ServerErrorWithMsg(common.ConfigNotExist, "delete pipelineConfig(name=%s) error", configName) + } + return config, nil +} + +func ListPipelineConfigs() ([]*entity.PipelineConfig, error) { + pipelineConfigs := make([]*entity.PipelineConfig, 0) + err := s.Db.Find(&pipelineConfigs).Error + return pipelineConfigs, err +} + +func CreatePipelineConfigForAgentGroup(groupName string, configName string) error { + removeConfig := entity.PipelineConfig{ + Name: configName, + } + agentGroup := entity.AgentGroup{ + Name: groupName, + } + err := s.Db.Model(&agentGroup).Association("PipelineConfigs").Append(&removeConfig) + return common.SystemError(err) +} + +func DeletePipelineConfigForAgentGroup(groupName string, configName string) error { + removeConfig := entity.PipelineConfig{ + Name: configName, + } + agentGroup := entity.AgentGroup{ + Name: groupName, + } + err := s.Db.Model(&agentGroup).Association("PipelineConfigs").Delete(&removeConfig) + return common.SystemError(err) +} + +func DeleteAllPipelineConfigAndAgent() { + s.Db.Exec("TRUNCATE TABLE agent_pipeline_config") +} diff --git a/config_server/v2/service/router/router.go b/config_server/v2/service/router/router.go new file mode 100644 index 0000000000..23d3de83f2 --- /dev/null +++ b/config_server/v2/service/router/router.go @@ -0,0 +1,70 @@ +package router + +import ( + "config-server/handler" + "github.com/gin-gonic/gin" +) + +func initUserRouter(router *gin.Engine) { + userRouter := router.Group("/User") + { + userRouter.POST("/CreateAgentGroup", handler.CreateAgentGroup) + userRouter.POST("/UpdateAgentGroup", handler.UpdateAgentGroup) + userRouter.POST("/DeleteAgentGroup", handler.DeleteAgentGroup) + userRouter.POST("/GetAgentGroup", handler.GetAgentGroup) + userRouter.POST("/ListAgentGroups", handler.ListAgentGroups) + userRouter.POST("/ListAgents", handler.ListAgentsInGroup) + userRouter.POST("/GetAppliedPipelineConfigsForAgentGroup", handler.GetAppliedPipelineConfigsForAgentGroup) + userRouter.POST("/GetAppliedInstanceConfigsForAgentGroup", handler.GetAppliedInstanceConfigsForAgentGroup) + + userRouter.POST("/CreatePipelineConfig", handler.CreatePipelineConfig) + userRouter.POST("/UpdatePipelineConfig", handler.UpdatePipelineConfig) + userRouter.POST("/DeletePipelineConfig", handler.DeletePipelineConfig) + userRouter.POST("/GetPipelineConfig", handler.GetPipelineConfig) + userRouter.POST("/ListPipelineConfigs", handler.ListPipelineConfigs) + userRouter.POST("/ApplyPipelineConfigToAgentGroup", handler.ApplyPipelineConfigToAgentGroup) + userRouter.POST("/RemovePipelineConfigFromAgentGroup", handler.RemovePipelineConfigFromAgentGroup) + userRouter.POST("/GetAppliedAgentGroupsWithPipelineConfig", handler.GetAppliedAgentGroupsWithPipelineConfig) + userRouter.POST("/GetPipelineConfigStatusList", handler.GetPipelineConfigStatusList) + + userRouter.POST("/CreateInstanceConfig", handler.CreateInstanceConfig) + userRouter.POST("/UpdateInstanceConfig", handler.UpdateInstanceConfig) + userRouter.POST("/DeleteInstanceConfig", handler.DeleteInstanceConfig) + userRouter.POST("/GetInstanceConfig", handler.GetInstanceConfig) + userRouter.POST("/ListInstanceConfigs", handler.ListInstanceConfigs) + userRouter.POST("/ApplyInstanceConfigToAgentGroup", handler.ApplyInstanceConfigToAgentGroup) + userRouter.POST("/RemoveInstanceConfigFromAgentGroup", handler.RemoveInstanceConfigFromAgentGroup) + userRouter.POST("/GetAppliedAgentGroupsWithInstanceConfig", handler.GetAppliedAgentGroupsWithInstanceConfig) + userRouter.POST("/GetInstanceConfigStatusList", handler.GetInstanceConfigStatusList) + } + +} + +func initAgentRouter(router *gin.Engine) { + agentRouter := router.Group("/Agent") + { + agentRouter.POST("/Heartbeat", handler.HeartBeat) + agentRouter.POST("/FetchPipelineConfig", handler.FetchPipelineConfig) + agentRouter.POST("/FetchInstanceConfig", handler.FetchInstanceConfig) + } + handler.CheckAgentExist() +} + +func initTest(router *gin.Engine) { + testRouter := router.Group("/Test") + { + testRouter.GET("", func(c *gin.Context) { + c.JSON(200, gin.H{ + "config-server": "connect success", + }) + }) + } +} + +func InitAllRouter(router *gin.Engine, env string) { + initAgentRouter(router) + initUserRouter(router) + if env != "prod" { + initTest(router) + } +} diff --git a/config_server/v2/service/service/agent.go b/config_server/v2/service/service/agent.go new file mode 100644 index 0000000000..81b20a66ed --- /dev/null +++ b/config_server/v2/service/service/agent.go @@ -0,0 +1,167 @@ +package service + +import ( + "config-server/common" + "config-server/entity" + "config-server/manager" + "config-server/manager/state" + proto "config-server/protov2" + "config-server/repository" + "config-server/utils" + "time" +) + +// CheckAgentExist 确认心跳,失败则下线对应的实例 +func CheckAgentExist(timeLimit int64) { + utils.TimedTask(timeLimit, func(timeLimitParam int64) { + timeLimitNano := timeLimitParam * int64(time.Second) + utils.ParallelProcessSlice[entity.Agent](manager.GetAllAgentsBasicInfo(), + func(_ int, agentInfo entity.Agent) { + manager.RemoveAgentNow(&agentInfo, timeLimitNano) + }) + }) +} + +func createDefaultGroupWhenStart() { + group := &entity.AgentGroup{ + Name: entity.AgentGroupDefaultValue, + Value: entity.AgentGroupDefaultValue, + } + var err error + _, err = repository.GetAgentGroupDetail(entity.AgentGroupDefaultValue, false, false) + if err == nil { + // Default agent group exists + return + } + err = repository.CreateAgentGroup(group) + if err != nil { + panic("init default group failed...") + } +} + +func init() { + createDefaultGroupWhenStart() +} + +// 业务逻辑链 service/agent => {manager/state/*、manager/agent、manager/pipeline_config、manager/instance_config} +//=>{repository/agent、repository/pipeline_config、repository/instance_config} + +func HeartBeat(req *proto.HeartbeatRequest, res *proto.HeartbeatResponse) error { + instanceId := req.InstanceId + if instanceId == nil { + return common.ValidateErrorWithMsg("required field instanceId could not be null") + } + + var err error + sequenceNum := req.SequenceNum + var strInstanceId = string(instanceId) + rationality := manager.JudgeSequenceNumRationality(strInstanceId, sequenceNum) + + //假设数据库保存的sequenceNum=3,agent给的是10, + //如果在判断rationality=false立即return,数据库中保存的一直是3,agent一直重传全部状态 + if !rationality { + res.Flags = res.Flags | uint64(state.ReportFullState.Code) + } + + currentHeatBeatTime := time.Now().UnixNano() + req.Tags = manager.AddDefaultAgentGroup(req.Tags) + agent := entity.ParseHeartBeatRequest2BasicAgent(req, currentHeatBeatTime) + + //Regardless of whether sequenceN is legal or not, we should keep the basic information of the agent (sequenceNum, instanceId, capabilities, flags, etc.) + err = manager.CreateOrUpdateAgentBasicInfo(agent) + if err != nil { + return common.SystemError(err) + } + + //如果req未设置fullState,agent不会上传configStatus + err = state.HandleRequestFlags(req, res) + if err != nil { + return common.SystemError(err) + } + + err = state.HandleAgentCapabilities(req, res) + if err != nil { + return common.SystemError(err) + } + return nil +} + +// 心跳检测中的tag只是为了获取某个组的配置,而不是让某个agent加入到某个组 +//业务逻辑链 service/agent=>{manager/pipeline_config}=>{repository/agent、repository/pipeline_config} + +func FetchPipelineConfigDetail(req *proto.FetchConfigRequest, res *proto.FetchConfigResponse) error { + instanceId := req.InstanceId + if instanceId == nil { + return common.ValidateErrorWithMsg("required field instanceId could not be null") + } + + var err error + strInstanceId := string(instanceId) + + //需要更新配置状态 + err = manager.SavePipelineConfigStatus(req.ReqConfigs, strInstanceId) + if err != nil { + return common.SystemError(err) + } + + configNames := utils.Map(req.ReqConfigs, func(info *proto.ConfigInfo) string { + return info.Name + }) + pipelineConfigUpdates, err := repository.GetPipelineConfigByNames(configNames...) + if err != nil { + return err + } + + res.ConfigDetails = utils.Map(pipelineConfigUpdates, func(config *entity.PipelineConfig) *proto.ConfigDetail { + return config.Parse2ProtoPipelineConfigDetail(true) + }) + return nil +} + +//业务逻辑链 service/agent=>{manager/instance_config}=>{repository/agent、repository/instance_config} + +func FetchInstanceConfigDetail(req *proto.FetchConfigRequest, res *proto.FetchConfigResponse) error { + instanceId := req.InstanceId + if instanceId == nil { + return common.ValidateErrorWithMsg("required field instanceId could not be null") + } + + var err error + strInstanceId := string(instanceId) + + //需要更新配置状态 + err = manager.SaveInstanceConfigStatus(req.ReqConfigs, strInstanceId) + if err != nil { + return common.SystemError(err) + } + + configNames := utils.Map(req.ReqConfigs, func(info *proto.ConfigInfo) string { + return info.Name + }) + instanceConfigUpdates, err := repository.GetInstanceConfigByNames(configNames...) + if err != nil { + return err + } + + res.ConfigDetails = utils.Map(instanceConfigUpdates, func(config *entity.InstanceConfig) *proto.ConfigDetail { + return config.Parse2ProtoInstanceConfigDetail(true) + }) + return nil +} + +func ListAgentsInGroup(req *proto.ListAgentsRequest, res *proto.ListAgentsResponse) error { + groupName := req.GroupName + if groupName == "" { + return common.ValidateErrorWithMsg("required fields groupName could not be null") + } + agents, err := repository.ListAgentsByGroupName(groupName) + if err != nil { + return common.SystemError(err) + } + protoAgents := make([]*proto.Agent, 0) + for _, agent := range agents { + protoAgents = append(protoAgents, (*agent).Parse2Proto()) + } + res.Agents = protoAgents + return nil +} diff --git a/config_server/v2/service/service/agent_group.go b/config_server/v2/service/service/agent_group.go new file mode 100644 index 0000000000..00abbfb26d --- /dev/null +++ b/config_server/v2/service/service/agent_group.go @@ -0,0 +1,100 @@ +package service + +import ( + "config-server/common" + "config-server/entity" + proto "config-server/protov2" + "config-server/repository" + "config-server/utils" +) + +func CreateAgentGroup(req *proto.CreateAgentGroupRequest, res *proto.CreateAgentGroupResponse) error { + agentGroup := req.AgentGroup + if agentGroup == nil { + return common.ValidateErrorWithMsg("required field agentGroup could not be null") + } + if utils.IsEmptyOrWhitespace(agentGroup.Name) { + return common.ValidateErrorWithMsg("required field agentGroupName could not be null") + } + + group := entity.ParseProtoAgentGroupTag2AgentGroup(agentGroup) + err := repository.CreateAgentGroup(group) + return common.SystemError(err) +} + +func UpdateAgentGroup(req *proto.UpdateAgentGroupRequest, res *proto.UpdateAgentGroupResponse) error { + agentGroup := req.AgentGroup + if agentGroup == nil { + return common.ValidateErrorWithMsg("required field agentGroup could not be null") + } + group := entity.ParseProtoAgentGroupTag2AgentGroup(agentGroup) + err := repository.UpdateAgentGroup(group) + return common.SystemError(err) +} + +func DeleteAgentGroup(req *proto.DeleteAgentGroupRequest, res *proto.DeleteAgentGroupResponse) error { + agentGroupName := req.GroupName + if agentGroupName == "" { + return common.ValidateErrorWithMsg("required field groupName could not be null") + } + if req.GroupName == entity.AgentGroupDefaultValue { + return common.ServerErrorWithMsg(common.InvalidParameter, "%s can not be deleted", entity.AgentGroupDefaultValue) + } + err := repository.DeleteAgentGroup(agentGroupName) + return common.SystemError(err) +} + +func GetAgentGroup(req *proto.GetAgentGroupRequest, res *proto.GetAgentGroupResponse) error { + agentGroupName := req.GroupName + if agentGroupName == "" { + return common.ValidateErrorWithMsg("required field groupName could not be null") + } + + agentGroup, err := repository.GetAgentGroupDetail(agentGroupName, false, false) + if err != nil { + return common.SystemError(err) + } + res.AgentGroup = agentGroup.Parse2ProtoAgentGroupTag() + return nil +} + +func ListAgentGroups(req *proto.ListAgentGroupsRequest, res *proto.ListAgentGroupsResponse) error { + agentGroups, err := repository.GetAllAgentGroup() + if err != nil { + return common.SystemError(err) + } + protoAgentGroups := make([]*proto.AgentGroupTag, 0) + for _, agentGroup := range agentGroups { + protoAgentGroups = append(protoAgentGroups, agentGroup.Parse2ProtoAgentGroupTag()) + } + res.AgentGroups = protoAgentGroups + return nil +} + +func GetAppliedAgentGroupsForPipelineConfigName(req *proto.GetAppliedAgentGroupsRequest, res *proto.GetAppliedAgentGroupsResponse) error { + configName := req.ConfigName + if configName == "" { + return common.ValidateErrorWithMsg("required fields configName could not be null") + } + + groupNames, err := repository.GetAppliedAgentGroupForPipelineConfigName(configName) + if err != nil { + return common.SystemError(err) + } + res.AgentGroupNames = groupNames + return nil +} + +func GetAppliedAgentGroupsForInstanceConfigName(req *proto.GetAppliedAgentGroupsRequest, res *proto.GetAppliedAgentGroupsResponse) error { + configName := req.ConfigName + if configName == "" { + return common.ValidateErrorWithMsg("required fields configName could not be null") + } + + groupNames, err := repository.GetAppliedAgentGroupForInstanceConfigName(configName) + if err != nil { + return common.SystemError(err) + } + res.AgentGroupNames = groupNames + return nil +} diff --git a/config_server/v2/service/service/instance_config.go b/config_server/v2/service/service/instance_config.go new file mode 100644 index 0000000000..7b3d480845 --- /dev/null +++ b/config_server/v2/service/service/instance_config.go @@ -0,0 +1,141 @@ +package service + +import ( + "config-server/common" + "config-server/entity" + proto "config-server/protov2" + "config-server/repository" + "config-server/utils" +) + +func CreateInstanceConfig(req *proto.CreateConfigRequest, res *proto.CreateConfigResponse) error { + configDetail := req.ConfigDetail + if utils.IsEmptyOrWhitespace(configDetail.Name) { + return common.ValidateErrorWithMsg("required field configName could not be null") + } + + if configDetail.Version <= 0 { + return common.ValidateErrorWithMsg("required field version could not less than 0") + } + + instanceConfig := entity.ParseProtoInstanceConfig2InstanceConfig(configDetail) + err := repository.CreateInstanceConfig(instanceConfig) + return common.SystemError(err) + +} + +func UpdateInstanceConfig(req *proto.UpdateConfigRequest, res *proto.UpdateConfigResponse) error { + configDetail := req.ConfigDetail + if configDetail.Name == "" { + return common.ValidateErrorWithMsg("required field configName could not be null") + } + + if configDetail.Version == 0 { + return common.ValidateErrorWithMsg("required field version could not be null") + } + configDetail.Version += 1 + instanceConfig := entity.ParseProtoInstanceConfig2InstanceConfig(configDetail) + err := repository.UpdateInstanceConfig(instanceConfig) + return common.SystemError(err) +} + +func DeleteInstanceConfig(req *proto.DeleteConfigRequest, res *proto.DeleteConfigResponse) error { + configName := req.ConfigName + if configName == "" { + return common.ValidateErrorWithMsg("required field configName could not be null") + } + err := repository.DeleteInstanceConfig(configName) + return common.SystemError(err) +} + +func GetInstanceConfig(req *proto.GetConfigRequest, res *proto.GetConfigResponse) error { + configName := req.ConfigName + if configName == "" { + return common.ValidateErrorWithMsg("required field configName could not be null") + } + + instanceConfig, err := repository.GetInstanceConfig(configName) + if err != nil { + return common.SystemError(err) + } + if instanceConfig != nil { + res.ConfigDetail = instanceConfig.Parse2ProtoInstanceConfigDetail(true) + } + return common.SystemError(err) +} + +func ListInstanceConfigs(req *proto.ListConfigsRequest, res *proto.ListConfigsResponse) error { + instanceConfigs, err := repository.ListInstanceConfigs() + if err != nil { + return common.SystemError(err) + } + + for _, instanceConfig := range instanceConfigs { + res.ConfigDetails = append(res.ConfigDetails, instanceConfig.Parse2ProtoInstanceConfigDetail(true)) + } + return nil +} + +func ApplyInstanceConfigToAgentGroup(req *proto.ApplyConfigToAgentGroupRequest, res *proto.ApplyConfigToAgentGroupResponse) error { + groupName := req.GroupName + if groupName == "" { + return common.ValidateErrorWithMsg("required fields groupName could not be null") + } + configName := req.ConfigName + if configName == "" { + return common.ValidateErrorWithMsg("required fields configName could not be null") + } + + var err error + err = repository.CreateInstanceConfigForAgentGroup(groupName, configName) + if err != nil { + return common.SystemError(err) + } + return nil +} + +func RemoveInstanceConfigFromAgentGroup(req *proto.RemoveConfigFromAgentGroupRequest, res *proto.RemoveConfigFromAgentGroupResponse) error { + groupName := req.GroupName + if groupName == "" { + return common.ValidateErrorWithMsg("required fields groupName could not be null") + } + configName := req.ConfigName + + err := repository.DeleteInstanceConfigForAgentGroup(groupName, configName) + if err != nil { + return common.SystemError(err) + } + return nil +} + +func GetAppliedInstanceConfigsForAgentGroup(req *proto.GetAppliedConfigsForAgentGroupRequest, res *proto.GetAppliedConfigsForAgentGroupResponse) error { + groupName := req.GroupName + if groupName == "" { + return common.ValidateErrorWithMsg("required fields groupName could not be null") + } + + agentGroupDetail, err := repository.GetAgentGroupDetail(groupName, false, true) + if err != nil { + return common.SystemError(err) + } + configNames := make([]string, 0) + for _, config := range agentGroupDetail.InstanceConfigs { + configNames = append(configNames, config.Name) + } + + res.ConfigNames = configNames + return nil +} + +func GetInstanceConfigStatusList(req *proto.GetConfigStatusListRequest, res *proto.GetConfigStatusListResponse) error { + instanceId := req.InstanceId + if instanceId == nil { + return common.ValidateErrorWithMsg("required fields instanceId could not be null") + } + agent, err := repository.GetAgentByID(string(instanceId), "instance_id", "instance_config_statuses") + if err != nil { + return common.SystemError(err) + } + res.ConfigStatus = agent.InstanceConfigStatuses.Parse2ProtoConfigStatus() + return nil +} diff --git a/config_server/v2/service/service/pipeline_config.go b/config_server/v2/service/service/pipeline_config.go new file mode 100644 index 0000000000..9a19040563 --- /dev/null +++ b/config_server/v2/service/service/pipeline_config.go @@ -0,0 +1,144 @@ +package service + +import ( + "config-server/common" + "config-server/entity" + proto "config-server/protov2" + "config-server/repository" + "config-server/utils" +) + +func CreatePipelineConfig(req *proto.CreateConfigRequest, res *proto.CreateConfigResponse) error { + configDetail := req.ConfigDetail + if utils.IsEmptyOrWhitespace(configDetail.Name) { + return common.ValidateErrorWithMsg("required field configName could not be null") + } + + if configDetail.Version <= 0 { + return common.ValidateErrorWithMsg("required field version could not less than 0") + } + + pipelineConfig := entity.ParseProtoPipelineConfig2PipelineConfig(configDetail) + err := repository.CreatePipelineConfig(pipelineConfig) + return common.SystemError(err) + +} + +//更新配置的时候version也要更新 + +func UpdatePipelineConfig(req *proto.UpdateConfigRequest, res *proto.UpdateConfigResponse) error { + configDetail := req.ConfigDetail + if configDetail.Name == "" { + return common.ValidateErrorWithMsg("required field configName could not be null") + } + + if configDetail.Version == 0 { + return common.ValidateErrorWithMsg("required field version could not be null") + } + configDetail.Version += 1 + pipelineConfig := entity.ParseProtoPipelineConfig2PipelineConfig(configDetail) + err := repository.UpdatePipelineConfig(pipelineConfig) + return common.SystemError(err) +} + +func DeletePipelineConfig(req *proto.DeleteConfigRequest, res *proto.DeleteConfigResponse) error { + configName := req.ConfigName + if configName == "" { + return common.ValidateErrorWithMsg("required field configName could not be null") + } + err := repository.DeletePipelineConfig(configName) + return common.SystemError(err) +} + +func GetPipelineConfig(req *proto.GetConfigRequest, res *proto.GetConfigResponse) error { + configName := req.ConfigName + if configName == "" { + return common.ValidateErrorWithMsg("required field configName could not be null") + } + + pipelineConfig, err := repository.GetPipelineConfig(configName) + if err != nil { + return common.SystemError(err) + } + if pipelineConfig != nil { + res.ConfigDetail = pipelineConfig.Parse2ProtoPipelineConfigDetail(true) + } + return common.SystemError(err) +} + +func ListPipelineConfigs(req *proto.ListConfigsRequest, res *proto.ListConfigsResponse) error { + pipelineConfigs, err := repository.ListPipelineConfigs() + if err != nil { + return common.SystemError(err) + } + + for _, pipelineConfig := range pipelineConfigs { + res.ConfigDetails = append(res.ConfigDetails, pipelineConfig.Parse2ProtoPipelineConfigDetail(true)) + } + return nil +} + +func ApplyPipelineConfigToAgentGroup(req *proto.ApplyConfigToAgentGroupRequest, res *proto.ApplyConfigToAgentGroupResponse) error { + groupName := req.GroupName + if groupName == "" { + return common.ValidateErrorWithMsg("required fields groupName could not be null") + } + configName := req.ConfigName + if configName == "" { + return common.ValidateErrorWithMsg("required fields configName could not be null") + } + + var err error + err = repository.CreatePipelineConfigForAgentGroup(groupName, configName) + if err != nil { + return common.SystemError(err) + } + + return nil +} + +func RemovePipelineConfigFromAgentGroup(req *proto.RemoveConfigFromAgentGroupRequest, res *proto.RemoveConfigFromAgentGroupResponse) error { + groupName := req.GroupName + if groupName == "" { + return common.ValidateErrorWithMsg("required fields groupName could not be null") + } + configName := req.ConfigName + + err := repository.DeletePipelineConfigForAgentGroup(groupName, configName) + if err != nil { + return common.SystemError(err) + } + return nil +} + +func GetAppliedPipelineConfigsForAgentGroup(req *proto.GetAppliedConfigsForAgentGroupRequest, res *proto.GetAppliedConfigsForAgentGroupResponse) error { + groupName := req.GroupName + if groupName == "" { + return common.ValidateErrorWithMsg("required fields groupName could not be null") + } + + agentGroupDetail, err := repository.GetAgentGroupDetail(groupName, true, false) + if err != nil { + return common.SystemError(err) + } + configNames := make([]string, 0) + for _, config := range agentGroupDetail.PipelineConfigs { + configNames = append(configNames, config.Name) + } + + res.ConfigNames = configNames + return nil +} + +func GetPipelineConfigStatusList(req *proto.GetConfigStatusListRequest, res *proto.GetConfigStatusListResponse) error { + instanceId := req.InstanceId + if instanceId == nil { + return common.ValidateErrorWithMsg("required fields instanceId could not be null") + } + agent, err := repository.GetAgentByID(string(instanceId), "instance_id", "pipeline_config_statuses") + if err != nil { + return common.SystemError(err) + } + res.ConfigStatus = agent.PipelineConfigStatuses.Parse2ProtoConfigStatus() + return nil +} diff --git a/config_server/v2/service/store/gorm.go b/config_server/v2/service/store/gorm.go new file mode 100644 index 0000000000..ae731733b5 --- /dev/null +++ b/config_server/v2/service/store/gorm.go @@ -0,0 +1,167 @@ +package store + +import ( + "config-server/config" + "config-server/entity" + "fmt" + "gorm.io/gorm" + "log" +) + +var S = new(GormStore) + +type GormStore struct { + Config *config.GormConfig + Db *gorm.DB +} + +var tableList = []any{ + &entity.InstanceConfig{}, + &entity.PipelineConfig{}, + &entity.AgentGroup{}, + &entity.Agent{}, +} + +var tableNameList = []string{ + entity.AgentGroup{}.TableName(), + entity.AgentAgentGroupTable, + + entity.AgentGroupInstanceConfigTable, + entity.AgentGroupPipelineConfigTable, + + entity.Agent{}.TableName(), + + entity.InstanceConfig{}.TableName(), + entity.PipelineConfig{}.TableName(), +} + +func (s *GormStore) Connect2Db() error { + var err error + var dialect gorm.Dialector + s.Config, dialect, err = config.Connect2Db() + if err != nil { + return err + } + log.Printf("test connect database type=%s host=%s:%d ...", + s.Config.Type, s.Config.Host, s.Config.Port) + s.Db, err = gorm.Open(dialect) + if err != nil { + return err + } + dbName := s.Config.DbName + log.Printf("create or connect database %s ...", dbName) + err = s.Db.Exec(fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s", dbName)).Error + if err != nil { + return err + } + log.Printf("create or connect database %s success ...", dbName) + log.Printf("check %s ...", dbName) + err = s.Db.Exec(fmt.Sprintf("USE %s", s.Config.DbName)).Error + if err != nil { + return err + } + log.Printf("check %s success", dbName) + return nil +} + +func (s *GormStore) Connect2SpecifiedDb() error { + var err error + var dialect gorm.Dialector + s.Config, dialect, err = config.Connect2SpecifiedDb() + if err != nil { + return err + } + dbName := s.Config.DbName + log.Printf("test connect database type=%s host=%s:%d dbName=%s ...", + s.Config.Type, s.Config.Host, s.Config.Port, dbName) + s.Db, err = gorm.Open(dialect) + if err != nil { + return err + } + log.Printf("sucess connect database type=%s host=%s:%d dbName=%s ...", + s.Config.Type, s.Config.Host, s.Config.Port, dbName) + return nil +} + +func (s *GormStore) Close() error { + db, err := s.Db.DB() + if err != nil { + return err + } + return db.Close() +} + +func (s *GormStore) CreateTables() error { + //AgentPipeConfig和AgentInstanceConfig要额外autoMigrate是因为他们有多余的属性 + log.Printf("create tables ...") + err := s.Db.AutoMigrate(tableList...) + if err != nil { + return err + } + log.Printf("create tables success ...") + return nil +} + +func (s *GormStore) DeleteTables() error { + var err error + s.Db.Exec("SET FOREIGN_KEY_CHECKS = 0;") + for _, tableName := range tableNameList { + if s.Db.Migrator().HasTable(tableName) { + + err = s.Db.Migrator().DropTable(tableName) + if err != nil { + return err + } + } + } + return nil +} + +func (s *GormStore) DeleteTable() error { + var err error + s.Db.Exec("SET FOREIGN_KEY_CHECKS = 0;") + for _, tableName := range tableNameList { + if s.Db.Migrator().HasTable(tableName) { + var clearDataSql = fmt.Sprintf("TRUNCATE TABLE %s", tableName) + err = s.Db.Exec(clearDataSql).Error + if err != nil { + return err + } + } + } + return nil +} + +func init() { + var err error + err = S.Connect2Db() + if err != nil { + panic(err) + } + if S.Config.AutoMigrate { + err = S.CreateTables() + if err != nil { + panic(err) + } + } + err = S.Connect2SpecifiedDb() + if err != nil { + panic(err) + } +} + +func Init() { + var err error + err = S.CreateTables() + if err != nil { + panic(err) + } +} + +func Delete() { + var err error + err = S.DeleteTables() + if err != nil { + panic(err) + } +} diff --git a/config_server/v2/service/store/gorm_test.go b/config_server/v2/service/store/gorm_test.go new file mode 100644 index 0000000000..d8c6311216 --- /dev/null +++ b/config_server/v2/service/store/gorm_test.go @@ -0,0 +1,13 @@ +package store + +import ( + "testing" +) + +func TestInitConfigServerDatabase(t *testing.T) { + Init() +} + +func TestDeleteConfigServerDatabase(t *testing.T) { + Delete() +} diff --git a/config_server/v2/service/store/store.go b/config_server/v2/service/store/store.go new file mode 100644 index 0000000000..b97d826992 --- /dev/null +++ b/config_server/v2/service/store/store.go @@ -0,0 +1,8 @@ +package store + +type Store interface { + Connect() error + Close() error + + CreateTables() error +} diff --git a/config_server/v2/service/test/api_test.go b/config_server/v2/service/test/api_test.go new file mode 100644 index 0000000000..f86a8cea5c --- /dev/null +++ b/config_server/v2/service/test/api_test.go @@ -0,0 +1,581 @@ +package test + +import ( + "config-server/common" + "config-server/protov2" + "config-server/test/request" + "fmt" + . "github.com/smartystreets/goconvey/convey" + "math/rand" + "testing" + "time" +) + +const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + +func generateRandomNum(length int) []byte { + seededRand := rand.New(rand.NewSource(time.Now().UnixNano())) + b := make([]byte, length) + for i := range b { + b[i] = charset[seededRand.Intn(len(charset))] + } + return b +} + +func TestBaseAgent(t *testing.T) { + requestId := generateRandomNum(10) + Convey("Test delete AgentGroup.", t, func() { + fmt.Print("\n" + "Test delete default. ") + { + res, _ := request.DeleteAgentGroup(requestId, "default") + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, common.InvalidParameter.Code) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, common.InvalidParameter.Message) + + } + }) +} + +func TestBasePipelineConfig(t *testing.T) { + + var configLength int + + Convey("Test create PipelineConfig.", t, func() { + + fmt.Print("\n" + "Test get all configs. ") + { + requestId := generateRandomNum(10) + res, _ := request.GetAllPipelineConfig(requestId) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + configLength = len(res.ConfigDetails) + } + + fmt.Print("\n" + "Test create config-1. ") + { + requestId := generateRandomNum(10) + detail := &protov2.ConfigDetail{ + Name: "config-1", + Detail: []byte("Detail for test config-1"), + } + res, _ := request.CreatePipelineConfig(requestId, detail) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, common.InvalidParameter.Code) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, common.InvalidParameter.Message) + } + + fmt.Print("\n" + "Test create config-1. ") + { + requestId := generateRandomNum(10) + detail := &protov2.ConfigDetail{ + Name: "config-1", + Version: 1, + Detail: []byte("Detail for test config-1"), + } + res, _ := request.CreatePipelineConfig(requestId, detail) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + } + + fmt.Print("\n" + "Test get config-1. ") + { + requestId := generateRandomNum(10) + configName := "config-1" + + res, _ := request.GetPipelineConfig(requestId, configName) + + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + So(res.ConfigDetail.Name, ShouldEqual, configName) + So(res.ConfigDetail.Version, ShouldEqual, 1) + So(string(res.ConfigDetail.Detail), ShouldEqual, "Detail for test config-1") + } + + fmt.Print("\n" + "Test create config-1. ") + { + requestId := generateRandomNum(10) + detail := &protov2.ConfigDetail{ + Name: "config-1", + Version: 1, + Detail: []byte("Detail for test config-1"), + } + res, _ := request.CreatePipelineConfig(requestId, detail) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, common.ConfigAlreadyExist.Code) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, common.ConfigAlreadyExist.Message) + } + + fmt.Print("\n" + "Test get all configs. ") + { + requestId := generateRandomNum(10) + res, _ := request.GetAllPipelineConfig(requestId) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + So(len(res.ConfigDetails), ShouldEqual, configLength+1) + } + + fmt.Print("\n" + "Test create config-2. ") + { + requestId := generateRandomNum(10) + detail := &protov2.ConfigDetail{ + Name: "config-2", + Version: 1, + Detail: []byte("Detail for test config-2"), + } + res, _ := request.CreatePipelineConfig(requestId, detail) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + + } + + fmt.Print("\n" + "Test create config-2. ") + { + requestId := generateRandomNum(10) + detail := &protov2.ConfigDetail{ + Name: "config-2", + Version: 1, + Detail: []byte("Detail for test config-2"), + } + res, _ := request.CreatePipelineConfig(requestId, detail) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, common.ConfigAlreadyExist.Code) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, common.ConfigAlreadyExist.Message) + } + + fmt.Print("\n" + "Test get config-2. ") + { + requestId := generateRandomNum(10) + configName := "config-2" + + res, _ := request.GetPipelineConfig(requestId, configName) + + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + So(res.ConfigDetail.Name, ShouldEqual, configName) + So(res.ConfigDetail.Version, ShouldEqual, 1) + So(string(res.ConfigDetail.Detail), ShouldEqual, "Detail for test config-2") + } + + }) + + Convey("Test update PipelineConfig.", t, func() { + + fmt.Print("\n" + "Test update config-1. ") + { + requestId := generateRandomNum(10) + detail := &protov2.ConfigDetail{ + Name: "config-1", + Version: 1, + Detail: []byte("Detail for update config-1"), + } + res, _ := request.UpdatePipelineConfig(requestId, detail) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + } + + fmt.Print("\n" + "Test get config-1. ") + { + requestId := generateRandomNum(10) + configName := "config-1" + + res, _ := request.GetPipelineConfig(requestId, configName) + + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + So(res.ConfigDetail.Name, ShouldEqual, configName) + So(res.ConfigDetail.Version, ShouldEqual, 2) + So(string(res.ConfigDetail.Detail), ShouldEqual, "Detail for update config-1") + } + + fmt.Print("\n" + "Test update config-2. ") + { + requestId := generateRandomNum(10) + detail := &protov2.ConfigDetail{ + Name: "config-2", + Version: 1, + Detail: []byte("Detail for update config-2"), + } + res, _ := request.UpdatePipelineConfig(requestId, detail) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + } + + fmt.Print("\n" + "Test get config-2. ") + { + requestId := generateRandomNum(10) + configName := "config-2" + + res, _ := request.GetPipelineConfig(requestId, configName) + + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + So(res.ConfigDetail.Name, ShouldEqual, configName) + So(res.ConfigDetail.Version, ShouldEqual, 2) + So(string(res.ConfigDetail.Detail), ShouldEqual, "Detail for update config-2") + } + + fmt.Print("\n" + "Test get config-3. ") + { + requestId := generateRandomNum(10) + configName := "config-3" + + res, _ := request.GetPipelineConfig(requestId, configName) + + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, common.ConfigNotExist.Code) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, common.ConfigNotExist.Message) + } + + fmt.Print("\n" + "Test get all configs. ") + { + requestId := generateRandomNum(10) + res, _ := request.GetAllPipelineConfig(requestId) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + So(len(res.ConfigDetails), ShouldEqual, configLength+2) + } + + }) + + Convey("Test delete PipelineConfig.", t, func() { + + fmt.Print("\n" + "Test delete config-1. ") + { + requestId := generateRandomNum(10) + configName := "config-1" + + res, _ := request.DeletePipelineConfig(requestId, configName) + + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + + } + + fmt.Print("\n" + "Test get config-1. ") + { + requestId := generateRandomNum(10) + configName := "config-1" + + res, _ := request.GetPipelineConfig(requestId, configName) + + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, common.ConfigNotExist.Code) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, common.ConfigNotExist.Message) + } + + fmt.Print("\n" + "Test create config-1. ") + { + requestId := generateRandomNum(10) + detail := &protov2.ConfigDetail{ + Name: "config-1", + Version: 1, + Detail: []byte("Detail for test config-1"), + } + res, _ := request.CreatePipelineConfig(requestId, detail) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + + } + + fmt.Print("\n" + "Test get config-1. ") + { + requestId := generateRandomNum(10) + configName := "config-1" + + res, _ := request.GetPipelineConfig(requestId, configName) + + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + So(res.ConfigDetail.Name, ShouldEqual, configName) + So(res.ConfigDetail.Version, ShouldEqual, 1) + So(string(res.ConfigDetail.Detail), ShouldEqual, "Detail for test config-1") + } + + fmt.Print("\n" + "Test delete config-1. ") + { + requestId := generateRandomNum(10) + configName := "config-1" + + res, _ := request.DeletePipelineConfig(requestId, configName) + + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + + } + + fmt.Print("\n" + "Test get config-1. ") + { + requestId := generateRandomNum(10) + configName := "config-1" + + res, _ := request.GetPipelineConfig(requestId, configName) + + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, common.ConfigNotExist.Code) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, common.ConfigNotExist.Message) + } + + fmt.Print("\n" + "Test delete config-2. ") + { + requestId := generateRandomNum(10) + configName := "config-2" + + res, _ := request.DeletePipelineConfig(requestId, configName) + + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + + } + + fmt.Print("\n" + "Test get config-2. ") + { + requestId := generateRandomNum(10) + configName := "config-2" + + res, _ := request.GetPipelineConfig(requestId, configName) + + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, common.ConfigNotExist.Code) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, common.ConfigNotExist.Message) + } + + fmt.Print("\n" + "Test get all configs. ") + { + requestId := generateRandomNum(10) + res, _ := request.GetAllPipelineConfig(requestId) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + So(len(res.ConfigDetails), ShouldEqual, configLength) + } + }) +} + +func TestOperationBetweenAgentGroupAndPipelineConfig(t *testing.T) { + Convey("Test apply PipelineConfig.", t, func() { + var defaultGroupConfigLength int + fmt.Print("\n" + "Test get default's Configs. ") + { + requestId := generateRandomNum(10) + groupName := "default" + res, _ := request.GetAppliedPipelineConfigForAgentGroup(requestId, groupName) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + defaultGroupConfigLength = len(res.ConfigNames) + } + + fmt.Print("\n" + "Test create config-1. ") + { + requestId := generateRandomNum(10) + detail := &protov2.ConfigDetail{ + Name: "config-1", + Version: 1, + Detail: []byte("Detail for test config-1"), + } + res, _ := request.CreatePipelineConfig(requestId, detail) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + } + + fmt.Print("\n" + "Test create config-2. ") + { + requestId := generateRandomNum(10) + detail := &protov2.ConfigDetail{ + Name: "config-2", + Version: 1, + Detail: []byte("Detail for test config-2"), + } + res, _ := request.CreatePipelineConfig(requestId, detail) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + } + + fmt.Print("\n" + "Test apply config-1 to default. ") + { + requestId := generateRandomNum(10) + configName := "config-1" + groupName := "default" + res, _ := request.ApplyPipelineConfig2AgentGroup(requestId, configName, groupName) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + } + + fmt.Print("\n" + "Test get default's Configs. ") + { + requestId := generateRandomNum(10) + groupName := "default" + res, _ := request.GetAppliedPipelineConfigForAgentGroup(requestId, groupName) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + So(len(res.ConfigNames), ShouldEqual, defaultGroupConfigLength+1) + } + + fmt.Print("\n" + "Test get config-1's AgentGroups. ") + { + requestId := generateRandomNum(10) + configName := "config-1" + res, _ := request.GetAppliedAgentGroupForPipelineConfig(requestId, configName) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + } + + fmt.Print("\n" + "Test apply config-2 to default. ") + { + requestId := generateRandomNum(10) + configName := "config-2" + groupName := "default" + res, _ := request.ApplyPipelineConfig2AgentGroup(requestId, configName, groupName) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + } + + fmt.Print("\n" + "Test get default's Configs. ") + { + requestId := generateRandomNum(10) + groupName := "default" + res, _ := request.GetAppliedPipelineConfigForAgentGroup(requestId, groupName) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + So(len(res.ConfigNames), ShouldEqual, defaultGroupConfigLength+2) + } + + }) + + Convey("Test remove PipelineConfig or relationship between config and agentGroup", t, func() { + var defaultGroupConfigLength int + fmt.Print("\n" + "Test get default's Configs. ") + { + requestId := generateRandomNum(10) + groupName := "default" + res, _ := request.GetAppliedPipelineConfigForAgentGroup(requestId, groupName) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + defaultGroupConfigLength = len(res.ConfigNames) + } + + fmt.Print("\n" + "Test delete config-1. ") + { + requestId := generateRandomNum(10) + configName := "config-1" + + res, _ := request.DeletePipelineConfig(requestId, configName) + + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + + } + + fmt.Print("\n" + "Test get default's Configs. ") + { + requestId := generateRandomNum(10) + groupName := "default" + res, _ := request.GetAppliedPipelineConfigForAgentGroup(requestId, groupName) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + So(len(res.ConfigNames), ShouldEqual, defaultGroupConfigLength-1) + } + + fmt.Print("\n" + "Test remove config-2 from default. ") + { + requestId := generateRandomNum(10) + groupName := "default" + configName := "config-2" + res, _ := request.RemovePipelineConfigFromAgentGroup(requestId, configName, groupName) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + } + + fmt.Print("\n" + "Test get default's Configs. ") + { + requestId := generateRandomNum(10) + groupName := "default" + res, _ := request.GetAppliedPipelineConfigForAgentGroup(requestId, groupName) + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + So(len(res.ConfigNames), ShouldEqual, defaultGroupConfigLength-2) + } + + fmt.Print("\n" + "Test delete config-2. ") + { + requestId := generateRandomNum(10) + configName := "config-2" + + res, _ := request.DeletePipelineConfig(requestId, configName) + + // check + So(res.RequestId, ShouldEqual, requestId) + So(res.CommonResponse.Status, ShouldEqual, 0) + So(string(res.CommonResponse.ErrorMessage), ShouldEqual, "") + } + + }) +} + +func TestAgentSendMessage(t *testing.T) { + +} + +func TestAgentFetchPipelineConfig(t *testing.T) { + +} diff --git a/config_server/v2/service/test/cmd/config/dev/databaseConfig.json b/config_server/v2/service/test/cmd/config/dev/databaseConfig.json new file mode 100644 index 0000000000..6d5ce12582 --- /dev/null +++ b/config_server/v2/service/test/cmd/config/dev/databaseConfig.json @@ -0,0 +1,9 @@ +{ + "type": "mysql", + "userName": "root", + "password": "123456", + "host": "127.0.0.1", + "port": 3306, + "dbName": "test", + "autoMigrate": true +} \ No newline at end of file diff --git a/config_server/v2/service/test/cmd/config/dev/serverConfig.json b/config_server/v2/service/test/cmd/config/dev/serverConfig.json new file mode 100644 index 0000000000..e9cf7256c5 --- /dev/null +++ b/config_server/v2/service/test/cmd/config/dev/serverConfig.json @@ -0,0 +1,14 @@ +{ + "address": "0.0.0.0:9090", + "capabilities": { + "rememberAttribute": true, + "rememberPipelineConfigStatus": true, + "rememberInstanceConfigStatus": true, + "rememberCustomCommandStatus": false + }, + "responseFlags": { + "fetchPipelineConfigDetail": true, + "fetchInstanceConfigDetail": false + }, + "timeLimit": 60 +} \ No newline at end of file diff --git a/config_server/v2/service/test/common_test.go b/config_server/v2/service/test/common_test.go new file mode 100644 index 0000000000..b8939cc5f9 --- /dev/null +++ b/config_server/v2/service/test/common_test.go @@ -0,0 +1,10 @@ +package test + +import ( + "fmt" + "testing" +) + +func TestProto(t *testing.T) { + fmt.Println(generateRandomNum(10)) +} diff --git a/config_server/v2/service/test/request/agent.go b/config_server/v2/service/test/request/agent.go new file mode 100644 index 0000000000..1e6473e75c --- /dev/null +++ b/config_server/v2/service/test/request/agent.go @@ -0,0 +1,20 @@ +package request + +import ( + "config-server/protov2" + "fmt" +) + +func ListAgents(requestId []byte, groupName string) (*protov2.ListAgentsResponse, error) { + url := fmt.Sprintf("%s/ListAgents", UserUrlPrefix) + req := &protov2.ListAgentsRequest{} + res := &protov2.ListAgentsResponse{} + req.RequestId = requestId + req.GroupName = groupName + + err := sendProtobufRequest(url, POST, req, res) + if err != nil { + return nil, err + } + return res, nil +} diff --git a/config_server/v2/service/test/request/agent_group.go b/config_server/v2/service/test/request/agent_group.go new file mode 100644 index 0000000000..1491ec0fdc --- /dev/null +++ b/config_server/v2/service/test/request/agent_group.go @@ -0,0 +1,34 @@ +package request + +import ( + "config-server/protov2" + "fmt" +) + +func DeleteAgentGroup(requestId []byte, groupName string) (*protov2.DeleteAgentGroupResponse, error) { + url := fmt.Sprintf("%s/DeleteAgentGroup", UserUrlPrefix) + req := &protov2.DeleteAgentGroupRequest{} + res := &protov2.DeleteAgentGroupResponse{} + req.RequestId = requestId + req.GroupName = groupName + + err := sendProtobufRequest(url, POST, req, res) + if err != nil { + return nil, err + } + return res, nil +} + +func GetAppliedPipelineConfigForAgentGroup(requestId []byte, groupName string) (*protov2.GetAppliedConfigsForAgentGroupResponse, error) { + url := fmt.Sprintf("%s/GetAppliedPipelineConfigsForAgentGroup", UserUrlPrefix) + req := &protov2.GetAppliedConfigsForAgentGroupRequest{} + res := &protov2.GetAppliedConfigsForAgentGroupResponse{} + req.RequestId = requestId + req.GroupName = groupName + + err := sendProtobufRequest(url, POST, req, res) + if err != nil { + return nil, err + } + return res, nil +} diff --git a/config_server/v2/service/test/request/common.go b/config_server/v2/service/test/request/common.go new file mode 100644 index 0000000000..6673d79416 --- /dev/null +++ b/config_server/v2/service/test/request/common.go @@ -0,0 +1,53 @@ +package request + +import ( + "bytes" + "config-server/config" + "fmt" + "google.golang.org/protobuf/proto" + "io" + "net/http" +) + +var ( + UserUrlPrefix = fmt.Sprintf("http://%s/User", config.ServerConfigInstance.Address) + AgentUrlPrefix = fmt.Sprintf("http://%s/Agent", config.ServerConfigInstance.Address) +) + +const ( + GET = "GET" + POST = "POST" + DELETE = "DELETE" + PUT = "PUT" +) + +func sendProtobufRequest[T, S proto.Message](url string, methodType string, req T, res S) error { + var err error + data, err := proto.Marshal(req) + if err != nil { + return fmt.Errorf("failed to marshal request: %w", err) + } + + httpReq, err := http.NewRequest(methodType, url, bytes.NewReader(data)) + if err != nil { + return fmt.Errorf("failed to create request: %w", err) + } + httpReq.Header.Set("Content-Type", "application/x-protobuf") + + client := &http.Client{} + resp, err := client.Do(httpReq) + if err != nil { + return fmt.Errorf("failed to send request: %w", err) + } + defer resp.Body.Close() + + body, err := io.ReadAll(resp.Body) + if err != nil { + return fmt.Errorf("failed to read response body: %w", err) + } + + if err = proto.Unmarshal(body, res); err != nil { + return fmt.Errorf("failed to unmarshal response: %w", err) + } + return nil +} diff --git a/config_server/v2/service/test/request/instance_config.go b/config_server/v2/service/test/request/instance_config.go new file mode 100644 index 0000000000..725b8fc210 --- /dev/null +++ b/config_server/v2/service/test/request/instance_config.go @@ -0,0 +1 @@ +package request diff --git a/config_server/v2/service/test/request/pipeline_config.go b/config_server/v2/service/test/request/pipeline_config.go new file mode 100644 index 0000000000..332668691a --- /dev/null +++ b/config_server/v2/service/test/request/pipeline_config.go @@ -0,0 +1,119 @@ +package request + +import ( + "config-server/protov2" + "fmt" +) + +func CreatePipelineConfig(requestId []byte, detail *protov2.ConfigDetail) (*protov2.CreateConfigResponse, error) { + url := fmt.Sprintf("%s/CreatePipelineConfig", UserUrlPrefix) + req := &protov2.CreateConfigRequest{} + res := &protov2.CreateConfigResponse{} + req.RequestId = requestId + req.ConfigDetail = detail + + err := sendProtobufRequest(url, POST, req, res) + if err != nil { + return nil, err + } + return res, nil +} + +func GetPipelineConfig(requestId []byte, name string) (*protov2.GetConfigResponse, error) { + url := fmt.Sprintf("%s/GetPipelineConfig", UserUrlPrefix) + req := &protov2.GetConfigRequest{} + res := &protov2.GetConfigResponse{} + req.RequestId = requestId + req.ConfigName = name + + err := sendProtobufRequest(url, POST, req, res) + if err != nil { + return nil, err + } + return res, nil +} + +func GetAllPipelineConfig(requestId []byte) (*protov2.ListConfigsResponse, error) { + url := fmt.Sprintf("%s/ListPipelineConfigs", UserUrlPrefix) + req := &protov2.ListConfigsRequest{} + res := &protov2.ListConfigsResponse{} + req.RequestId = requestId + + err := sendProtobufRequest(url, POST, req, res) + if err != nil { + return nil, err + } + return res, nil +} + +func UpdatePipelineConfig(requestId []byte, detail *protov2.ConfigDetail) (*protov2.UpdateConfigResponse, error) { + url := fmt.Sprintf("%s/UpdatePipelineConfig", UserUrlPrefix) + req := &protov2.UpdateConfigRequest{} + res := &protov2.UpdateConfigResponse{} + req.RequestId = requestId + req.ConfigDetail = detail + + err := sendProtobufRequest(url, POST, req, res) + if err != nil { + return nil, err + } + return res, nil +} + +func DeletePipelineConfig(requestId []byte, name string) (*protov2.DeleteConfigResponse, error) { + url := fmt.Sprintf("%s/DeletePipelineConfig", UserUrlPrefix) + req := &protov2.DeleteConfigRequest{} + res := &protov2.DeleteConfigResponse{} + req.RequestId = requestId + req.ConfigName = name + + err := sendProtobufRequest(url, POST, req, res) + if err != nil { + return nil, err + } + return res, nil +} + +func ApplyPipelineConfig2AgentGroup(requestId []byte, configName string, agentGroupName string) (*protov2.ApplyConfigToAgentGroupResponse, error) { + url := fmt.Sprintf("%s/ApplyPipelineConfigToAgentGroup", UserUrlPrefix) + req := &protov2.ApplyConfigToAgentGroupRequest{} + res := &protov2.ApplyConfigToAgentGroupResponse{} + req.RequestId = requestId + req.ConfigName = configName + req.GroupName = agentGroupName + + err := sendProtobufRequest(url, POST, req, res) + if err != nil { + return nil, err + } + return res, nil +} + +func RemovePipelineConfigFromAgentGroup(requestId []byte, configName string, groupName string) (*protov2.RemoveConfigFromAgentGroupResponse, error) { + url := fmt.Sprintf("%s/RemovePipelineConfigFromAgentGroup", UserUrlPrefix) + req := &protov2.RemoveConfigFromAgentGroupRequest{} + res := &protov2.RemoveConfigFromAgentGroupResponse{} + req.RequestId = requestId + req.ConfigName = configName + req.GroupName = groupName + + err := sendProtobufRequest(url, POST, req, res) + if err != nil { + return nil, err + } + return res, nil +} + +func GetAppliedAgentGroupForPipelineConfig(requestId []byte, configName string) (*protov2.GetAppliedAgentGroupsResponse, error) { + url := fmt.Sprintf("%s/GetAppliedAgentGroupsWithPipelineConfig", UserUrlPrefix) + req := &protov2.GetAppliedAgentGroupsRequest{} + res := &protov2.GetAppliedAgentGroupsResponse{} + req.RequestId = requestId + req.ConfigName = configName + + err := sendProtobufRequest(url, POST, req, res) + if err != nil { + return nil, err + } + return res, nil +} diff --git a/config_server/v2/service/test/store_test.go b/config_server/v2/service/test/store_test.go new file mode 100644 index 0000000000..56e5404079 --- /dev/null +++ b/config_server/v2/service/test/store_test.go @@ -0,0 +1 @@ +package test diff --git a/config_server/v2/service/utils/environment.go b/config_server/v2/service/utils/environment.go new file mode 100644 index 0000000000..72bbc4ac3a --- /dev/null +++ b/config_server/v2/service/utils/environment.go @@ -0,0 +1,15 @@ +package utils + +import ( + "log" + "os" +) + +func GetEnvName() (string, error) { + name := os.Getenv("GO_ENV") + if name == "" { + name = "dev" + } + log.Printf("the environment is %s", name) + return name, nil +} diff --git a/config_server/v2/service/utils/json.go b/config_server/v2/service/utils/json.go new file mode 100644 index 0000000000..c8d60b5ab0 --- /dev/null +++ b/config_server/v2/service/utils/json.go @@ -0,0 +1,28 @@ +package utils + +import ( + "encoding/json" + "log" + "os" + "path/filepath" +) + +func ReadJson[T any](path string, obj *T) error { + file, openErr := os.Open(filepath.Clean(path)) + if openErr != nil { + return openErr + } + defer func() { + if closeErr := file.Close(); closeErr != nil { + log.Println("Error closing file: " + closeErr.Error()) + } + }() + + decoder := json.NewDecoder(file) + err := decoder.Decode(obj) + if err != nil { + return err + } + return nil + +} diff --git a/config_server/v2/service/utils/list.go b/config_server/v2/service/utils/list.go new file mode 100644 index 0000000000..f0e269c81d --- /dev/null +++ b/config_server/v2/service/utils/list.go @@ -0,0 +1,58 @@ +package utils + +func ContainElement[T, E comparable](arr []T, val E, eqCondition func(T, E) bool) bool { + if arr == nil || len(arr) == 0 { + return false + } + for _, element := range arr { + if eqCondition != nil && eqCondition(element, val) { + return true + } + } + return false +} + +func RemoveElement[T comparable](arr []T, val T, eqCondition func(T, T) bool) (bool, []T) { + if arr == nil || len(arr) == 0 { + return false, arr + } + for i, element := range arr { + if element == val || eqCondition != nil && eqCondition(element, val) { + return true, append(arr[:i], arr[i+1:]...) + } + } + return false, arr +} + +// ReplaceElement 如果存在就替换,不存在则返回原数组 +func ReplaceElement[T comparable](arr []T, val T, eqCondition func(T, any) bool) { + if eqCondition == nil { + return + } + if arr == nil || len(arr) == 0 { + return + } + for i, element := range arr { + if eqCondition(element, val) { + arr[i] = val + } + } +} + +func Filter[T comparable](arr []T, fn func(T) bool) []T { + finalArr := make([]T, 0) + for _, element := range arr { + if fn(element) { + finalArr = append(finalArr, element) + } + } + return finalArr +} + +func Map[T, E any](arr []T, fn func(T) E) []E { + finalArr := make([]E, 0) + for _, element := range arr { + finalArr = append(finalArr, fn(element)) + } + return finalArr +} diff --git a/config_server/v2/service/utils/str.go b/config_server/v2/service/utils/str.go new file mode 100644 index 0000000000..7c9b261336 --- /dev/null +++ b/config_server/v2/service/utils/str.go @@ -0,0 +1,7 @@ +package utils + +import "strings" + +func IsEmptyOrWhitespace(s string) bool { + return strings.TrimSpace(s) == "" +} diff --git a/config_server/v2/service/utils/task.go b/config_server/v2/service/utils/task.go new file mode 100644 index 0000000000..15bcd43efd --- /dev/null +++ b/config_server/v2/service/utils/task.go @@ -0,0 +1,56 @@ +package utils + +import ( + "sync" + "time" +) + +func TimedTask(timeLimit int64, task func(int64)) { + if timeLimit <= 0 { + panic("timeLimit 不能小于等于0") + } + timeLimitNano := timeLimit * int64(time.Second) + + ticker := time.NewTicker(time.Duration(timeLimitNano)) + defer ticker.Stop() + + for { + select { + case <-ticker.C: + task(timeLimit) + } + } +} + +func ParallelProcessSlice[T any](arr []T, fun func(int, T)) { + if arr == nil || len(arr) == 0 { + return + } + var wg sync.WaitGroup + + for i, v := range arr { + wg.Add(1) + go func(index int, value T) { + defer wg.Done() + fun(index, value) + }(i, v) + } + + wg.Wait() +} + +func ParallelProcessTask[T any](parameter T, tasks ...func(T)) { + if tasks == nil || len(tasks) == 0 { + return + } + + var wg sync.WaitGroup + for i, task := range tasks { + wg.Add(1) + go func(index int, parameter T, taskFunc func(T)) { + defer wg.Done() + taskFunc(parameter) + }(i, parameter, task) + } + wg.Wait() +}