Skip to content

Commit

Permalink
Database: Namespace logsink (#712)
Browse files Browse the repository at this point in the history
  • Loading branch information
danaelhe authored Aug 20, 2024
1 parent 9fe130b commit 0c07670
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions databases.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"`
Expand Down
12 changes: 6 additions & 6 deletions databases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:[email protected]:25060",
IndexPrefix: "opensearch-logs",
},
Expand All @@ -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:[email protected]:25060",
IndexPrefix: "opensearch-logs",
},
Expand All @@ -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:[email protected]:25060",
IndexPrefix: "opensearch-logs",
},
Expand Down Expand Up @@ -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,
Expand All @@ -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:[email protected]:25060",
IndexPrefix: "opensearch-logs",
},
Expand All @@ -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:[email protected]:25060",
IndexPrefix: "opensearch-logs",
},
Expand Down

0 comments on commit 0c07670

Please sign in to comment.