From d041fee4073a984a3c868b27321dafe5ff210e7c Mon Sep 17 00:00:00 2001 From: Anna Lushnikova Date: Thu, 3 Oct 2024 10:25:08 -0400 Subject: [PATCH 1/6] [databases]: test logsink --- databases.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/databases.go b/databases.go index 42954928..c35e2336 100644 --- a/databases.go +++ b/databases.go @@ -1886,7 +1886,12 @@ func (svc *DatabasesServiceOp) CreateLogsink(ctx context.Context, databaseID str return nil, nil, err } - root := new(DatabaseLogsink) + // root := new(DatabaseLogsink) + root := &DatabaseLogsink{ + Name: createLogsink.Name, + Type: createLogsink.Type, + Config: createLogsink.Config, + } resp, err := svc.client.Do(ctx, req, root) if err != nil { return nil, resp, err From 43460fafdcbcaee4bdf9e9238894acdb3b86901c Mon Sep 17 00:00:00 2001 From: Anna Lushnikova Date: Thu, 3 Oct 2024 10:47:35 -0400 Subject: [PATCH 2/6] [databases]: test 2 logsink --- databases.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/databases.go b/databases.go index c35e2336..fbbb0a3c 100644 --- a/databases.go +++ b/databases.go @@ -1886,12 +1886,11 @@ func (svc *DatabasesServiceOp) CreateLogsink(ctx context.Context, databaseID str return nil, nil, err } - // root := new(DatabaseLogsink) - root := &DatabaseLogsink{ - Name: createLogsink.Name, - Type: createLogsink.Type, - Config: createLogsink.Config, - } + root := new(DatabaseLogsink) + root.Name = createLogsink.Name + root.Type = createLogsink.Type + root.Config = createLogsink.Config + resp, err := svc.client.Do(ctx, req, root) if err != nil { return nil, resp, err From 6f8fd5e4250c625ef81725361e47eb24c93328c9 Mon Sep 17 00:00:00 2001 From: Anna Lushnikova Date: Thu, 3 Oct 2024 11:20:11 -0400 Subject: [PATCH 3/6] [databases]: test 3 logsink --- databases.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/databases.go b/databases.go index fbbb0a3c..556aeef8 100644 --- a/databases.go +++ b/databases.go @@ -1886,16 +1886,13 @@ func (svc *DatabasesServiceOp) CreateLogsink(ctx context.Context, databaseID str return nil, nil, err } - root := new(DatabaseLogsink) - root.Name = createLogsink.Name - root.Type = createLogsink.Type - root.Config = createLogsink.Config + root := new(databaseLogsinksRoot) resp, err := svc.client.Do(ctx, req, root) if err != nil { return nil, resp, err } - return root, resp, nil + return &root.Sinks[0], resp, nil } // GetLogsink gets a logsink for a database From 9aa2d56dce994668e64bf434237027e66adb5cc0 Mon Sep 17 00:00:00 2001 From: Anna Lushnikova Date: Thu, 3 Oct 2024 11:28:12 -0400 Subject: [PATCH 4/6] [databases]: test 4 logsink --- databases.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/databases.go b/databases.go index 556aeef8..f84c2538 100644 --- a/databases.go +++ b/databases.go @@ -828,6 +828,10 @@ type databaseTopicsRoot struct { Topics []DatabaseTopic `json:"topics"` } +type databaseLogsinkRoot struct { + Sink *DatabaseLogsink `json:"sink"` +} + type databaseLogsinksRoot struct { Sinks []DatabaseLogsink `json:"sinks"` } @@ -1886,13 +1890,13 @@ func (svc *DatabasesServiceOp) CreateLogsink(ctx context.Context, databaseID str return nil, nil, err } - root := new(databaseLogsinksRoot) + root := new(databaseLogsinkRoot) resp, err := svc.client.Do(ctx, req, root) if err != nil { return nil, resp, err } - return &root.Sinks[0], resp, nil + return root.Sink, resp, nil } // GetLogsink gets a logsink for a database From f61355823152c433151ca846fad07a4d7893034d Mon Sep 17 00:00:00 2001 From: Anna Lushnikova Date: Thu, 3 Oct 2024 11:45:36 -0400 Subject: [PATCH 5/6] [databases]: test 5 logsink --- databases.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/databases.go b/databases.go index f84c2538..42f67593 100644 --- a/databases.go +++ b/databases.go @@ -1907,12 +1907,12 @@ func (svc *DatabasesServiceOp) GetLogsink(ctx context.Context, databaseID string return nil, nil, err } - root := new(DatabaseLogsink) + root := new(databaseLogsinkRoot) resp, err := svc.client.Do(ctx, req, root) if err != nil { return nil, resp, err } - return root, resp, nil + return root.Sink, resp, nil } // ListTopics returns all topics for a given kafka cluster @@ -1942,7 +1942,8 @@ func (svc *DatabasesServiceOp) UpdateLogsink(ctx context.Context, databaseID str return nil, err } - resp, err := svc.client.Do(ctx, req, nil) + root := new(databaseLogsinkRoot) + resp, err := svc.client.Do(ctx, req, root) if err != nil { return resp, err } From 56a323c1ff6f93a00f29b48d627273204ab1e531 Mon Sep 17 00:00:00 2001 From: Anna Lushnikova Date: Thu, 3 Oct 2024 16:18:48 -0400 Subject: [PATCH 6/6] [databases]: test 6 logsink --- databases.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/databases.go b/databases.go index 42f67593..0cd1e51c 100644 --- a/databases.go +++ b/databases.go @@ -1907,12 +1907,14 @@ func (svc *DatabasesServiceOp) GetLogsink(ctx context.Context, databaseID string return nil, nil, err } - root := new(databaseLogsinkRoot) + // root := new(databaseLogsinkRoot) + root := new(DatabaseLogsink) + resp, err := svc.client.Do(ctx, req, root) if err != nil { return nil, resp, err } - return root.Sink, resp, nil + return root, resp, nil } // ListTopics returns all topics for a given kafka cluster