From e539447711f53f620ff3a3b413190d72bcf3cc84 Mon Sep 17 00:00:00 2001 From: danaelhe Date: Tue, 20 Aug 2024 11:59:10 -0400 Subject: [PATCH] Database: Namespace logsink --- databases.go | 20 ++++++++++---------- databases_test.go | 12 ++++++------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/databases.go b/databases.go index 3460948..b3cca2d 100644 --- a/databases.go +++ b/databases.go @@ -332,10 +332,10 @@ type DatabaseTopic struct { // DatabaseLogsink represents a logsink type DatabaseLogsink struct { - ID string `json:"sink_id"` - Name string `json:"sink_name,omitempty"` - Type string `json:"sink_type,omitempty"` - Config *LogsinkConfig `json:"config,omitempty"` + ID string `json:"sink_id"` + Name string `json:"sink_name,omitempty"` + Type string `json:"sink_type,omitempty"` + Config *DatabaseLogsinkConfig `json:"config,omitempty"` } // TopicPartition represents the state of a Kafka topic partition @@ -489,18 +489,18 @@ type DatabaseFirewallRule struct { // DatabaseCreateLogsinkRequest is used to create logsink for a database cluster type DatabaseCreateLogsinkRequest struct { - Name string `json:"sink_name"` - Type string `json:"sink_type"` - Config *LogsinkConfig `json:"config"` + Name string `json:"sink_name"` + Type string `json:"sink_type"` + Config *DatabaseLogsinkConfig `json:"config"` } // DatabaseUpdateLogsinkRequest ... type DatabaseUpdateLogsinkRequest struct { - Config *LogsinkConfig `json:"config"` + Config *DatabaseLogsinkConfig `json:"config"` } -// LogsinkConfig represents one of the configurable options (rsyslog_logsink, elasticsearch_logsink, or opensearch_logsink) for a logsink. -type LogsinkConfig struct { +// DatabaseLogsinkConfig represents one of the configurable options (rsyslog_logsink, elasticsearch_logsink, or opensearch_logsink) for a logsink. +type DatabaseLogsinkConfig struct { URL string `json:"url,omitempty"` IndexPrefix string `json:"index_prefix,omitempty"` IndexDaysMax string `json:"index_days_max,omitempty"` diff --git a/databases_test.go b/databases_test.go index 58ef301..b41fc3a 100644 --- a/databases_test.go +++ b/databases_test.go @@ -3238,7 +3238,7 @@ func TestDatabases_CreateLogsink(t *testing.T) { ID: "deadbeef-dead-4aa5-beef-deadbeef347d", Name: "logs-sink", Type: "opensearch", - Config: &LogsinkConfig{ + Config: &DatabaseLogsinkConfig{ URL: "https://user:passwd@192.168.0.1:25060", IndexPrefix: "opensearch-logs", }, @@ -3264,7 +3264,7 @@ func TestDatabases_CreateLogsink(t *testing.T) { log, _, err := client.Databases.CreateLogsink(ctx, dbID, &DatabaseCreateLogsinkRequest{ Name: "logs-sink", Type: "opensearch", - Config: &LogsinkConfig{ + Config: &DatabaseLogsinkConfig{ URL: "https://user:passwd@192.168.0.1:25060", IndexPrefix: "opensearch-logs", }, @@ -3288,7 +3288,7 @@ func TestDatabases_GetLogsink(t *testing.T) { ID: "deadbeef-dead-4aa5-beef-deadbeef347d", Name: "logs-sink", Type: "opensearch", - Config: &LogsinkConfig{ + Config: &DatabaseLogsinkConfig{ URL: "https://user:passwd@192.168.0.1:25060", IndexPrefix: "opensearch-logs", }, @@ -3343,7 +3343,7 @@ func TestDatabases_UpdateLogsink(t *testing.T) { }) _, err := client.Databases.UpdateLogsink(ctx, dbID, logsinkID, &DatabaseUpdateLogsinkRequest{ - Config: &LogsinkConfig{ + Config: &DatabaseLogsinkConfig{ Server: "192.168.0.1", Port: 514, TLS: false, @@ -3367,7 +3367,7 @@ func TestDatabases_ListLogsinks(t *testing.T) { ID: "deadbeef-dead-4aa5-beef-deadbeef347d", Name: "logs-sink", Type: "opensearch", - Config: &LogsinkConfig{ + Config: &DatabaseLogsinkConfig{ URL: "https://user:passwd@192.168.0.1:25060", IndexPrefix: "opensearch-logs", }, @@ -3376,7 +3376,7 @@ func TestDatabases_ListLogsinks(t *testing.T) { ID: "d6e95157-5f58-48d0-9023-8cfb409d102a", Name: "logs-sink-2", Type: "opensearch", - Config: &LogsinkConfig{ + Config: &DatabaseLogsinkConfig{ URL: "https://user:passwd@192.168.0.1:25060", IndexPrefix: "opensearch-logs", },