From 20045ab969d8bcadab5d1353bcdcde9f38cc6623 Mon Sep 17 00:00:00 2001 From: Tit Petric Date: Wed, 9 Oct 2024 16:26:04 +0200 Subject: [PATCH] Some reverts, some import fixes --- {internal/model => apidef}/health_check.go | 2 +- apidef/rpc.go | 59 ++++++++++++++++++++++ gateway/health_check.go | 7 +-- 3 files changed, 62 insertions(+), 6 deletions(-) rename {internal/model => apidef}/health_check.go (98%) create mode 100644 apidef/rpc.go diff --git a/internal/model/health_check.go b/apidef/health_check.go similarity index 98% rename from internal/model/health_check.go rename to apidef/health_check.go index c53dc568764..858c70e3b1e 100644 --- a/internal/model/health_check.go +++ b/apidef/health_check.go @@ -1,4 +1,4 @@ -package model +package apidef type ( HealthCheckStatus string diff --git a/apidef/rpc.go b/apidef/rpc.go new file mode 100644 index 00000000000..76904c51b1e --- /dev/null +++ b/apidef/rpc.go @@ -0,0 +1,59 @@ +package apidef + +type InboundData struct { + KeyName string + Value string + SessionState string + Timeout int64 + Per int64 + Expire int64 +} + +type DefRequest struct { + OrgId string + Tags []string + LoadOAS bool +} + +type GroupLoginRequest struct { + UserKey string + GroupID string + ForceSync bool + Node []byte +} + +// HostDetails contains information about a host machine, +// including its hostname, process ID (PID), and IP address. +type HostDetails struct { + Hostname string + PID int + Address string +} + +type NodeData struct { + NodeID string `json:"node_id"` + APIKey string `json:"api_key"` + GroupID string `json:"group_id"` + NodeVersion string `json:"node_version"` + TTL int64 `json:"ttl"` + NodeIsSegmented bool `json:"node_is_segmented"` + Tags []string `json:"tags"` + Health map[string]HealthCheckItem `json:"health"` + Stats GWStats `json:"stats"` + HostDetails HostDetails `json:"host_details"` +} + +type GWStats struct { + APIsCount int `json:"apis_count"` + PoliciesCount int `json:"policies_count"` +} + +type GroupKeySpaceRequest struct { + OrgID string + GroupID string +} + +type KeysValuesPair struct { + Keys []string + Values []string +} diff --git a/gateway/health_check.go b/gateway/health_check.go index fa78b948296..150387186ac 100644 --- a/gateway/health_check.go +++ b/gateway/health_check.go @@ -8,15 +8,12 @@ import ( "sync" "time" - "github.com/TykTechnologies/tyk/internal/model" - "github.com/TykTechnologies/tyk/rpc" - "github.com/sirupsen/logrus" "github.com/TykTechnologies/tyk/header" - "github.com/TykTechnologies/tyk/storage" - "github.com/TykTechnologies/tyk/internal/model" + "github.com/TykTechnologies/tyk/rpc" + "github.com/TykTechnologies/tyk/storage" ) func (gw *Gateway) setCurrentHealthCheckInfo(h map[string]model.HealthCheckItem) {