RobertIndie commented on code in PR #2437:
URL: https://github.com/apache/streampipes/pull/2437#discussion_r1516274650


##########
streampipes-client-go/streampipes/config/client_connection_config.go:
##########
@@ -0,0 +1,42 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package config
+
+type StreamPipesClientConnectConfig struct {

Review Comment:
   ```suggestion
   type StreamPipesClientConfig struct {
   ```



##########
streampipes-client-go/examples/main.go:
##########
@@ -0,0 +1,69 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package main
+
+import (
+       "fmt"
+       "github.com/apache/streampipes/streampipes-client-go/streampipes"
+       "github.com/apache/streampipes/streampipes-client-go/streampipes/config"
+       "os"
+)
+
+/*
+       Here are some examples of using go client, including outputting the 
data returned by streams.
+       Only supports outputting model data
+*/
+
+func main() {
+       /*
+               "StreamPipesClientConnectConfig" can be configured through a 
variety of ways, including the function configuration, and use the struct 
configuration.
+               For example, using function configuration:
+               
config.NewStreamPipesClientConnectConfig("http://localhost:8030",config.NewStreamPipesApiKeyCredentials("<Your-User-Name>","<Your-API-Key>"))
+       */
+       Config := config.StreamPipesClientConnectConfig{
+               Url: "http://localhost:8030";,
+               Credential: config.StreamPipesApiKeyCredentials{
+                       UserName: "<Your-User-Name>",
+                       ApiKey:   "<Your-API-Key>",
+               },
+       }
+
+       StreamPipesClient, err := streampipes.NewStreamPipesClient(Config)

Review Comment:
   ```suggestion
        streamPipesClient, err := streampipes.NewStreamPipesClient(Config)
   ```



##########
streampipes-client-go/streampipes/internal/streampipes_http/delete_request.go:
##########
@@ -0,0 +1,79 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package streampipes_http
+
+import (
+       "github.com/apache/streampipes/streampipes-client-go/streampipes/config"
+       
"github.com/apache/streampipes/streampipes-client-go/streampipes/internal/statu_code"
+       "io"
+       "log"
+       "net/http"
+)
+
+type DeleteRequest struct {
+       HttpRequest *httpRequest
+}
+
+var _ HttpRequest = (*DeleteRequest)(nil)
+
+func NewDeleteRequest(config config.StreamPipesClientConnectConfig) 
*DeleteRequest {
+       return &DeleteRequest{
+               HttpRequest: NewHttpRequest(config),
+       }
+}
+
+func (d *DeleteRequest) ExecuteRequest(model interface{}) interface{} {
+       d.makeRequest()
+
+       if d.HttpRequest.Response.StatusCode == 200 {
+               return nil
+       } else {
+               switch d.HttpRequest.Response.StatusCode {
+               case statu_code.BadRequest.Code():
+                       log.Fatal(statu_code.BadRequest.Code(), 
statu_code.BadRequest.Message())
+               case statu_code.Unauthorized.Code():
+                       log.Fatal(statu_code.Unauthorized.Code(), 
statu_code.Unauthorized.Message())
+               case statu_code.AccessDenied.Code():
+                       log.Fatal(statu_code.AccessDenied.Code(), 
statu_code.AccessDenied.Message())
+               case statu_code.MethodNotAllowed.Code():
+                       log.Fatal(statu_code.MethodNotAllowed.Code(), 
statu_code.MethodNotAllowed.Message())
+               default:
+                       defer d.HttpRequest.Response.Body.Close()
+                       body, _ := io.ReadAll(d.HttpRequest.Response.Body)
+                       log.Fatal(d.HttpRequest.Response.Status, string(body))

Review Comment:
   I think this logic could be abstracted.



##########
streampipes-client-go/streampipes/internal/util/streampipes_api_path.go:
##########
@@ -0,0 +1,66 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package util
+
+import (
+       "strings"
+)
+
+type StreamPipesApiPath struct {
+       PathItems []string // PathItems stores URL fragments
+}
+
+func NewStreamPipesApiPath(initialPathItems []string) *StreamPipesApiPath {
+
+       return &StreamPipesApiPath{
+               PathItems: initialPathItems,
+       }
+}
+
+func (s *StreamPipesApiPath) FromStreamPipesBasePath() *StreamPipesApiPath {
+       path := "streampipes-backend"
+       s.PathItems = append(s.PathItems, path)
+       return s
+}
+
+func (s *StreamPipesApiPath) FromStreamPipesBasePathWithSubPaths(allSubPaths 
[]string) *StreamPipesApiPath {
+       return s.FromStreamPipesBasePath().AddToPath(allSubPaths)
+}
+
+func (s *StreamPipesApiPath) AddToPath(pathItem []string) *StreamPipesApiPath {
+       s.PathItems = append(s.PathItems, pathItem...)
+       return s
+}
+
+func (s *StreamPipesApiPath) ToString() string {
+       //Splicing URLs
+       if len(s.PathItems) == 1 {
+               return s.PathItems[0]
+       }
+       path := strings.Join(s.PathItems, "/")
+       s.PathItems = []string{path}
+       return path
+}
+
+func (s *StreamPipesApiPath) GetBaseUrl(Url string) *StreamPipesApiPath {
+
+       ApiPath := 
NewStreamPipesApiPath([]string{Url}).FromStreamPipesBasePath()

Review Comment:
   ```suggestion
        apiPath := 
NewStreamPipesApiPath([]string{Url}).FromStreamPipesBasePath()
   ```



##########
streampipes-client-go/streampipes/internal/util/streampipes_api_path_test.go:
##########
@@ -0,0 +1,65 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package util
+
+import (
+       "testing"
+)
+
+func TestNewStreamPipesApiPath(t *testing.T) {
+       pathItems := []string{"part1", "part2"}
+       path := NewStreamPipesApiPath(pathItems)
+       if len(path.PathItems) != len(pathItems) {
+               t.Errorf("Expected path items length to be %d, got %d", 
len(pathItems), len(path.PathItems))
+       }
+}
+
+func TestFromStreamPipesBasePath(t *testing.T) {
+       path := NewStreamPipesApiPath([]string{"part1", 
"part2"}).FromStreamPipesBasePath()
+       expectedPathItems := []string{"part1", "part2", "streampipes-backend"}
+       if len(path.PathItems) != len(expectedPathItems) {
+               t.Errorf("Expected path items length to be %d, got %d", 
len(expectedPathItems), len(path.PathItems))
+       }
+}
+
+func TestFromStreamPipesBasePathWithSubPaths(t *testing.T) {
+       path := NewStreamPipesApiPath([]string{"part1", 
"part2"}).FromStreamPipesBasePathWithSubPaths([]string{"sub1", "sub2"})
+       expectedPathItems := []string{"part1", "part2", "streampipes-backend", 
"sub1", "sub2"}
+       if len(path.PathItems) != len(expectedPathItems) {
+               t.Errorf("Expected path items length to be %d, got %d", 
len(expectedPathItems), len(path.PathItems))
+       }
+}
+
+func TestAddToPath(t *testing.T) {
+       path := NewStreamPipesApiPath([]string{"part1", 
"part2"}).AddToPath([]string{"sub1", "sub2"})
+       expectedPathItems := []string{"part1", "part2", "sub1", "sub2"}

Review Comment:
   We have defined expectedPathItems but we didn't assert it. We always use the 
`GetBaseUrl` method for StreamPipesApiPath to get the final result, right? 
Then, we need to test it.



##########
streampipes-client-go/streampipes/internal/serializer/deserializer.go:
##########
@@ -0,0 +1,71 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package serializer
+
+import (
+       "encoding/json"
+       
"github.com/apache/streampipes/streampipes-client-go/streampipes/model/data_lake"
+       "log"
+)
+
+type Deserializer interface {
+       GetUnmarshal(body []byte) interface{}
+}
+
+var _ Deserializer = (*UnmarshalDataLakeMeasures)(nil)
+var _ Deserializer = (*UnmarshalDataSeries)(nil)
+var _ Deserializer = (*UnmarshalDataLakeMeasure)(nil)
+
+type UnmarshalDataLakeMeasures struct {
+       DeSerializerDataLakeMeasures *[]data_lake.DataLakeMeasure
+}
+
+type UnmarshalDataLakeMeasure struct {
+       DeSerializerDataLakeMeasure *data_lake.DataLakeMeasure
+}
+
+type UnmarshalDataSeries struct {
+       DeSerializerDataLakeSeries *data_lake.DataSeries
+}
+
+func (d *UnmarshalDataLakeMeasures) GetUnmarshal(data []byte) interface{} {

Review Comment:
   Please place the method implementation immediately after the struct 
definition.



##########
streampipes-client-go/streampipes/internal/serializer/deserializer.go:
##########
@@ -0,0 +1,71 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package serializer
+
+import (
+       "encoding/json"
+       
"github.com/apache/streampipes/streampipes-client-go/streampipes/model/data_lake"
+       "log"
+)
+
+type Deserializer interface {
+       GetUnmarshal(body []byte) interface{}
+}
+
+var _ Deserializer = (*UnmarshalDataLakeMeasures)(nil)
+var _ Deserializer = (*UnmarshalDataSeries)(nil)
+var _ Deserializer = (*UnmarshalDataLakeMeasure)(nil)
+
+type UnmarshalDataLakeMeasures struct {
+       DeSerializerDataLakeMeasures *[]data_lake.DataLakeMeasure

Review Comment:
   Why do we need to store this value into the struct?



##########
streampipes-client-go/streampipes/model/data_lake/data_series.go:
##########
@@ -0,0 +1,52 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package data_lake
+
+import (
+       "fmt"
+       "github.com/apache/streampipes/streampipes-client-go/streampipes/model"
+       "log"
+       "strings"
+)
+
+type DataSeries struct {
+       Total         int                `json:"total"`
+       Headers       []string           `json:"headers"`
+       AllDataSeries []model.DataSeries `json:"allDataSeries"`
+       SPQueryStatus string             `alias:"spQueryStatus" default:"OK"`
+       ForId         interface{}        `json:"forId"`
+}
+
+func (d DataSeries) Conversion() {

Review Comment:
   Maybe it's better to name it as `Print`



##########
streampipes-client-go/streampipes/internal/statu_code/code.go:
##########
@@ -0,0 +1,27 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package statu_code
+
+var (
+       BadRequest   = NewErrorCode(400, "Measurement series with given id not 
found")

Review Comment:
   ```suggestion
        MeasurementNotFound   = NewErrorCode(404, "Measurement series with 
given id not found")
   ```



##########
streampipes-client-go/streampipes/data_lake_measure_api.go:
##########
@@ -0,0 +1,91 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package streampipes
+
+import (
+       "github.com/apache/streampipes/streampipes-client-go/streampipes/config"
+       
"github.com/apache/streampipes/streampipes-client-go/streampipes/internal/serializer"
+       
"github.com/apache/streampipes/streampipes-client-go/streampipes/internal/streampipes_http"
+       
"github.com/apache/streampipes/streampipes-client-go/streampipes/model/data_lake"
+       "log"
+)
+
+/*
+DataLakeMeasure connects to the DataLakeMeasure endpoint of Streampipes.
+DataLakeMeasure supports GET and DELETE to delete or obtain resources
+The specific interaction behavior is provided by the method bound to the 
DataLakeMeasure struct.
+*/
+
+type DataLakeMeasure struct {
+       config config.StreamPipesClientConnectConfig
+}
+
+func NewDataLakeMeasures(clientConfig config.StreamPipesClientConnectConfig) 
*DataLakeMeasure {
+       //NewDataLakeMeasure is used to return an instance of *DataLakeMeasure,

Review Comment:
   ```suggestion
        // NewDataLakeMeasure is used to return an instance of *DataLakeMeasure,
   ```
   
   Please follow this comment format. Insert a space after `//`.



##########
streampipes-client-go/streampipes/streampipes_client.go:
##########
@@ -0,0 +1,74 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package streampipes
+
+import (
+       "errors"
+       "github.com/apache/streampipes/streampipes-client-go/streampipes/config"
+       "github.com/apache/streampipes/streampipes-client-go/streampipes/utils"
+       "log"
+       "net/url"
+       "strings"
+)
+
+/*
+ This is the central point of contact with StreamPipes and provides all the 
functionalities to interact with it.
+ The client provides so-called "API", each of which refers to the endpoint of 
the StreamPipes API.
+ e.g. `DataLakeMeasure` provides the actual methods to interact with 
StreamPipes API.
+*/
+
+type StreamPipesClient struct {
+       Config config.StreamPipesClientConnectConfig
+}
+
+func NewStreamPipesClient(Config config.StreamPipesClientConnectConfig) 
(*StreamPipesClient, error) {
+
+       //NewStreamPipesClient returns an instance of * StreamPipesClient
+       //Temporarily does not support HTTPS connections, nor does it support 
connecting to port 443
+
+       if Config.Credential == (config.StreamPipesApiKeyCredentials{}) {
+               log.Fatal("No credential entered")
+       }
+
+       if !utils.CheckUrl(Config.Url) {
+               log.Fatal("Please check if the URL is correct,Must be in the 
form of A://B:C," +
+                       "where A is either HTTP or HTTPS, not case sensitive.B 
must be the host and C must be the port.")
+       }
+
+       Url, err := url.Parse(Config.Url)
+       if err != nil {
+               log.Fatal("Please enter the correct URL", err)
+       }
+
+       if strings.EqualFold(Url.Scheme, "https") || Url.Port() == "443" {
+               return &StreamPipesClient{}, errors.New(
+                       "Invalid configuration passed! The given client 
configuration has " +
+                               "`https` and `port` set to `443`.\n ")

Review Comment:
   We don't have any configuration named `https` or `port. And `https` is a 
HTTP scheme which cann't be set to 443.



##########
streampipes-client-go/streampipes/internal/statu_code/code.go:
##########
@@ -0,0 +1,27 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package statu_code
+
+var (
+       BadRequest   = NewErrorCode(400, "Measurement series with given id not 
found")
+       Unauthorized = NewErrorCode(401, "The StreamPipes Backend returned an 
unauthorized error.\nPlease check your user name and/or password to be 
correct.")

Review Comment:
   We are using the api token, right?



##########
streampipes-client-go/streampipes/internal/streampipes_http/delete_request.go:
##########
@@ -0,0 +1,79 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package streampipes_http
+
+import (
+       "github.com/apache/streampipes/streampipes-client-go/streampipes/config"
+       
"github.com/apache/streampipes/streampipes-client-go/streampipes/internal/statu_code"
+       "io"
+       "log"
+       "net/http"
+)
+
+type DeleteRequest struct {
+       HttpRequest *httpRequest
+}
+
+var _ HttpRequest = (*DeleteRequest)(nil)
+
+func NewDeleteRequest(config config.StreamPipesClientConnectConfig) 
*DeleteRequest {
+       return &DeleteRequest{
+               HttpRequest: NewHttpRequest(config),
+       }
+}
+
+func (d *DeleteRequest) ExecuteRequest(model interface{}) interface{} {
+       d.makeRequest()
+
+       if d.HttpRequest.Response.StatusCode == 200 {
+               return nil
+       } else {
+               switch d.HttpRequest.Response.StatusCode {
+               case statu_code.BadRequest.Code():
+                       log.Fatal(statu_code.BadRequest.Code(), 
statu_code.BadRequest.Message())
+               case statu_code.Unauthorized.Code():
+                       log.Fatal(statu_code.Unauthorized.Code(), 
statu_code.Unauthorized.Message())
+               case statu_code.AccessDenied.Code():
+                       log.Fatal(statu_code.AccessDenied.Code(), 
statu_code.AccessDenied.Message())
+               case statu_code.MethodNotAllowed.Code():
+                       log.Fatal(statu_code.MethodNotAllowed.Code(), 
statu_code.MethodNotAllowed.Message())
+               default:
+                       defer d.HttpRequest.Response.Body.Close()
+                       body, _ := io.ReadAll(d.HttpRequest.Response.Body)
+                       log.Fatal(d.HttpRequest.Response.Status, string(body))
+               }
+
+       }
+       return nil
+}
+
+func (d *DeleteRequest) makeRequest() {
+       var err error
+       d.HttpRequest.Header.Req, _ = http.NewRequest("DELETE", 
d.HttpRequest.Url, nil)
+       
d.HttpRequest.Header.XApiKey(d.HttpRequest.ClientConnectConfig.Credential.ApiKey)
+       
d.HttpRequest.Header.XApiUser(d.HttpRequest.ClientConnectConfig.Credential.UserName)
+       d.HttpRequest.Header.AcceptJson()

Review Comment:
   Maybe we can abstract this logic.



##########
streampipes-client-go/streampipes/internal/util/streampipes_api_path.go:
##########
@@ -0,0 +1,66 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package util
+
+import (
+       "strings"
+)
+
+type StreamPipesApiPath struct {
+       PathItems []string // PathItems stores URL fragments
+}
+
+func NewStreamPipesApiPath(initialPathItems []string) *StreamPipesApiPath {
+
+       return &StreamPipesApiPath{
+               PathItems: initialPathItems,
+       }
+}
+
+func (s *StreamPipesApiPath) FromStreamPipesBasePath() *StreamPipesApiPath {
+       path := "streampipes-backend"
+       s.PathItems = append(s.PathItems, path)
+       return s
+}
+
+func (s *StreamPipesApiPath) FromStreamPipesBasePathWithSubPaths(allSubPaths 
[]string) *StreamPipesApiPath {
+       return s.FromStreamPipesBasePath().AddToPath(allSubPaths)
+}
+
+func (s *StreamPipesApiPath) AddToPath(pathItem []string) *StreamPipesApiPath {
+       s.PathItems = append(s.PathItems, pathItem...)
+       return s
+}
+
+func (s *StreamPipesApiPath) ToString() string {

Review Comment:
   In golang, we use `String`



##########
streampipes-client-go/streampipes/internal/statu_code/code.go:
##########


Review Comment:
   There is a problem with the error_code design.
   
   Do you want these error_code be generic for all other resources instead of 
just for the data_lake_measure? Then we need to refine the error message.
   
   If yes, then golang builtin library has already define a set of HTTP status 
code for you. eg. `http.StatusOK`



##########
streampipes-client-go/streampipes/internal/streampipes_http/delete_request.go:
##########
@@ -0,0 +1,79 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package streampipes_http
+
+import (
+       "github.com/apache/streampipes/streampipes-client-go/streampipes/config"
+       
"github.com/apache/streampipes/streampipes-client-go/streampipes/internal/statu_code"
+       "io"
+       "log"
+       "net/http"
+)
+
+type DeleteRequest struct {
+       HttpRequest *httpRequest

Review Comment:
   Why do we expose this field?



##########
streampipes-client-go/streampipes/internal/util/streampipes_api_path.go:
##########
@@ -0,0 +1,66 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package util
+
+import (
+       "strings"
+)
+
+type StreamPipesApiPath struct {
+       PathItems []string // PathItems stores URL fragments

Review Comment:
   We don't need to expose this field, right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to